Example usage for com.google.gwt.user.client Window getClientHeight

List of usage examples for com.google.gwt.user.client Window getClientHeight

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window getClientHeight.

Prototype

public static int getClientHeight() 

Source Link

Usage

From source file:cc.alcina.framework.gwt.client.widget.SelectWithSearch.java

License:Apache License

public void showPopupWithData(boolean filterTextBox) {
    ensurePanelForPopup();/*from  ww  w.  j av a2s .com*/
    if (popdownStyleName != null) {
        panelForPopup.addStyleName(popdownStyleName);
    }
    if (filterTextBox && !filter.isQueueing()) {
        filter(filter.getTextBox().getText());
    }
    if (isShowFilterInPopup() && !panelForPopup.getElement().isOrHasChild(filter.getElement())) {
        FlowPanel fp = new FlowPanel();
        fp.add(filter);
        fp.add(panelForPopup.getWidget());
        panelForPopup.setWidget(fp);
    }
    if (matchWidthToSource) {
        filter.getElement().getStyle().setPropertyPx("minWidth", showFilterRelativeTo.get().getOffsetWidth());
    }
    this.relativePopupPanel = RelativePopupPositioning.showPopup(
            isShowFilterInPopup() ? showFilterRelativeTo.get() : filter, null, RootPanel.get(),
            new RelativePopupAxis[] { RelativePopupPositioning.BOTTOM_LTR }, RootPanel.get(), panelForPopup,
            getShiftX(), shiftY());
    this.relativePopupPanel.addAttachHandler(e -> {
        if (!e.isAttached()) {
            onPopdownShowing(this.relativePopupPanel, false);
        }
    });
    if (isShowFilterInPopup()) {
        filter.setValue("");
        filter.getTextBox().setFocus(true);
        Scheduler.get().scheduleDeferred(() -> {
            filter.getTextBox().setFocus(true);
        });
    }
    onPopdownShowing(relativePopupPanel, true);
    int border = -2;
    // the 20 is a pad to make sure we have a reasonable scroller size in
    // edge cases
    if (itemHolder.getOffsetHeight() + border > (panelForPopup.getOffsetHeight() - 20)
            && !isAutoHolderHeight()) {
        int hhInt = 0;
        if (holderHeight != null && holderHeight.endsWith("px")) {
            // chrome exceptions with replace?
            String toParse = holderHeight.replace("px", "");
            hhInt = CommonUtils.friendlyParseInt(toParse);
            hhInt = Math.max(hhInt, 100);
        } else {
            hhInt = Window.getClientHeight() / 3;
        }
        String scrollerHeight = Math.min(hhInt, itemHolder.getOffsetHeight() - border) + "px";
        scroller.setHeight(scrollerHeight);
    }
    int minWidth = holder.getOffsetWidth();
    if (minWidth == 0) {// probably inline
        minWidth = filter.getOffsetWidth();
    }
    minWidth = adjustDropdownWidth(minWidth);
    if (minWidth > 20) {
        scroller.getElement().getStyle().setProperty("minWidth", minWidth + "px");
        if (BrowserMod.isIEpre9()) {
            relativePopupPanel.getElement().getStyle().setProperty("minWidth", (minWidth + 20) + "px");
        }
    }
    afterUpdateItems(emptyItems);
}

From source file:cc.alcina.framework.gwt.client.widget.Wizard.java

License:Apache License

public Widget renderPage() {
    FlowPanel fp = new FlowPanel();
    fp.addAttachHandler(evt -> System.out.println(fp.getElement().getInnerHTML()));
    currentWidget = fp;/*from w  w  w.  j  ava2s  .c o m*/
    fp.setStyleName(FRAME_STYLE_NAME);
    fp.addStyleName(getStyleName());
    renderHeader(fp);
    if (usePageTabs) {
        renderTabPane(fp);
        return fp;
    }
    WizardPage page = pages.get(pageIndex);
    Widget w = page.getPageWidget();
    w.addStyleName("wizard-form");
    if (contentScrollPanelHeight != 0) {
        ScrollPanel sp = new ScrollPanel();
        sp.setHeight(contentScrollPanelHeight + "px");
        sp.add(w);
        fp.add(sp);
    } else {
        fp.add(w);
    }
    renderButtonsPane(fp);
    PermissibleAction highlighted = page.getHighlightedAction();
    highlighted = highlighted == null ? CommonUtils.first(toolbar.getActions()) : highlighted;
    if (highlighted == previousPage || highlighted == cancel) {
        highlighted = null;
    }
    if (highlighted != null) {
        toolbar.getButtonForAction(highlighted).addStyleName("highlighted");
    }
    toolbar.addVetoableActionListener(this);
    if (renderInScrollPanel) {
        ScrollPanel sp = new ScrollPanel();
        sp.getElement().getStyle().setPropertyPx("maxHeight", Window.getClientHeight() * 70 / 100);
        fp.getElement().getStyle().setMargin(0.8, Unit.EM);
        sp.add(fp);
        currentWidget = sp;
        return sp;
    } else {
        return fp;
    }
}

From source file:cc.kune.common.client.notify.SimpleUserMessage.java

License:GNU Affero Public License

/**
 * Show./*  www.j  a  v  a 2  s  .  c o m*/
 *
 * @param message the message
 */
public void show(final String message) {
    msg.setText(message);
    popupPalette = new PopupPanel(true, false);
    popupPalette.setWidget(rp);
    popupPalette.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        public void setPosition(final int offsetWidth, final int offsetHeight) {
            popupPalette.setPopupPosition((Window.getClientWidth() - msg.getOffsetWidth()) / 2,
                    Window.getClientHeight() / 3);
        }
    });
    popupPalette.setStyleName("oc-user-msg-popup");
    popupPalette.setAnimationEnabled(true);
    timer.schedule(SHOWTIME);
}

From source file:cc.kune.common.client.tooltip.Tooltip.java

License:GNU Affero Public License

/**
 * Calculate position.//from   w  w w. j  ava  2  s  . com
 *
 * @return the tooltip position
 */
private TooltipPosition calculatePosition(final Widget forWidget) {
    return TooltipPositionCalculator.calculate(Window.getClientWidth(), Window.getClientHeight(),
            forWidget.getAbsoluteLeft(), forWidget.getAbsoluteTop(), forWidget.getOffsetWidth(),
            forWidget.getOffsetHeight(), getTip().getWidth(), getTip().getHeight());
}

From source file:cc.kune.common.client.ui.dialogs.BasicTopDialog.java

License:GNU Affero Public License

/**
 * Recalculate size.
 */
public void recalculateSize() {
    setSizes(Window.getClientWidth(), Window.getClientHeight());
}

From source file:cc.kune.common.client.ui.KuneWindowUtils.java

License:GNU Affero Public License

/**
 * Gets the client height./*from  www.j  ava 2 s  .  c o m*/
 * 
 * @return the client height
 */
public static int getClientHeight() {
    return Window.getClientHeight();
}

From source file:cc.kune.common.client.ui.PopupBottomPanel.java

License:GNU Affero Public License

@Override
protected void setCenterPositionImpl() {
    setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        @Override/* w  ww  .  j a  v  a  2s  .c o  m*/
        public void setPosition(final int offsetWidth, final int offsetHeight) {
            final Widget widget = getWidget();
            final int x = (Window.getClientWidth() - (widget != null ? getWidget().getOffsetWidth() : 0)) / 2;
            final int y = Window.getClientHeight() - (widget != null ? getWidget().getOffsetHeight() : 0);
            PopupBottomPanel.this.setPopupPosition(x, y);
        }
    });
}

From source file:cc.kune.core.client.sub.SubtitlesWidget.java

License:GNU Affero Public License

@Override
public void show(final SimpleCallback callback) {
    this.callback = callback;
    popup.setWidget(widget);//w  w w . jav  a 2s .  c o m
    setSize(Window.getClientWidth(), Window.getClientHeight());
    popup.sinkEvents(Event.MOUSEEVENTS);
    popup.show();
    final Show showAtIni = new Show(widget.getElement());
    showAtIni.setDuration(2);
    showAtIni.play();
    final SlideRight slideAtIni = new SlideRight(widget.getElement());
    slideAtIni.setDuration(2);
    slideAtIni.play();
    this.showing = true;
}

From source file:cc.kune.gspace.client.feedback.FeedbackBottomPanel.java

License:GNU Affero Public License

@Override
protected void setCenterPositionImpl() {
    setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        @Override//from   w ww . j  av  a 2  s  .c o  m
        public void setPosition(final int offsetWidth, final int offsetHeight) {
            final int x = Window.getClientWidth() - offsetWidth - 76;
            final int y = Window.getClientHeight() - offsetHeight + 1;
            FeedbackBottomPanel.this.setPopupPosition(x, y);
        }
    });
}

From source file:cc.kune.gspace.client.viewers.TutorialViewer.java

License:GNU Affero Public License

/**
 * Resize tutorial frame.//from   w w  w . ja v a2  s. c  o m
 */
private void resizeTutorialFrame() {
    int height = Window.getClientHeight();
    int width = Window.getClientHeight();
    height = (int) (((float) SIZE_INT * (float) height) / 100);
    width = (int) (((float) SIZE_INT * (float) width) / 100);
    final String hpercent = height + "px";
    final String vpercent = width + "px";
    // We rest the bottom are of buttons
    frame.setHeight(height - 70 + "px");
    frame.setWidth(width - 70 + "px");
    dialog.setHeight(hpercent);
    dialog.setWidth(vpercent);
    Log.info("Resizing to h: " + hpercent + " w: " + vpercent);
}