@Override public void run () { // Ignore changes that result from window resize events if (windowHeight != Window.getClientHeight() || windowWidth != Window.getClientWidth()) { windowHeight = Window.getClientHeight(); windowWidth = Window.getClientWidth(); schedule(resizeCheckDelay); return; } // Look for elements that have new dimensions checkWidgetSize(); // Start checking again if (resizeCheckingEnabled) { schedule(resizeCheckDelay); } } };
public boolean confirm(String message) { return Window.confirm(message); } }
/** Set whether or not resize checking is enabled. If disabled, elements will still be resized on window events, but the timer * will not check their dimensions periodically. * * @param enabled true to enable the resize checking timer */ public void setResizeCheckingEnabled (boolean enabled) { if (enabled && !resizeCheckingEnabled) { resizeCheckingEnabled = true; if (windowHandler == null) { windowHandler = Window.addResizeHandler(this); } resizeCheckTimer.schedule(resizeCheckDelay); } else if (!enabled && resizeCheckingEnabled) { resizeCheckingEnabled = false; if (windowHandler != null) { windowHandler.removeHandler(); windowHandler = null; } resizeCheckTimer.cancel(); } }
private void resize() { contentPanel.setWidth(Window.getClientWidth() * 0.90 + "px"); contentPanel.setHeight(Window.getClientHeight() * 0.90 + "px"); contentPanel.getElement().getStyle().setProperty("overflow", "auto"); } }
messageLabel.getElement().getStyle().setWhiteSpace(WhiteSpace.PRE_WRAP); messageLabel.getElement().getStyle().setProperty("maxHeight", "400px"); messageLabel.getElement().getStyle() .setProperty("maxWidth", Window.getClientWidth() * 2 / 3 + "px"); messageLabel.getElement().getStyle().setOverflowY(Overflow.AUTO); messageLabel.setMessage(message);
private void styleAndPositionMenuContainer(final int eventX, final int eventY) { menuContainer.addStyleName(OPEN); clickButton.getElement().setAttribute(ARIA_EXPANDED, Boolean.TRUE.toString()); menuContainer.getElement().getStyle().setPosition(Position.ABSOLUTE); menuContainer.getElement().getStyle().setTop(Window.getScrollTop() + eventY, Unit.PX); menuContainer.getElement().getStyle().setLeft(eventX, Unit.PX); }
public void onResize(ResizeEvent event) { Style style = glass.getStyle(); int winWidth = Window.getClientWidth(); int winHeight = Window.getClientHeight(); // Hide the glass while checking the document size. Otherwise it would // interfere with the measurement. style.setDisplay(Display.NONE); style.setWidth(0, Unit.PX); style.setHeight(0, Unit.PX); int width = Document.get().getScrollWidth(); int height = Document.get().getScrollHeight(); // Set the glass size to the larger of the window's client size or the // document's scroll size. style.setWidth(Math.max(width, winWidth), Unit.PX); style.setHeight(Math.max(height, winHeight), Unit.PX); // The size is set. Show the glass again. style.setDisplay(Display.BLOCK); } };
int width = Math.max(Window.getClientWidth(), Document.get().getScrollWidth()); int height = Math.max(Window.getClientHeight(), Document.get().getScrollHeight()); glassElem.getStyle().setHeight(height, Unit.PX); glassElem.getStyle().setWidth(width, Unit.PX); Document.get().getBody().appendChild(glassElem); mouseDown = false; glassElem.removeFromParent();
/** Fix top value if need. Need in case if bottom part of menu not display */ private void adjustTopPosition() { int totalHeight = listPanel.getWidgetCount() * 19; // 19 height of menu item int y = getAbsoluteTop() + 19 + totalHeight; if (y > Window.getClientHeight()) { y = getAbsoluteTop() - 8 - totalHeight; // 8 need some correction for looking good in UI popupPanel.getElement().getStyle().clearProperty("top"); } else { y = getAbsoluteTop() + 19; } popupPanel.getElement().getStyle().setProperty("top", "" + y + "px"); }
@Override public void activate(ActivationEvent event) { active = true; activationMessage = event.getActivationMessage(); overlay = new VOverlay(); overlay.addStyleName("v-window"); overlay.addStyleName("v-touchkit-offlinemode"); Style style = overlay.getElement().getStyle(); style.setZIndex(Z_INDEX); // Make sure this is overloading the indicator flowPanel = new FlowPanel(); overlay.add(flowPanel); buildDefaultContent(); overlay.show(); overlay.setWidth(Window.getClientWidth() + "px"); overlay.setHeight(Window.getClientHeight() + "px"); }
public boolean edit(WSGrid.WSCell element) { wsCellReference = element; editCellReference = this; datePicker.setValue(date); datePicker.setCurrentMonth(date); Style s = datePicker.getElement().getStyle(); int left = (element.getAbsoluteLeft() + element.getOffsetWidth() - 20); if ((left + datePicker.getOffsetWidth()) > Window.getClientHeight()) { left = Window.getClientHeight() - datePicker.getOffsetHeight(); } s.setProperty("left", left + "px"); s.setProperty("top", (element.getAbsoluteTop() + element.getOffsetHeight()) + "px"); datePicker.setVisible(true); return true; }
private void prepareForScrolling(Widget p) { if (p != null) { // we'll swift the element to place where even ios 6 webkit don't // sink events for it Style style = p.getElement().getParentElement().getStyle(); String property = style.getProperty(Css3Propertynames.transform()); MatchResult exec = regExp3dValues.exec(property); style.setProperty( Css3Propertynames.transform(), "translate3d(" + exec.getGroup(1) + ",-" + Window.getClientHeight() + "px,0)"); } }
/** * Download the SDK. * * @param key the SDK key */ public static void downloadSdk(String key) { String getUrl = composeUrl(KAA_SDK_SERVLET_PATH, SDK_KEY_PARAMETER + "=" + URL.encodeQueryString(key)); String url = GWT.getModuleBaseURL() + getUrl; Window.open(url, "_self", "enabled"); }
elem.getStyle().setPropertyPx("left", 0); elem.getStyle().setPropertyPx("top", 0); int left = (Window.getClientWidth() - getOffsetWidth()) >> 1; int top = (Window.getClientHeight() - getOffsetHeight()) >> 1; setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max( Window.getScrollTop() + top, 0));
public void onClick( ClickEvent w ) { if ( !canConditionBeDeleted( c ) ) { Window.alert( Constants.INSTANCE.UnableToDeleteConditionColumn( c.getHeader() ) ); return; } String cm = Constants.INSTANCE.DeleteConditionColumnWarning( c.getHeader() ); if ( Window.confirm( cm ) ) { dtable.deleteColumn( c ); refreshConditionsWidget(); } } } );
int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowLeft = Window.getScrollLeft(); int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowLeft = Window.getScrollLeft(); int windowTop = Window.getScrollTop(); int windowBottom = Window.getScrollTop() + Window.getClientHeight();
if (!Element.is(eventTarget)) { return; if (TableCellElement.TAG_TD.equalsIgnoreCase(cur.getTagName()) && tableBuilder.isColumn(cur.getFirstChildElement())) { cur = cur.getFirstChildElement(); int clientX = event.getClientX() + Window.getScrollLeft(); int clientY = event.getClientY() + Window.getScrollTop(); int rowLeft = hoveringRow.getAbsoluteLeft(); int rowTop = hoveringRow.getAbsoluteTop();
public void onUncaughtException(Throwable e) { if (!GWT.isScript()) { Window.alert("Uncaught exception escaped : " + e.getClass().getName() + "\n" + e.getMessage() + "\nSee the Development console log for details." + "\nRegister a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling." ); } GWT.log("Uncaught exception escaped", e); } });
public void reset() { Element e = this.getElement(); StyleUtils.addStyle(e, Affixed.TOP); this.clearElementStyle(); this.clientHeigth = Window.getClientHeight(); this.pinnedOffset = e.getAbsoluteTop(); this.offsetWidth = e.getClientWidth(); StyleUtils.addStyle(e, this.affixed); this.resetPosistion(); }