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.google.livingstories.client.ui.Lightbox.java

License:Apache License

/**
 * Reimplementation of center() that does not allow the popup to extend above or to the left
 * of the current scroll position.//  w ww .  j a va  2  s.c  o  m
 */
@Override
public void center() {
    setPopupPositionAndShow(new PositionCallback() {
        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            int left = Math.max(0, (Window.getClientWidth() - getOffsetWidth()) / 2);
            int top = Math.max(0, (Window.getClientHeight() - getOffsetHeight()) / 2);
            setPopupPosition(Window.getScrollLeft() + left, Window.getScrollTop() + top);
        }
    });
}

From source file:com.google.livingstories.client.ui.Slideshow.java

License:Apache License

private void showFilmstrip() {
    if (allImages.size() > 1) {
        filmstripPopup.setPopupPositionAndShow(new PositionCallback() {
            @Override/*  w w w .j a v a2s .com*/
            public void setPosition(int offsetWidth, int offsetHeight) {
                filmstripPopup.setPopupPosition(
                        Window.getScrollLeft() + (Window.getClientWidth() - offsetWidth) / 2,
                        Window.getScrollTop() + (Window.getClientHeight() - offsetHeight));
            }
        });
    }
}

From source file:com.google.livingstories.client.ui.Slideshow.java

License:Apache License

private void showPopup() {
    popup.setPopupPositionAndShow(new PositionCallback() {
        @Override/*from   w  w  w  .j a v  a 2  s.c  om*/
        public void setPosition(int offsetWidth, int offsetHeight) {
            popup.setPopupPosition(Window.getScrollLeft() + (Window.getClientWidth() - offsetWidth) / 2,
                    Window.getScrollTop() + (Window.getClientHeight() - offsetHeight) / 2 - WINDOW_PADDING / 4);
        }
    });
}

From source file:com.google.mobile.trippy.web.client.view.SearchResultsMapView.java

License:Apache License

public SearchResultsMapView() {
    super();/*from  w w  w .j  a  v a2s  .  co  m*/
    initWidget(uiBinder.createAndBindUi(this));
    //TODO :Its just remove the tabindex from DOM. But need to find
    //the alternative approach.
    nextItem.getElement().getChild(nextItem.getTabIndex()).removeFromParent();
    prevItem.getElement().getChild(prevItem.getTabIndex()).removeFromParent();
    Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            mapView.setHeight((Window.getClientHeight() - 74) + "px");
        }
    });
    mapView.setHeight((Window.getClientHeight() - 74) + "px");
}

From source file:com.google.mobile.trippy.web.client.view.TripMapView.java

License:Apache License

public TripMapView() {
    super();//from   ww  w . jav  a 2s  .  c  o m
    initWidget(uiBinder.createAndBindUi(this));
    //TODO :Its just remove the tabindex from DOM. But need to find
    //the alternative approach.
    nextItem.getElement().getChild(nextItem.getTabIndex()).removeFromParent();
    prevItem.getElement().getChild(prevItem.getTabIndex()).removeFromParent();
    Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            mapView.setHeight((Window.getClientHeight() - 74) + "px");
        }
    });
    mapView.setHeight((Window.getClientHeight() - 74) + "px");
}

From source file:com.google.sampling.experiential.client.Main.java

License:Open Source License

private void createHomePage() {
    RootPanel rootPanel = RootPanel.get();

    mainPanel = new VerticalPanel();
    mainPanel.setSpacing(2);//www .  j ava2 s . c o m
    rootPanel.add(mainPanel);

    HorizontalPanel menuPanel = createMenuBar();
    createStatusPanelOnMenubar(menuPanel);

    listTitle = new HTML("");
    mainPanel.add(listTitle);
    listTitle.setStyleName("paco-HTML-Large");
    listTitle.setWordWrap(false);
    listTitle.setSize("270px", "22");

    mainPanel.setCellHorizontalAlignment(listTitle, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(2);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    mainPanel.add(horizontalPanel);

    experimentPanel = new VerticalPanel();
    leftSidePanel = new ScrollPanel(experimentPanel);
    horizontalPanel.add(leftSidePanel);
    experimentPanel.setStyleName("paco-experimentPanel");
    experimentPanel.setSpacing(2);
    experimentPanel.setVisible(false);
    experimentPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    flexTable = new FlexTable();
    String height = (Window.getClientHeight() - 200) + "px";
    ScrollPanel sp = new ScrollPanel(flexTable);
    //flexTable.setSize("400px", height);
    experimentPanel.add(flexTable);

    contentPanel = new VerticalPanel();
    contentPanel.setSpacing(2);
    horizontalPanel.add(contentPanel);
    //contentPanel.setSize("550px", "325px");
    rootPanel.add(new HTML(
            "<div style=\"text-align:center;\"><a href=\"/privacypolicy.html\">Privacy Policy</a></div>"));
    loadJoinedExperiments();

    createCallbackForGviz();
}

From source file:com.google.webcourse.picasaapp.client.PicasaApp.java

License:Apache License

/**
 * Causes the UI elements to be layed out.
 *//*from   w  w  w . j  a  va 2s .  c om*/
public void onResize(ResizeEvent event) {
    int height = Window.getClientHeight() - thumbnailList.getAbsoluteTop();
    thumbnailList.setHeight((height + Window.getScrollTop()) - 5 + "px");

    int photoWidth = Window.getClientWidth() - SIDE_COLUMNS_WIDTH_SUM;
    photoView.setPhotoWidth(photoWidth);
}

From source file:com.googlecode.gwtquake.client.GwtQuake.java

License:Open Source License

public void onModuleLoad() {
    // Initialize drivers.
    Document doc = Document.get();
    doc.setTitle("GWT Quake II");
    BodyElement body = doc.getBody();//from w w w  . j  ava  2  s . co m
    Style style = body.getStyle();
    style.setPadding(0, Unit.PX);
    style.setMargin(0, Unit.PX);
    style.setBorderWidth(0, Unit.PX);
    style.setProperty("height", "100%");
    style.setBackgroundColor("#000");
    style.setColor("#888");

    //   Window.alert("UA: " + userAgent+ " type: " + browserType);

    boolean wireframe = ("" + Window.Location.getHash()).indexOf("wireframe") != -1;

    canvas = (CanvasElement) doc.createElement("canvas");
    video = doc.createElement("video");

    w = Window.getClientWidth();
    h = Window.getClientHeight();
    canvas.setWidth(w);
    canvas.setHeight(h);
    style = canvas.getStyle();
    style.setProperty("height", "100%");
    style.setProperty("width", "100%");

    style = video.getStyle();
    style.setProperty("height", "100%");
    style.setProperty("width", "100%");
    style.setProperty("display", "none");

    body.appendChild(canvas);
    body.appendChild(video);

    try {
        Globals.autojoin.value = Window.Location.getHash().indexOf("autojoin") != -1 ? 1.0f : 0.0f;
        final Renderer renderer = wireframe ? new GwtWireframeGLRenderer(canvas)
                : new GwtWebGLRenderer(canvas, video);
        Globals.re = renderer;

        ResourceLoader.impl = new GwtResourceLoaderImpl();
        Compatibility.impl = new CompatibilityImpl();

        Sound.impl = new GwtSound();
        NET.socketFactory = new WebSocketFactoryImpl();
        //      Sys.impl = new Sys.SysImpl() {
        //        public void exit(int status) {
        //          Window.alert("Something's rotten in Denmark");
        //          Window.Location.assign("gameover.html");
        //        }
        //      };

        // Flags.
        QuakeCommon.Init(new String[] { "GQuake" });

        // Enable stdout.
        Globals.nostdout = ConsoleVariables.Get("nostdout", "0", 0);

        Window.addResizeHandler(new ResizeHandler() {

            public void onResize(ResizeEvent event) {
                if (Window.getClientWidth() == w && Window.getClientHeight() == h) {
                    return;
                }

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

                renderer.GLimp_SetMode(new Dimension(w, h), 0, false);
            }
        });

        //      QuakeServer.main(new String[0], new DummySNetImpl(), false);

        timer = new Timer() {
            double startTime = Duration.currentTimeMillis();

            @Override
            public void run() {
                try {
                    double curTime = Duration.currentTimeMillis();
                    boolean pumping = ResourceLoader.Pump();
                    if (pumping) {
                        Screen.UpdateScreen2();
                    } else {
                        int dt = (int) (curTime - startTime);
                        GwtKBD.Frame(dt);
                        QuakeCommon.Frame(dt);
                    }
                    startTime = curTime;
                    timer.schedule(ResourceLoader.Pump() ? LOADING_DELAY : INTER_FRAME_DELAY);
                } catch (Exception e) {
                    Compatibility.printStackTrace(e);
                }
            }
        };
        timer.schedule(INTER_FRAME_DELAY);
    } catch (Exception e) {
        Compatibility.printStackTrace(e);
        DivElement div = doc.createDivElement();
        div.setInnerHTML(NO_WEBGL_MESSAGE);
        body.appendChild(div);
    }
}

From source file:com.googlecode.simplegwt.tbg.client.TbgEntryPoint.java

License:Apache License

/**
 * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
 *///ww w  .  j av a 2s  .com
public void onModuleLoad() {
    final ButtonGrid buttonGrid = new ButtonGrid(DEFAULT_GRID_HEIGHT, DEFAULT_GRID_WIDTH);
    final GridControls gridControls = new GridControls(buttonGrid);

    final DialogBox dialog = new DialogBox(false, false);
    dialog.setWidget(new Label(
            "Click a button to toggle it on/off. " + "Adjacent buttons will also reverse their state.", true));
    dialog.setText("Help - ToggleButtonGame");
    dialog.addStyleName("tbg-help-dialog");
    final FlowPanel gridHeaderBar = new FlowPanel();
    final Label helpLabel = new CommandLabel("Help", new Command() {
        boolean shownOnce = false;

        public void execute() {
            if (dialog.isShowing()) {
                dialog.hide();
            } else {
                if (shownOnce) {
                    dialog.show();
                } else {
                    dialog.center();
                    shownOnce = true;
                }
            }
        }
    });
    helpLabel.setStylePrimaryName("tbg-help");
    gridHeaderBar.add(new LoginWidget(gridControls));
    gridHeaderBar.add(helpLabel);

    final DecoratorPanel decoration = new DecoratorPanel();
    final FlowPanel wrapper = new FlowPanel();

    wrapper.add(gridHeaderBar);
    wrapper.add(gridControls);
    wrapper.add(buttonGrid);

    decoration.add(wrapper);

    RootPanel.get("gwt").add(decoration);

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

    resize(Window.getClientHeight(), Window.getClientWidth());
}

From source file:com.gwos.client.context.ClientContext.java

License:Apache License

private ClientContext() {
    browserWidth = Window.getClientWidth();
    browserHeight = Window.getClientHeight() - 30;

    Window.addResizeHandler(new ResizeHandler() {
        @Override/*  w ww .  j av a  2s.  c om*/
        public void onResize(ResizeEvent event) {
            browserWidth = event.getWidth();
            browserHeight = event.getHeight();
        }
    });
}