List of usage examples for com.google.gwt.user.client Window getClientHeight
public static int getClientHeight()
From source file:com.sencha.gxt.widget.core.client.Component.java
License:sencha.com license
@Override protected void onLoad() { super.onLoad(); if (!allowTextSelection) { setAllowTextSelection(false);/*from w ww . j a v a 2s. c om*/ } if (monitorWindowResize) { if (windowResizeTask == null) { windowResizeTask = new DelayedTask() { @Override public void onExecute() { onWindowResize(Window.getClientWidth(), Window.getClientHeight()); } }; } // window resizing in some cases when initially showing positioned widgets if (GXT.isIE8()) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { resizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { windowResizeTask.delay(windowResizeDelay); } }); } }); } else { resizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { windowResizeTask.delay(windowResizeDelay); } }); } } }
From source file:com.sencha.gxt.widget.core.client.container.Viewport.java
License:sencha.com license
/** * Creates a viewport layout container with the specified appearance. * /*from w ww .jav a 2 s.com*/ * @param appearance the appearance of the viewport layout container */ public Viewport(ViewportAppearance appearance) { super(true); SafeHtmlBuilder sb = new SafeHtmlBuilder(); appearance.render(sb); setElement((Element) XDOM.create(sb.toSafeHtml())); monitorWindowResize = true; getFocusSupport().setIgnore(false); setPixelSize(Window.getClientWidth(), Window.getClientHeight()); }
From source file:com.sencha.gxt.widget.core.client.container.Viewport.java
License:sencha.com license
@Override protected void onAttach() { setEnableScroll(enableScroll); super.onAttach(); setPixelSize(Window.getClientWidth(), Window.getClientHeight()); }
From source file:com.sencha.gxt.widget.core.client.Popup.java
License:sencha.com license
/** * Displays the popup.//from ww w.jav a 2 s . c o m */ public void show() { if (!fireCancellableEvent(new BeforeShowEvent())) { return; } Point p = new Point((int) Window.getClientWidth() / 2, (int) Window.getClientHeight() / 2); showAt(p.getX(), p.getY()); }
From source file:com.sencha.gxt.widget.core.client.Popup.java
License:sencha.com license
protected Popup onShowPopup() { RootPanel.get().add(this); hidden = false;// ww w.j av a2 s . c o m Point p = null; if (alignElem != null) { alignPos = alignPos != null ? alignPos : getDefaultAlign(); p = getElement().getAlignToXY(alignElem, alignPos, alignOffsetX, alignOffsetY); } else if (alignPoint != null) { p = alignPoint; } getElement().makePositionable(true); getElement().setVisibility(false); getElement().setLeftTop(p.getX(), p.getY()); alignElem = null; alignPos = null; alignPoint = null; if (constrainViewport) { int clientHeight = Window.getClientHeight() + XDOM.getBodyScrollTop(); int clientWidth = Window.getClientWidth() + XDOM.getBodyScrollLeft(); Rectangle r = getElement().getBounds(); int x = r.getX(); int y = r.getY(); if (y + r.getHeight() > clientHeight) { y = clientHeight - r.getHeight() - getYOffset(); getElement().setTop(y); } if (x + r.getWidth() > clientWidth) { x = clientWidth - r.getWidth() - getXOffset(); getElement().setLeft(x); } } getElement().setVisibility(true); if (autoHide) { preview.add(); } if (animate) { Fx fx = new Fx(); fx.addAfterAnimateHandler(new AfterAnimateHandler() { @Override public void onAfterAnimate(AfterAnimateEvent event) { afterShow(); } }); fx.run(new FadeIn(getElement())); } else { afterShow(); } return this; }
From source file:com.sinewavemultimedia.easeljs.framework.js.CreateJS.java
License:Open Source License
public CreateJS() { this(Window.getClientWidth(), Window.getClientHeight()); }
From source file:com.sitecake.contentmanager.client.toolbar.ContentManagerToolbar.java
private void setPosition(int x, int y, boolean constraint, boolean save) { int windowWidth = Window.getClientWidth(); int windowHeight = Window.getClientHeight(); int elementWidth = getElement().getOffsetWidth(); int elementHeight = getElement().getOffsetHeight(); int maxWidth = windowWidth - elementWidth; int maxHeight = windowHeight - elementHeight; if (constraint) { x = (x < 0) ? 0 : ((x > maxWidth) ? maxWidth : x); y = (y < 0) ? 0 : ((y > maxHeight) ? maxHeight : y); }//from ww w. j a va2 s . c o m Style style = getElement().getStyle(); style.setLeft(x, Unit.PX); style.setTop(y, Unit.PX); if (y > windowHeight / 2) { addStyleName(EditorClientBundle.INSTANCE.css().toolbarBottomPosition()); newItems.addStyleName(EditorClientBundle.INSTANCE.css().toolbarIconsUp()); newItems.removeStyleName(EditorClientBundle.INSTANCE.css().toolbarIconsDown()); } else { removeStyleName(EditorClientBundle.INSTANCE.css().toolbarBottomPosition()); newItems.addStyleName(EditorClientBundle.INSTANCE.css().toolbarIconsDown()); newItems.removeStyleName(EditorClientBundle.INSTANCE.css().toolbarIconsUp()); } if (save) { propertyManager.setProperty(POSITION_X, x, PropertyScope.APPLICATION); propertyManager.setProperty(POSITION_Y, y, PropertyScope.APPLICATION); } }
From source file:com.smartgwt.mobile.client.widgets.Canvas.java
License:Open Source License
@SGWTInternal protected static void _hideAddressBarNow() { // In iOS 7, the scrollTo() hack to hide the address bar does not work anymore. // http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review // We still run some code in _maybeHideAddressBar() on iPad, however, to work around // the issue that 20px is cut off from the top or bottom in landscape mode. // Also, on iPhone running in a UIWebView, we need to move up the RootLayoutPanel's // bottom coord. final Style rootLayoutPanelElementStyle = RootLayoutPanel.get().getElement().getStyle(); if (IMPL.isIOSMin7_0()) { if (!Canvas.isUIWebView()) { // Work around an issue with iOS 7 Mobile Safari on an iPad in landscape mode. // http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue // http://stackoverflow.com/questions/18855642/ios-7-css-html-height-100-692px if (Canvas.isIPad()) { if (Page.getOrientation() == PageOrientation.LANDSCAPE) { rootLayoutPanelElementStyle.setHeight(Window.getClientHeight() - 20, Style.Unit.PX); } else { rootLayoutPanelElementStyle.setHeight(100, Style.Unit.PCT); }//from ww w . j a v a2 s.c o m // On iPhone running iOS 7.1 using the 'minimal-ui' viewport parameter, the top 20 CSS pixels // in landscape mode should not be used because tapping within this area causes the browser // chrome to be revealed: http://www.mobilexweb.com/blog/ios-7-1-safari-minimal-ui-bugs } else if (Canvas.isIPhone() && IMPL.isIOSMin7_1()) { if (Page.getOrientation() == PageOrientation.LANDSCAPE) { rootLayoutPanelElementStyle.clearHeight(); rootLayoutPanelElementStyle.setTop(20, Style.Unit.PX); } else { rootLayoutPanelElementStyle.setHeight(100, Style.Unit.PCT); rootLayoutPanelElementStyle.setTop(0, Style.Unit.PX); } } // Since, when running in a UIWebView, the device-width/device-height // includes the height of the status bar, set the bottom of the RootLayoutPanel's // element to 20px (the standard height of the status bar). } else if (Canvas.isUIWebView()) { rootLayoutPanelElementStyle.clearHeight(); rootLayoutPanelElementStyle.setBottom(20.0, Style.Unit.PX); } Window.scrollTo(0, 0); } else if (isIPhone() && !isStandAlone() && !isUIWebView()) { rootLayoutPanelElementStyle.setHeight(Window.getClientHeight() + 100 - 40, Style.Unit.PX); Window.scrollTo(0, 0); } else { rootLayoutPanelElementStyle.setHeight(Window.getClientHeight(), Style.Unit.PX); } }
From source file:com.tasktop.c2c.server.tasks.client.widgets.TaskDetailsPopupPanel.java
License:Open Source License
public void showAt(final int targetAbsoluteLeft, final int targetAbsoluteTop, final int targetOffsetWidth, final int targetOffsetHeight) { setPopupPositionAndShow(new PopupPanel.PositionCallback() { @Override//from ww w . j ava 2 s . co m public void setPosition(int offsetWidth, int offsetHeight) { // There doesn't appear to be a reliable way to get the width and height of this popup from the element // itself, so I have to resort to hardcoded values (spent a couple of hours trying to get the right // values here - popup.getWidget().getElement().getClientHeight() returned the correct height, but the // width was way off int popupWidth = 297; int popupHeight = 350; int anchorRight = targetAbsoluteLeft + targetOffsetWidth; int anchorBottom = targetAbsoluteTop + targetOffsetHeight; int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowBottom = Window.getScrollTop() + Window.getClientHeight(); // By default, set our left and top to be just below the Anchor's bottom right corner. int popupLeft = anchorRight; int popupTop = anchorBottom; if ((popupLeft + popupWidth) > windowRight) { // If there's not enough space to the right, then make sure our popup is touching the // right edge of the screen popupLeft = windowRight - popupWidth; } if ((popupTop + popupHeight) > windowBottom) { // If there's not enough space at the bottom, then make sure our popup is touching the // bottom edge of the screen popupTop = windowBottom - popupHeight; } setPopupPosition(popupLeft, popupTop); } }); }
From source file:com.test.morphia.client.loginview.LoginView.java
License:Open Source License
public LoginView() { int windowHeight = Window.getClientHeight(); int windowWidth = Window.getClientWidth(); loginLayout.setCellSpacing(6);/*from w ww. j a v a 2 s .c om*/ FlexCellFormatter cellFormatter = loginLayout.getFlexCellFormatter(); // Add a title to the form loginLayout.setHTML(0, 0, this.headline); // Add username and password fields username.setWidth("150px"); password.setWidth("150px"); loginLayout.setHTML(1, 0, this.usernameLabel); loginLayout.setWidget(1, 1, username); loginLayout.setHTML(2, 0, passwordLabel); loginLayout.setWidget(2, 1, password); //Add the loginbutton to the form loginLayout.setWidget(3, 0, loginbutton); cellFormatter.setColSpan(3, 0, 2); cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER); // Wrap the content in a DecoratorPanel decPanel.setWidget(loginLayout); mainpanel.setWidth(windowWidth / 2 + "px"); mainpanel.setHeight(windowHeight * 0.6 + "px"); mainpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); mainpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); mainpanel.add(logo); mainpanel.add(secondoHeadline); mainpanel.add(decPanel); }