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:org.drools.guvnor.client.moduleeditor.soa.SOAServiceBuilderWidget.java

License:Apache License

/**
 * Popup the view source dialog, showing the given content.
 *//*www.j  a  v a  2s .  c  o m*/
public static void showSource(final String content, String name) {
    Constants constants = GWT.create(Constants.class);
    int windowWidth = Window.getClientWidth() / 2;
    int windowHeight = Window.getClientHeight() / 2;
    final FormStylePopup pop = new FormStylePopup(images.viewSource(), constants.ViewingSourceFor0(name),
            windowWidth);

    String[] rows = content.split("\n");

    FlexTable table = new FlexTable();
    for (int i = 0; i < rows.length; i++) {

        table.setHTML(i, 0, "<span style='color:grey;'>" + (i + 1) + ".</span>");
        table.setHTML(i, 1, "<span style='color:green;' >|</span>");
        table.setHTML(i, 2, addSyntaxHilights(rows[i]));
    }

    ScrollPanel scrollPanel = new ScrollPanel(table);

    scrollPanel.setHeight(windowHeight + "px");
    scrollPanel.setWidth(windowWidth + "px");

    pop.addRow(scrollPanel);

    LoadingPopup.close();

    pop.show();

}

From source file:org.drools.guvnor.client.widgets.PopupListWidget.java

License:Apache License

/**
 * Height of pop-up, 75% of the client height or minimumHeight
 * /*from  w ww.  j  a  va  2  s .  com*/
 * @return
 */
protected int getPopupHeight() {
    int h = (int) (Window.getClientHeight() * 0.75);
    if (h < minimumHeight) {
        h = minimumHeight;
    }
    return h;
}

From source file:org.drools.workbench.screens.dtablexls.client.widgets.PopupListWidget.java

License:Apache License

public PopupListWidget() {
    setTitle(DecisionTableXLSEditorConstants.INSTANCE.ConversionResults());
    setBackdrop(BackdropType.STATIC);//  w  w w  . ja  v  a  2s. co m
    setKeyboard(true);
    setAnimation(true);
    setDynamicSafe(true);
    setWidth("900px");
    setMaxHeigth((Window.getClientHeight() * 0.75) + "px");

    add(uiBinder.createAndBindUi(this));
    add(new ModalFooterOKButton(new Command() {
        @Override
        public void execute() {
            hide();
        }
    }));
}

From source file:org.eclipse.che.ide.menu.ContextMenu.java

License:Open Source License

private void calculatePosition(PopupMenu popupMenu, int x, int y) {
    int windowHeight = Window.getClientHeight();
    int popupHeight = popupMenu.getOffsetHeight();

    boolean isMenuWithinWindow = popupHeight + y < windowHeight;

    popupMenu.getElement().getStyle().setTop(isMenuWithinWindow ? y : y - popupHeight, PX);
    popupMenu.getElement().getStyle().setLeft(x, PX);
}

From source file:org.eclipse.che.ide.toolbar.MenuLockLayer.java

License:Open Source License

public MenuLockLayer(CloseMenuHandler closeMenuCallback, int topOffset) {
    this.closeMenuCallback = closeMenuCallback;
    this.topOffset = topOffset;

    RootPanel.get().add(this, 0, topOffset);
    int width = Window.getClientWidth();
    int height = Window.getClientHeight() - topOffset;
    setWidth("" + width + "px");
    setHeight("" + height + "px");
    DOM.setElementAttribute(getElement(), "id", "menu-lock-layer-id");
    DOM.setStyleAttribute(getElement(), "zIndex", "" + (Integer.MAX_VALUE - 5));

    AbsolutePanel blockMouseEventsPanel = new LockLayer();
    blockMouseEventsPanel.setStyleName("exo-lockLayer");
    int lockWidth = Window.getClientWidth();
    int lockHeight = Window.getClientHeight() - topOffset;
    blockMouseEventsPanel.setWidth("" + lockWidth + "px");
    blockMouseEventsPanel.setHeight("" + lockHeight + "px");
    add(blockMouseEventsPanel, 0, 0);/*from   w w w  .j  a va2s .co  m*/
}

From source file:org.eclipse.che.ide.toolbar.PopupMenu.java

License:Open Source License

private void openSubPopup(final Element tableRowElement) {
    if (tableRowElement == null) {
        return;/* ww w  .  j a  v  a 2  s . c om*/
    }

    if (openedSubPopup != null) {
        if (tableRowElement == subPopupAnchor) {
            return;
        }

        openedSubPopup.closePopup();
    }

    if (subPopupAnchor != null) {
        Element e = subPopupAnchor;
        subPopupAnchor = null;
        setStyleNormal(e);
    }

    subPopupAnchor = tableRowElement;
    setStyleHovered(subPopupAnchor);

    int itemIndex = Integer.parseInt(tableRowElement.getAttribute("item-index"));
    Action menuItem = list.get(itemIndex);

    String idPrefix = itemIdPrefix;
    if (idPrefix != null) {
        idPrefix += "/" + presentationFactory.getPresentation(menuItem).getText();
    }

    openedSubPopup = new PopupMenu((ActionGroup) menuItem, actionManager, place, presentationFactory, lockLayer,
            actionSelectedHandler, keyBindingAgent, idPrefix);

    final int HORIZONTAL_OFFSET = 3;
    final int VERTICAL_OFFSET = 1;

    openedSubPopup.getElement().getStyle().setVisibility(Visibility.HIDDEN);
    lockLayer.add(openedSubPopup, 0, 0);

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            int left = getAbsoluteLeft() + getOffsetWidth() - HORIZONTAL_OFFSET;
            int top = tableRowElement.getAbsoluteTop() - lockLayer.getTopOffset() - VERTICAL_OFFSET;

            if (left + openedSubPopup.getOffsetWidth() > Window.getClientWidth()) {
                if (left > openedSubPopup.getOffsetWidth()) {
                    left = getAbsoluteLeft() - openedSubPopup.getOffsetWidth() + HORIZONTAL_OFFSET;
                } else {
                    int diff = left + openedSubPopup.getOffsetWidth() - Window.getClientWidth();
                    left -= diff;
                }
            }

            if (top + openedSubPopup.getOffsetHeight() > Window.getClientHeight()) {
                if (top > openedSubPopup.getOffsetHeight()) {
                    top = tableRowElement.getAbsoluteTop() - openedSubPopup.getOffsetHeight() + VERTICAL_OFFSET;
                } else {
                    int diff = top + openedSubPopup.getOffsetHeight() - Window.getClientHeight();
                    top -= diff;
                }
            }

            openedSubPopup.getElement().getStyle().setLeft(left, Unit.PX);
            openedSubPopup.getElement().getStyle().setTop(top, Unit.PX);
            openedSubPopup.getElement().getStyle().setVisibility(Visibility.VISIBLE);
        }
    });
}

From source file:org.eclipse.che.ide.ui.toolbar.PopupMenu.java

License:Open Source License

private void openSubPopup(final Element tableRowElement) {
    if (tableRowElement == null) {
        return;/*w w  w. j ava 2 s.com*/
    }

    if (openedSubPopup != null) {
        if (tableRowElement == subPopupAnchor) {
            return;
        }

        openedSubPopup.closePopup();
    }

    if (subPopupAnchor != null) {
        Element e = subPopupAnchor;
        subPopupAnchor = null;
        setStyleNormal(e);
    }

    subPopupAnchor = tableRowElement;
    setStyleHovered(subPopupAnchor);

    int itemIndex = Integer.parseInt(tableRowElement.getAttribute("item-index"));
    Action menuItem = list.get(itemIndex);

    String idPrefix = itemIdPrefix;
    if (idPrefix != null) {
        idPrefix += "/" + presentationFactory.getPresentation(menuItem).getText();
    }

    openedSubPopup = new PopupMenu((ActionGroup) menuItem, actionManager, managerProvider, presentationFactory,
            lockLayer, actionSelectedHandler, keyBindingAgent, idPrefix);

    final int HORIZONTAL_OFFSET = 3;
    final int VERTICAL_OFFSET = 1;

    openedSubPopup.getElement().getStyle().setVisibility(Visibility.HIDDEN);
    lockLayer.add(openedSubPopup, 0, 0);

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            int left = getAbsoluteLeft() + getOffsetWidth() - HORIZONTAL_OFFSET;
            int top = tableRowElement.getAbsoluteTop() - lockLayer.getTopOffset() - VERTICAL_OFFSET;

            if (left + openedSubPopup.getOffsetWidth() > Window.getClientWidth()) {
                if (left > openedSubPopup.getOffsetWidth()) {
                    left = getAbsoluteLeft() - openedSubPopup.getOffsetWidth() + HORIZONTAL_OFFSET;
                } else {
                    int diff = left + openedSubPopup.getOffsetWidth() - Window.getClientWidth();
                    left -= diff;
                }
            }

            if (top + openedSubPopup.getOffsetHeight() > Window.getClientHeight()) {
                if (top > openedSubPopup.getOffsetHeight()) {
                    top = tableRowElement.getAbsoluteTop() - openedSubPopup.getOffsetHeight() + VERTICAL_OFFSET;
                } else {
                    int diff = top + openedSubPopup.getOffsetHeight() - Window.getClientHeight();
                    top -= diff;
                }
            }

            openedSubPopup.getElement().getStyle().setLeft(left, Unit.PX);
            openedSubPopup.getElement().getStyle().setTop(top, Unit.PX);
            openedSubPopup.getElement().getStyle().setVisibility(Visibility.VISIBLE);
        }
    });
}

From source file:org.eclipse.che.security.oauth.JsOAuthWindow.java

License:Open Source License

public JsOAuthWindow(String authUrl, String errUrl, int popupHeight, int popupWidth, OAuthCallback callback) {
    this.authUrl = authUrl;
    this.errUrl = errUrl;
    this.popupHeight = popupHeight;
    this.popupWidth = popupWidth;
    this.clientHeight = Window.getClientHeight();
    this.clientWidth = Window.getClientWidth();
    this.callback = callback;
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.body.AssessmentsPlayerMetadataView.java

License:Open Source License

private void setLeftPanelHeight() {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override//  w w w  . j  a v  a2s  . c  o  m
        public void execute() {
            int height = rightPanelMetadata.getElement().getOffsetHeight();
            if (height > 650) {
                leftPanelContainer.getElement().setAttribute("style", "min-height:" + height + "px;");
            } else {
                int clientHeight = Window.getClientHeight();
                clientHeight = clientHeight - 175;
                leftPanelContainer.getElement().setAttribute("style", "min-height:" + clientHeight + "px;");
            }
        }
    });
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.study.AssessmentsHomeMetadataView.java

License:Open Source License

/**
 *
 * @function oncustomizeCollectionBtnClicked
 *
 * @created_date : 11-Dec-2013/*from ww w. j  a v  a2  s  .  c o  m*/
 *
 * @description
 *
 *
 * @parm(s) : @param clickEvent
 *
 * @return : void
 *
 * @throws : <Mentioned if any exceptions>
 *
 */
@UiHandler("shareCollectionBtn")
public void onshareCollectionBtnClicked(ClickEvent clickEvent) {
    getUiHandlers().triggerCollectionShareDataEvent(null, PlayerDataLogEvents.COLLECTION, "gooru", false);
    String collectionId = collectionDo.getGooruOid();
    AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, collectionDo.getTitle(),
            collectionDo.getGoals()) {
        @Override
        public void closePoup() {
            Window.enableScrolling(true);
            this.hide();
        }
    };

    Window.scrollTo(0, 0);
    int clientHeight = Window.getClientHeight();
    //successPopupVc.setWidth("500px");
    //successPopupVc.setHeight("658px");
    if (clientHeight > 625) {
        clientHeight = 625;
        //successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;overflow-x:hidden;overflow-y:scroll");
    } /*else{
        successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;overflow-x:hidden;overflow-y:scroll");
      }*/
    successPopupVc.show();
    int left = (Window.getClientWidth() - 500) >> 1;
    int top = (Window.getClientHeight() - clientHeight) >> 1;
    //  successPopupVc.setHeight("658px");
    // successPopupVc.setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(Window.getScrollTop()+5, 0));

    /*if(AppClientFactory.isAnonymous()){
       successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), -30);
            
    }*/
    if (!BrowserAgent.isDevice() && AppClientFactory.isAnonymous()) {
        /*successPopupVc.setWidth("550px");
        successPopupVc.setHeight("625px");
        successPopupVc.center();*/
        successPopupVc.setPopupPosition(0, (Window.getClientHeight() - 625) / 2);
    } else if (!BrowserAgent.isDevice() && !AppClientFactory.isAnonymous()) {
        /*successPopupVc.setWidth("550px");
        successPopupVc.setHeight("502px");
        successPopupVc.center();*/
        successPopupVc.setPopupPosition(0, (Window.getClientHeight() - 527) / 2);
    }

}