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.atmosphere.samples.client.Info.java

License:Apache License

protected Info(String title, String message) {

    add(new InfoWidget(title, message));
    setWidth("300px");
    setHeight("50px");

    int root_width = Window.getClientWidth();
    int root_height = Window.getClientHeight();

    level = findAvailableLevel();/*from www.  j  av  a2s  . c  o  m*/

    int left = root_width - 320;
    int top = root_height - 80 - (level * 60);

    setPopupPosition(left, top);
}

From source file:org.bonitasoft.console.client.view.labels.LabelsManagementList.java

License:Open Source License

protected void addLabel() {
    myCreateDialogBox.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        public void setPosition(int anOffsetWidth, int anOffsetHeight) {
            int left = ((Window.getClientWidth() / 2) - (anOffsetWidth / 2));
            int top = (Window.getClientHeight() / 3) - (anOffsetHeight / 2);
            myCreateDialogBox.setPopupPosition(left, top);
        }//from   w ww. j  a va 2  s .  co m
    });
    myNewLabelName.setFocus(true);

}

From source file:org.cee.webreader.client.ui.News.java

License:Apache License

@Override
public int getNumberOfVisibleRelatedArticles() {
    final Styles styles = Resources.INSTANCE.styles();
    return (((Window.getClientHeight() - styles.articleTeaserTop()) / styles.articleTeaserHeight()) + 1)
            * styles.relatedArticleColumns();
}

From source file:org.cee.webreader.client.ui.Start.java

License:Apache License

@Override
public int getNumberOfVisibleArticleTeasers() {
    final Styles styles = Resources.INSTANCE.styles();
    return (((Window.getClientHeight() - styles.articleTeaserTop()) / styles.articleTeaserHeight()) + 1)
            * styles.articleTeaserColumns();
}

From source file:org.cee.webreader.client.ui.WindowVerticalScroll.java

License:Apache License

@Override
public int getMaximumVerticalScrollPosition() {
    int scrollHeight = element.getScrollHeight() + offset;
    int clientHeight = Window.getClientHeight();

    return scrollHeight - clientHeight;
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.basic.ShowSourceButton.java

License:Apache License

protected void showSourceCode(String sourceCode) {
    sourceCode = sourceCode.replaceAll("<", "&lt,").replace(">", "&gt;");

    final String html = "<pre class=\"brush: java; toolbar: false;\">" + sourceCode + "</pre>";
    ScrollPanel sp = new ScrollPanel();
    sp.setSize((Window.getClientWidth() * 0.6) + "px", (Window.getClientHeight() * 0.7) + "px");
    sp.add(new HTML(html));

    DialogBoxWithCloseButton dialogBox = new DialogBoxWithCloseButton(false);
    dialogBox.setWidget(sp);/*from w w  w  .j av a2 s.  co  m*/
    dialogBox.setText(ShowcaseSearchPanel.I18N.viewSource(source));
    dialogBox.center();

    super.doFormat();
}

From source file:org.cruxframework.crux.core.client.screen.views.ViewHandlers.java

License:Apache License

/**
 * @param handler//from   w w w  .j  a v  a  2s. c  om
 * @return
 */
private static HandlerRegistration addWindowResizeHandler(final ResizeHandler handler,
        final boolean lazyCheck) {
    ResizeHandler resizeHandler = new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            if (!lazyCheck) {
                handler.onResize(event);
                return;
            }

            final ResizeBeginEndExecutor executor = new ResizeBeginEndExecutor(100, event) {
                private int clientHeight = Window.getClientHeight();
                private int clientWidth = Window.getClientWidth();

                @Override
                protected void doEndAction() {
                    if (!Screen.getCurrentDevice().equals(Device.largeDisplayMouse)) {
                        int newClientHeight = Window.getClientHeight();
                        int newClientWidth = Window.getClientWidth();

                        if (this.clientHeight != newClientHeight || clientWidth != newClientWidth
                                || Screen.isIos()) {
                            handler.onResize(getResizeEvent());
                        }
                        clientHeight = newClientHeight;
                        clientWidth = newClientWidth;
                    } else {
                        handler.onResize(getResizeEvent());
                    }
                }

                @Override
                protected void doBeginAction() {
                    // nothing
                }
            };

            executor.execute();
        }
    };

    final HandlerRegistration resizeHandlerRegistration = Window.addResizeHandler(resizeHandler);

    return new HandlerRegistration() {
        public void removeHandler() {
            if (resizeHandlerRegistration != null) {
                resizeHandlerRegistration.removeHandler();
            }
        }
    };
}

From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java

License:Apache License

/**
 * Gets the popup's top position relative to the browser's center area.
 * //  ww  w .  jav a 2 s .c  o  m
 * @return the popup's top position
 */
private int getPopupTopToCenter() {
    int windowTop = Window.getScrollTop();
    int windowHeight = Window.getClientHeight();
    int centerTop = (windowHeight / 2) + windowTop;

    int offsetHeight = getOffsetHeight();
    return centerTop - (offsetHeight / 2);
}

From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java

License:Apache License

private int getTopRelativeObject(final UIObject relativeObject) {
    int offsetHeight = getOffsetHeight();
    int top = relativeObject.getAbsoluteTop();

    int windowTop = Window.getScrollTop();
    int windowBottom = Window.getScrollTop() + Window.getClientHeight();

    int distanceFromWindowTop = top - windowTop;
    int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());

    if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
        top -= offsetHeight;//from ww w .j  a v a  2  s.  co  m
    } else {
        top += relativeObject.getOffsetHeight();
    }
    return top;
}

From source file:org.cruxframework.crux.widgets.client.datebox.NativeDateBox.java

License:Apache License

public NativeDateBox() {
    super();/*from www  .  j  av a2s  .  c o  m*/
    CruxCalendarView view = (CruxCalendarView) impl.getDatePicker().getView();
    view.getGrid().setHeight(Window.getClientHeight() + "px");
    view.getGrid().setWidth(Window.getClientWidth() + "px");

    CruxMonthSelector monthSelector = (CruxMonthSelector) impl.getDatePicker().getMonthSelector();
    monthSelector.getGrid().setWidth(Window.getClientWidth() + "px");

    CellFormatter formatter = monthSelector.getGrid().getCellFormatter();
    formatter.setWidth(0, 0, "15%");
    formatter.setWidth(0, 1, "15%");
    formatter.setWidth(0, 2, "40%");
    formatter.setWidth(0, 3, "15%");
    formatter.setWidth(0, 4, "15%");
}