List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:com.extjs.gxt.ui.client.widget.Shim.java
License:sencha.com license
/** * Creates and covers the area with a Shim. If shimIframes is true will only * covers IFrames./*from w w w .j a v a 2 s .c o m*/ * * @param shimIframes true if you want to cover only Iframes */ public void cover(boolean shimIframes) { if (shimIframes) { NodeList<Element> elements = XDOM.getBodyEl().select("iframe:not(.x-noshim)"); shim(elements); elements = XDOM.getBodyEl().select("object:not(.x-noshim)"); shim(elements); elements = XDOM.getBodyEl().select("applet:not(.x-noshim)"); shim(elements); elements = XDOM.getBodyEl().select("embed:not(.x-noshim)"); shim(elements); } else { shims.add(createShim(null, 0, 0, Window.getClientWidth(), Window.getClientHeight())); } }
From source file:com.extjs.gxt.ui.client.widget.Viewport.java
License:sencha.com license
public void onAttach() { setEnableScroll(enableScroll);//from ww w.ja v a 2 s. c o m setSize(Window.getClientWidth(), Window.getClientHeight()); super.onAttach(); GXT.hideLoadingPanel(loadingPanelId); }
From source file:com.facebook.tsdb.tsdash.client.presenter.GraphPresenter.java
License:Apache License
private int estimateWidth(ApplicationState appState) { double coef = appState.fullscreen ? 1.0 : 0.72; return (int) ((Window.getClientWidth() - 20) * coef); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
private void resizeWorkArea(WorkAreaPanel workArea) { // Subtract 16px from width to account for vertical scrollbar FF3 likes to add workArea.onResize(Window.getClientWidth() - 16, Window.getClientHeight()); }
From source file:com.google.appinventor.client.RpcStatusPopup.java
License:Open Source License
private void positionPopup(int offsetWidth) { // make sure the popup is on-screen // if the top of the window is scrolled off the screen setPopupPosition((Window.getClientWidth() - offsetWidth) >> 1, Window.getScrollTop()); }
From source file:com.google.appinventor.client.widgets.properties.AdditionalChoicePropertyEditor.java
License:Open Source License
/** * Opens the additional choice dialog./*from www . j a va2 s. c o m*/ */ protected void openAdditionalChoiceDialog() { popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { // adjust the x and y positions so that the entire panel // is on-screen int xPosition = getAbsoluteLeft(); int yPosition = getAbsoluteTop(); int xExtrude = xPosition + offsetWidth - Window.getClientWidth() - Window.getScrollLeft(); int yExtrude = yPosition + offsetHeight - Window.getClientHeight() - Window.getScrollTop(); if (xExtrude > 0) { xPosition -= (xExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING); } if (yExtrude > 0) { yPosition -= (yExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING); } popup.setPopupPosition(xPosition, yPosition); } }); }
From source file:com.google.appinventor.client.wizards.Wizard.java
License:Open Source License
/** * {@inheritDoc}/* w w w. ja v a2s. c o m*/ * * Subclasses may override this to perform additional actions * after the wizard is shown, such as explicitly setting the * initially focused widget. Remember to call {@code super.show()} * as the first action in such overriding methods. */ @Override public void show() { ensureInited(); // Wizard size (having it resize between page changes is quite annoying) int width = 480; int height = 320; if (adaptiveSizing) { width = Math.max(width, Window.getClientWidth() / 3); height = Math.max(height, Window.getClientHeight() / 2); } setPixelSize(width, height); super.show(); if (pageDeck.getWidgetCount() == 1) { buttonPanel.remove(backButton); buttonPanel.remove(nextButton); } // Show first wizard page currentPageIndex = 0; showCurrentPage(); }
From source file:com.google.code.p.gwtchismes.client.GWTCDatePickerAbstract.java
License:Apache License
private void moveIntoVisibleArea() { if (calendarDlg != null) { int w = Window.getClientWidth() + Window.getScrollLeft(); int xd = calendarDlg.getAbsoluteLeft(); int wd = calendarGrid.getOffsetWidth() + 40; if ((xd + wd) > w) { xd = xd - ((xd + wd) - w);//from ww w .ja v a 2 s . c o m } int h = Window.getClientHeight() + Window.getScrollTop(); int yd = calendarDlg.getAbsoluteTop(); int hd = calendarDlg.getOffsetHeight() + 20; if ((yd + hd) > h) { yd = yd - ((yd + hd) - h); } calendarDlg.setPopupPosition(xd, yd); } }
From source file:com.google.collide.client.ui.menu.PositionController.java
License:Open Source License
/** * Checks if the element is completely visible on the screen, if not it will temporarily flip our * {@link #elementPositioner} with updated alignment values which might work to fix the problem. *//*w w w . j a v a 2s . c o m*/ private boolean checkPositionValidAndMaybeUpdatePositioner() { // recalculate the element's dimensions and check to see if any of the edges // of the element are outside the window ClientRect elementRect = ensureVisibleAndGetRect(element); VerticalAlign updatedVerticalAlign = elementPositioner.getVerticalAlignment(); HorizontalAlign updatedHorizontalAlign = elementPositioner.getHorizontalAlignment(); if (elementRect.getBottom() > Window.getClientHeight()) { updatedVerticalAlign = VerticalAlign.TOP; } else if (elementRect.getTop() < 0) { updatedVerticalAlign = VerticalAlign.BOTTOM; } if (elementRect.getRight() > Window.getClientWidth()) { updatedHorizontalAlign = HorizontalAlign.RIGHT; } else if (elementRect.getLeft() < 0) { updatedHorizontalAlign = HorizontalAlign.LEFT; } if (updatedVerticalAlign != elementPositioner.getVerticalAlignment() || updatedHorizontalAlign != elementPositioner.getHorizontalAlignment()) { elementPositioner.flip(updatedVerticalAlign, updatedHorizontalAlign); return false; } return true; }
From source file:com.google.gerrit.client.change.RightSidePopdownAction.java
License:Apache License
void show() { if (popup != null) { button.removeStyleName(style.selected()); popup.hide();// w ww . j a v a 2s. c o m return; } final PopupPanel p = new PopupPanel(true) { @Override public void setPopupPosition(int left, int top) { top -= Document.get().getBodyOffsetTop(); int w = Window.getScrollLeft() + Window.getClientWidth(); int r = relativeTo.getAbsoluteLeft() + relativeTo.getOffsetWidth(); int right = w - r; Style style = getElement().getStyle(); style.clearProperty("left"); style.setPropertyPx("right", right); style.setPropertyPx("top", top); } }; p.setStyleName(style.replyBox()); p.addAutoHidePartner(button.getElement()); p.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { button.removeStyleName(style.selected()); popup = null; } } }); p.add(getWidget()); p.showRelativeTo(relativeTo); GlobalKey.dialog(p); button.addStyleName(style.selected()); popup = p; }