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.webgocommerce.client.view.uisesion.UISesion.java

private void reCalcularWindows() {
    int alto = Window.getClientHeight() - 125;
    int ancho = Window.getClientWidth() - 5;
    tabPanel.setWidth(ancho + "px");
    tabPanel.setHeight(alto + "px");
}

From source file:com.xpn.xwiki.gwt.api.client.app.XWikiGWTDefaultApp.java

License:Open Source License

public static void setMaxHeight(Widget widget) {
    int absoluteTop = getAbsoluteTop(widget);
    int newHeight = (Window.getClientHeight() - absoluteTop);
    if (newHeight > 0) {
        try {//  w ww .  j a v  a 2s .c  om
            widget.setHeight(newHeight + "px");
        } catch (Exception e) {
            // We need to catch this call since in IE7
            // it seems to be able to break sometime on initial loading
        }
    }

}

From source file:cyclerouteplanner.client.MapRenderer.java

License:Open Source License

public void onModuleLoad(ClickHandler clickHandler) {
    LatLng home = LatLng.create(51.0747504771771, -1.3252487182617188);

    final MapOptions options = MapOptions.create();
    options.setZoom(14);/*w  w  w .  ja v a 2  s. c om*/
    options.setCenter(home);
    options.setMapTypeId(MapTypeId.ROADMAP);
    options.setDraggable(true);
    //options.setNavigationControl(true);
    options.setMapTypeControl(true);

    mapCanvas = RootPanel.get("map_canvas");
    mapCanvas.addStyleName("Map");

    mapWidget = GoogleMap.create(mapCanvas.getElement(), options);

    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            fillTheScreen(event.getWidth(), event.getHeight());
        }
    });

    GWT.log("Adding click handler.");
    mapWidget.addClickListener(clickHandler);
    fillTheScreen(Window.getClientWidth(), Window.getClientHeight());
}

From source file:cz.filmtit.client.pages.TranslationWorkspace.java

License:Open Source License

/**
 * Scrolls the page so that the subgestbox isvisible to the user.
 */// w  w  w . ja  v  a2 s  .  c  o  m
public void ensureVisible(SubgestBox subbox) {
    Window.scrollTo(Window.getScrollLeft(), getScrollOffsetY(subbox.getElement()) - getVideoHeight()
            - (Window.getClientHeight() - getVideoHeight()) * 2 / 5);
}

From source file:cz.filmtit.client.pages.TranslationWorkspace.java

License:Open Source License

/**
 * Scrolls the page so that the subgestbox isvisible to the user.
 *//*from  ww  w  .ja  va 2 s .  c  o  m*/
public void ensureVisible(PosteditBox posteditBox) {
    Window.scrollTo(Window.getScrollLeft(), getScrollOffsetY(posteditBox.getElement()) - getVideoHeight()
            - (Window.getClientHeight() - getVideoHeight()) * 2 / 5);
}

From source file:cz.mzk.editor.client.view.window.SortingWindow.java

License:Open Source License

/**
 *
 * @param digObjRelations/*w w w . j av a 2  s .c  o m*/
 */
public void setObjects(DigitalObjectRelationships digObjRelations) {
    objects = new TreeGrid();
    objectsTree = new Tree();

    setAnimateResizeAcceleration(AnimationAcceleration.SMOOTH_END);

    ListGridField titleField = new ListGridField(Constants.ATTR_NAME, lang.title());
    objects.setFields(titleField);

    objects.setWidth100();
    objects.setShowConnectors(true);
    objects.setShowOpenIcons(true);
    objects.setBaseStyle("noBorderCell");
    objects.setNodeIcon("icons/16/shape_3d.png");
    objects.setFolderIcon("icons/16/shape_3d.png");
    objects.setCanSort(false);
    objects.setMargin(10);

    this.digObjRel = digObjRelations;
    origDigObjRel = digObjRelDeepCopy(digObjRelations);

    ascSort = new IButton(lang.ascending());
    ascSort.setExtraSpace(5);
    ascSort.setWidth(160);
    ascSort.setIcon("icons/16/sort_ascending.png");

    descSort = new IButton(lang.descending());
    descSort.setWidth(160);
    descSort.setIcon("icons/16/sort_descending.png");

    setTreeNodes(digObjRelations, null, true);

    objects.getData().openAll();

    HLayout buttonLayout = new HLayout(2);
    buttonLayout.setAlign(Alignment.CENTER);

    buttonLayout.addMember(ascSort);
    buttonLayout.addMember(descSort);

    ascSort.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            mw.show(true);
            sortObject(digObjRel, false);
            setTreeNodes(digObjRel, null, false);
            objects.getData().openAll();
            objects.redraw();
            mw.hide();
        }
    });
    descSort.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            mw.show(true);
            sortObject(digObjRel, true);
            setTreeNodes(digObjRel, null, false);
            objects.getData().openAll();
            objects.redraw();
            mw.hide();
        }
    });

    IButton publish = new IButton(lang.publishItem());
    publish.setExtraSpace(10);
    publish.setLayoutAlign(Alignment.CENTER);
    publish.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            publish();
        }

    });

    int height = count * 30 + 200;
    height = height > Window.getClientHeight() ? Window.getClientHeight() : height;
    setHeight(height);
    objects.setHeight(height - 120);
    addMember(buttonLayout);
    addMember(objects);
    addMember(publish);

    mw.hide();
    centerInPage();
}

From source file:de.eckhartarnold.client.Debugger.java

License:Apache License

/**
 * Sets the size of the debugger//from w ww. j  a va2 s  .  com
 * @param width  the width of the debugger in pixel
 * @param height the height of the debugger in pixel
 */
public static void setSize(int width, int height) {
    Debugger.width = width + 18;
    Debugger.height = height + 40;
    if (singleton != null) {
        scrollPanel.setPixelSize(width, height);
        singleton.resize(Window.getClientWidth(), Window.getClientHeight());
    }
}

From source file:de.eckhartarnold.client.Debugger.java

License:Apache License

/**
 * The constructor of the debugger. As class <code>Debugger</code> is 
 * instantiated by the first call to its static print method, this
 * constructor is a <code>protected</code> constructor.
 *//*from   ww  w  .  jav a  2  s  .c  o m*/
protected Debugger() {
    dialog = new DialogBox(false, false);
    dialog.addStyleName("debugger");
    dialog.setText("Debug");
    panel = new VerticalPanel();
    messagePanel = new VerticalPanel();
    scrollPanel = new ScrollPanel(messagePanel);
    panel.add(scrollPanel);
    closeButton = new Button("close", new ClickHandler() {
        public void onClick(ClickEvent event) {
            Debugger.hide();
            closedManually = true;
        }
    });
    panel.add(closeButton);
    dialog.setWidget(panel);
    snapRight = true;
    snapBottom = true;
    if (width <= 0)
        width = 400;
    if (height <= 0)
        height = 300;
    // dialog.getElement().getStyle().setProperty("z-index", "100");    
    dialog.show();
    scrollPanel.setPixelSize(width - 18, height - 40);
    resize(Window.getClientWidth(), Window.getClientHeight());
    Window.addResizeHandler(this);
}

From source file:de.eckhartarnold.client.ImagePanel.java

License:Apache License

/**
 * Resizes the displayed image(s), if the containing 
 * <code>FlipImagePanel</code> has been resized.
 * The <code>resize</code> method is called automatically when any of
 * the methods <code>setSize, setPixelSize, setWidth, setHeight</code>
 * is called. /*from  www  .  j  a  va2 s.  co m*/
 */
public void onResized() {
    assert envelope.getWidget() == null : "prepareResized() must be called before onResized()!";

    int lastPanelW = panelW;
    int lastPanelH = panelH;

    // envelope.clear();    
    panelW = envelope.getOffsetWidth();
    panelH = envelope.getOffsetHeight();
    if (panelH <= 100) { // unlikely small height: non-quirks mode !?
        panelH = Window.getClientHeight();
        if (lastPanelH == panelH)
            lastPanelH--;
    }
    // GWT.log("ImagePanel.onResized: panelH: "+String.valueOf(panelH));
    envelope.setWidget(panel);

    if (lastPanelW != panelW || lastPanelH != panelH) {
        panel.setPixelSize(panelW, panelH);
        if (active != null)
            adjustSize(active);
        if (sizeStep >= 0) {
            int newStep = pickSize(sizes);
            if (newStep != sizeStep) {
                sizeStep = newStep;
                quickExchangeImage(imageNames[sizeStep]);
                return;
            }
        }
        if (passive != null)
            adjustSize(passive);
        positionNotifier();
    }
}

From source file:de.eckhartarnold.client.MovablePopupPanel.java

License:Apache License

public void onMouseMove(MouseMoveEvent event) {
    if (dragging) {

        //      // this is a work around, because this.getAbsoluteWidth() 
        //      // causes an "uncaught exception" error in GWT 1.5
        //      Widget sender = (Widget) event.getSource();
        //      int x = event.getX();
        //      int y = event.getY();
        //      int absX = x + sender.getAbsoluteLeft() - 
        //          (getOffsetWidth() - sender.getOffsetWidth())/2;
        //      int absY = y + sender.getAbsoluteTop() - 
        //          (getOffsetWidth() - sender.getOffsetWidth())/2;

        int absX = event.getClientX();
        int absY = event.getClientY();
        int xpos = absX - dragStartX;
        int ypos = absY - dragStartY;
        if (xpos + getOffsetWidth() > Window.getClientWidth()) {
            xpos = Window.getClientWidth() - getOffsetWidth();
        }//www  . ja  va2s.c om
        if (ypos + getOffsetHeight() > Window.getClientHeight()) {
            ypos = Window.getClientHeight() - getOffsetHeight();
        }
        if (xpos < 0)
            xpos = 0;
        if (ypos < 0)
            ypos = 0;
        setPopupPosition(xpos, ypos);
    }
}