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:com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.CubaFileUploadProgressWindow.java

License:Apache License

private boolean cursorInsideBrowserContentArea(Event event) {
    if (event.getClientX() < 0 || event.getClientY() < 0) {
        // Outside to the left or above
        return false;
    }/*from  w  w  w  . j  a  va2  s  .co  m*/

    if (event.getClientX() > Window.getClientWidth() || event.getClientY() > Window.getClientHeight()) {
        // Outside to the right or below
        return false;
    }

    return true;
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.Tools.java

License:Apache License

public static void showPopup(VOverlay overlay, int left, int top) {
    overlay.setAutoHideEnabled(true);//from www  .  j  a v  a  2  s . com
    overlay.setVisible(false);
    overlay.show();

    Widget widget = overlay.getWidget();
    if (widget instanceof VVerticalLayout) {
        resetItemSelection(widget);

        VVerticalLayout verticalLayout = (VVerticalLayout) widget;
        if (verticalLayout.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) {
            int widgetCount = verticalLayout.getWidgetCount();
            if (widgetCount > 1) {
                Widget verticalSlot = verticalLayout.getWidget(0);
                Widget buttonWidget = ((Slot) verticalSlot).getWidget();
                buttonWidget.addStyleName(SELECTED_ITEM_STYLE);
                if (buttonWidget instanceof FocusWidget) {
                    ((FocusWidget) buttonWidget).setFocus(true);
                }
            }
        }
    }

    // mac FF gets bad width due GWT popups overflow hacks,
    // re-determine width
    int offsetWidth = overlay.getOffsetWidth();
    int offsetHeight = overlay.getOffsetHeight();
    if (offsetWidth + left > Window.getClientWidth()) {
        left = left - offsetWidth;
        if (left < 0) {
            left = 0;
        }
    }
    if (offsetHeight + top > Window.getClientHeight()) {
        top = top - offsetHeight;
        if (top < 0) {
            top = 0;
        }
    }

    overlay.setPopupPosition(left, top);
    overlay.setVisible(true);
}

From source file:com.haulmont.cuba.web.widgets.client.addons.popupbutton.VPopupButton.java

License:Apache License

void showPopup() {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        public void execute() {
            if (position.equals("auto")) {
                int extra = 20;

                int left = getPopupPositionWidget().getAbsoluteLeft();
                if (direction.isHorizontalCenter()) {
                    left -= (popup.getOffsetWidth() - getPopupPositionWidget().getOffsetWidth()) / 2;
                } else if (direction.isLeft()) {
                    left -= popup.getOffsetWidth() - getPopupPositionWidget().getOffsetWidth();
                }/*from   w  w  w.  j  a v a  2 s. c o m*/
                int top = getPopupPositionWidget().getAbsoluteTop()
                        + getPopupPositionWidget().getOffsetHeight();
                int browserWindowWidth = Window.getClientWidth() + Window.getScrollLeft();
                int browserWindowHeight = Window.getClientHeight() + Window.getScrollTop();
                if (left + popup.getOffsetWidth() > browserWindowWidth - extra) {
                    left = getPopupPositionWidget().getAbsoluteLeft()
                            - (popup.getOffsetWidth() - getPopupPositionWidget().getOffsetWidth());
                }
                if (top + popup.getOffsetHeight() > browserWindowHeight - extra) {
                    top = getPopupPositionWidget().getAbsoluteTop() - popup.getOffsetHeight() - 2;
                }
                left = left + xOffset;
                if (left < 0) {
                    left = 0;
                }
                popup.setPopupPosition(left, top + yOffset);
                popup.setVisible(true);
            } else if (position.equals("fixed")) {
                int extra = 20;

                int left = getPopupPositionWidget().getAbsoluteLeft();
                int top = getPopupPositionWidget().getAbsoluteTop() + getPopupPositionWidget().getOffsetHeight()
                        - Window.getScrollTop();

                int browserWindowWidth = Window.getClientWidth() + Window.getScrollLeft();
                int clientHeight = Window.getClientHeight();
                if (left + popup.getOffsetWidth() > browserWindowWidth - extra) {
                    left = getPopupPositionWidget().getAbsoluteLeft()
                            - (popup.getOffsetWidth() - getPopupPositionWidget().getOffsetWidth());
                }
                if (top + popup.getOffsetHeight() > clientHeight - extra) {
                    top = (getPopupPositionWidget().getAbsoluteTop() - Window.getScrollTop())
                            - popup.getOffsetHeight() - 2;
                }
                left = left + xOffset;
                if (left < 0) {
                    left = 0;
                }
                popup.setPopupPosition(left, top + yOffset);
                popup.addStyleName("fixed");
                popup.setVisible(true);
            }
        }
    });
}

From source file:com.hydro4ge.mycircle.client.MyCircle.java

License:Apache License

public void onModuleLoad() {
    MyDrawing d = new MyDrawing(Window.getClientWidth(), Window.getClientHeight());
    RootPanel.get().add(d);
}

From source file:com.ikon.extension.frontend.client.widget.dropbox.ConfirmPopup.java

License:Open Source License

/**
 * Shows de popup//from w  ww  . j a va 2s  . c  o m
 */
public void show() {
    setText(GeneralComunicator.i18n("confirm.label"));
    int left = (Window.getClientWidth() - 300) / 2;
    int top = (Window.getClientHeight() - 125) / 2;
    setPopupPosition(left, top);
    super.show();
}

From source file:com.ikon.extension.frontend.client.widget.dropbox.FolderSelectPopup.java

License:Open Source License

/**
 * Shows the popup//from ww w  .j  a  v  a  2 s  .  co m
 */
public void show() {
    int left = (Window.getClientWidth() - 450) / 2;
    int top = (Window.getClientHeight() - 350) / 2;
    setPopupPosition(left, top);

    super.show();
    // Resets to initial tree value
    folderSelectTree.reset();
}

From source file:com.ikon.frontend.client.panel.ExtendedDockPanel.java

License:Open Source License

/**
 * SetWidgetsSize/*  w  w w.j  a va  2 s.  c om*/
 */
private void SetWidgetsSize() {
    // Calculating real height
    usableHeight = Window.getClientHeight();

    // Initialize dockPanel size
    dockPanel.setSize("" + Window.getClientWidth(), "" + usableHeight);

    // The active panel must be the last on initalization because establishes coordenates
    leftBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH,
            usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));
    rightBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH,
            usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));

    centerWidth = Window.getClientWidth() - (2 * VERTICAL_BORDER_PANEL_WIDTH);
    centerHeight = usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT);

    topPanel.setWidth("" + Window.getClientWidth());
    desktop.setSize(centerWidth, centerHeight);
    search.setSize(centerWidth, centerHeight);
    dashboard.setSize(centerWidth, centerHeight);
    administration.setSize(centerWidth, centerHeight);
}

From source file:com.ikon.frontend.client.widget.AboutPopup.java

License:Open Source License

/**
 * About popup/*from   ww w  .j av  a 2  s  .  c o  m*/
 */
public AboutPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    futurama = new Futurama();
    int left = (Window.getClientWidth() - 300) / 2;
    int top = (Window.getClientHeight() - 280) / 2;

    vPanel = new VerticalPanel();
    text = new HTML();
    button = new Button(Main.i18n("button.close"), this);
    logo = new Image("img/logo_openkm.gif");

    vPanel.setWidth("300px");
    vPanel.setHeight("195px");
    button.setStyleName("okm-YesButton");

    text.setHTML(msg);

    vPanel.add(new HTML("<br>"));
    vPanel.add(logo);
    htmlAppVersion = new HTML(appVersion);
    vPanel.add(htmlAppVersion);
    htmlExtVersion = new HTML(extVersion);
    vPanel.add(htmlExtVersion);
    vPanel.add(new HTML("<br>"));
    vPanel.add(text);
    HTML htmlWeb = new HTML(web);
    vPanel.add(htmlWeb);
    HTML htmlTeam = new HTML(team);
    vPanel.add(htmlTeam);
    HTML htmlCopy = new HTML(copy);
    vPanel.add(htmlCopy);
    vPanel.add(button);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(logo, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(htmlAppVersion, HasAlignment.ALIGN_RIGHT);
    vPanel.setCellHorizontalAlignment(htmlExtVersion, HasAlignment.ALIGN_RIGHT);
    vPanel.setCellHorizontalAlignment(text, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(htmlWeb, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(htmlTeam, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(htmlCopy, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);

    setPopupPosition(left, top);

    super.hide();
    setWidget(vPanel);
}

From source file:com.ikon.frontend.client.widget.categories.CategoriesSelectPopup.java

License:Open Source License

/**
 * Shows the popup /*  w  w  w . ja va2s .co  m*/
 */
public void show() {
    initButtons();
    int left = (Window.getClientWidth() - 500) / 2;
    int top = (Window.getClientHeight() - 300) / 2;
    setPopupPosition(left, top);
    setText(Main.i18n("categories.folder.select.label"));

    // Resets to initial tree value
    folderSelectTree.reset();
    super.show();
}

From source file:com.ikon.frontend.client.widget.ConfirmPopup.java

License:Open Source License

/**
 * Shows de popup//from  w w w. jav  a 2 s  .  co  m
 */
public void show() {
    setText(Main.i18n("confirm.label"));
    int left = (Window.getClientWidth() - 300) / 2;
    int top = (Window.getClientHeight() - 125) / 2;
    setPopupPosition(left, top);
    super.show();
}