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:next.celebs.DemoUtils.java

License:Apache License

public static void openWiki(String source, final String url) {

    int h = Window.getClientHeight();
    int w = Window.getClientWidth();

    // mobile phone
    if (h + w < 1000) {
        openURL(url);//from   w  w w. j a v  a  2  s . co  m

    } else {
        final Frame frame = new Frame(url);
        Style s = frame.getElement().getStyle();
        s.setProperty("width", "100%");
        s.setProperty("height", "100%");

        final XPopup popup = new XPopup();
        final XDragScrollView view = new XDragScrollView();
        view.add(frame);
        popup.setWidget(view);
        popup.setTop("35px");
        popup.setRight("5%");
        popup.setLeft("10%");
        popup.setBottom("10%");
        popup.show();
    }

}

From source file:next.celebs.page.SearchImageWidget.java

License:Apache License

void setPopupPosition(Photo p, OverlayPopup popup) {
    int w = p.getWidth() > 1024 ? 1024 : p.getWidth();
    int h = p.getHeight() > 550 ? 550 : p.getHeight();
    int left = (Window.getClientWidth() - w) >> 1;
    int top = (Window.getClientHeight() - h) >> 1;
    popup.setPopupPosition(Math.max(Window.getScrollLeft() + left, 0),
            Math.max(Window.getScrollTop() + top, 0));
}

From source file:next.celebs.ui.MiscUtils.java

License:Apache License

public static void initScrollSize(ScrollPanel listScrollPanel) {
    int topBottomMargins = 80;
    int headerHeight = 52;
    int profileHeight = 140;
    int tableHeight = Window.getClientHeight() - topBottomMargins;
    int contentHeight = tableHeight - headerHeight;
    listScrollPanel.setSize("100%", (contentHeight - profileHeight - 48) + "px");
}

From source file:next.celebs.ui.OverlayPopup.java

License:Apache License

public void doShow() {
    this.setPopupPositionAndShow(new PositionCallback() {
        @Override/*from   w w w  .  jav a 2s . c  o  m*/
        public void setPosition(int offsetWidth, int offsetHeight) {
            int winY = Window.getClientHeight();
            int y = (winY - offsetHeight) / 2;
            int x = (Window.getClientWidth() - offsetWidth) / 2;
            OverlayPopup.this.setPopupPosition(x, y);
        }
    });
}

From source file:next.celebs.ui.OverlayWrapper.java

License:Apache License

public void showOverlay() {
    // IE Window.getClientHeight() might not work.
    // JavaScriptObject pageSize = JSInvoker.getPageSize();
    // String[] array = pageSize.toString().split(",");
    // DOM.setStyleAttribute(overlay.getElement(), "height", array[1] + "px");
    DOM.setStyleAttribute(overlay.getElement(), "height", Window.getClientHeight() + "px");
    overlay.show();/* w w  w. jav a  2 s  .c o m*/
}

From source file:next.celebs.ui.OverlayWrapperOLD.java

License:Apache License

public void showOverlay() {
    DOM.setStyleAttribute(overlay.getElement(), "height", Window.getClientHeight() + "px");
    DOM.setStyleAttribute(overlay.getElement(), "zIndex", OVERLAY_Z_INDEX.toString());
    overlay.show();/*from   w w  w.j  a  v  a 2 s .  c o m*/

    NShow eff = new NShow(overlay.getElement());
    eff.setStartOpacity(0);
    eff.setEndOpacity(OVERLAY_TRANSPARENCY);
    eff.setDuration(0.3);
    eff.play();
}

From source file:next.common.ui.ui.kbd.KeyboardNumericPopup.java

License:Apache License

public void closeAnimated() {
    int leftStart = getAbsoluteLeft();
    int leftEnd = leftStart;
    int topStart = getAbsoluteTop();
    int topEnd = Window.getClientHeight();
    closeAnimated(leftStart, leftEnd, topStart, topEnd);
}

From source file:next.common.ui.ui.kbd.KeyboardPopup.java

License:Apache License

public void closeAnimated() {

    if (step != Step.OPENED) {
        return;/*from w w w.j  a va2 s  . c om*/
    }

    try {

        // e.g. parse previous 'margin-left:-300px'; and animate left close based
        // on this position
        String marginLeft = getElement().getStyle().getProperty("marginLeft");

        marginLeft = marginLeft.substring(0, marginLeft.length() - 2);
        int leftStart = -Math.abs(Integer.valueOf(marginLeft));
        int leftEnd = leftStart;
        int topStart = getAbsoluteTop();
        int topEnd = Window.getClientHeight();

        // int leftStart = (int) (this.getOffsetWidth() / 2.0);
        // int leftEnd = leftStart;
        // int topStart = Window.getClientHeight() - getOffsetHeight();
        // int topEnd = Window.getClientHeight();

        closeAnimated(leftStart, leftEnd, topStart, topEnd);

        //FIXME evaluate this approach as the excpetion propagates to JavaScript as NumberFormatException 
    } catch (StringIndexOutOfBoundsException e) {
        e.printStackTrace();// probably normal behaviour
    }
}

From source file:next.common.ui.ui.Logger.java

License:Apache License

public static void debug(PopupPanel popup) {
    Element el = DOM.getElementById(ElementIds.DEBUG);
    if (el != null) {
        Logger.debug("offsetWidth:" + popup.getOffsetWidth() + ", offsetHeight:" + popup.getOffsetHeight()
                + "<br>" + ", ClientWidth" + Window.getClientWidth() + ", ClientHeight"
                + Window.getClientHeight() + "<br>ScrollLeft" + Window.getScrollLeft() + ", ScrollTop"
                + Window.getScrollTop());
    }/*from   www.ja  v  a 2  s .c  om*/
}

From source file:next.i.view.Utils.java

License:Apache License

static boolean isVisible(Element element) {

    int left = element.getAbsoluteLeft();
    int top = element.getAbsoluteTop();
    int winH = Window.getClientHeight();
    int winW = Window.getClientWidth();
    boolean isVisible = (left >= 0 && left < winW) && (top >= 0 && top < winH);
    // Log.info("top=" + top + ", left=" + left);

    return isVisible;
}