List of usage examples for com.google.gwt.user.client Window getScrollLeft
public static int getScrollLeft()
From source file:cz.filmtit.client.pages.TranslationWorkspace.java
License:Open Source License
/** * Scrolls the page so that the subgestbox isvisible to the user. */// www .jav a 2s. co m public void ensureVisible(PosteditBox posteditBox) { Window.scrollTo(Window.getScrollLeft(), getScrollOffsetY(posteditBox.getElement()) - getVideoHeight() - (Window.getClientHeight() - getVideoHeight()) * 2 / 5); }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
public static void showDebugMsg(final String msg, boolean isHtml, int x, int y) { if (_debugMsgPopup == null) { _debugMsgPopup = new PopupPanel(false, false); _debugMsgLabel = new HTML(); _debugMsgPopup.setWidget(_debugMsgLabel); _debugMsgHideTimer = new HideTimer(); }//from w w w. j av a2s .c o m if (isHtml) _debugMsgLabel.setHTML(msg); else _debugMsgLabel.setText(msg); int sx = Window.getScrollLeft(); int sy = Window.getScrollTop(); _debugMsgPopup.setPopupPosition(sx + x, sy + y); _debugMsgPopup.show(); _debugMsgHideTimer.cancel(); _debugMsgHideTimer.schedule(60 * 1000); }
From source file:edu.caltech.ipac.firefly.ui.PopupContainerForStandAlone.java
public void computePosition(boolean offset) { if (_popout.isExpanded()) { if (BrowserUtil.isOldIE() || offset) { GwtUtil.setStyle(_main, "position", "absolute"); GwtUtil.setStyle(_topBackground, "position", "absolute"); int x = Window.getScrollLeft(); int y = Window.getScrollTop(); _main.setPopupPosition(x + 5, y + HEIGHT_OFFSET); } else {//from ww w . j av a2s . c o m GwtUtil.setStyle(_main, "position", "fixed"); GwtUtil.setStyle(_topBackground, "position", "fixed"); GwtUtil.setStyles(_main, "left", "5px", "top", HEIGHT_OFFSET + "px"); } int w = Window.getClientWidth(); int h = Window.getClientHeight(); _main.setPixelSize(w - 20, h - (HEIGHT_OFFSET + 20)); _popout.onResize(); _layout.onResize(); } }
From source file:edu.caltech.ipac.firefly.ui.PopupPane.java
private int getAbsoluteX(HumanInputEvent ev) { if (ev instanceof MouseEvent) { return ((MouseEvent) ev).getClientX() + Window.getScrollLeft(); }//from w w w. j a va 2 s .co m if (ev instanceof TouchEvent) { JsArray<Touch> tAry = ((TouchEvent) ev).getTargetTouches(); return tAry.get(0).getClientX() + Window.getScrollLeft(); } return 0; }
From source file:edu.caltech.ipac.firefly.ui.PopupPane.java
/** * Determine where the place the popup. This is a huge and central method to PopupPane - it needs come cleaning up * @param xoffset offset x added to alignment * @param yoffset offset y added to alignment *//*from w ww . j a va2 s . c om*/ private void alignPopup(final int xoffset, final int yoffset) { int x, y; if (popup != null) GwtUtil.setStyle(popup, "clip", "auto"); if (firstAlign) { optimalWidth = content.getOffsetWidth(); optimalHeight = content.getOffsetHeight(); DeferredCommand.addCommand(new Command() { public void execute() { adjustResizable(); } }); } firstAlign = false; locateMask(); PointerDir dir = PointerDir.NONE; if (alignAt == Align.DISABLE) { if (_pointerPopup) alignPointer(PointerDir.NORTH); return; } Widget alignWidget = this.alignWidget; if (alignWidget == null) alignWidget = RootPanel.get(); int popupHeight = popup.getOffsetHeight(); int popupWidth = popup.getOffsetWidth(); int rootHeight = Window.getClientHeight(); int rootWidth = Window.getClientWidth(); int alignX = alignWidget.getAbsoluteLeft(); int alignY = alignWidget.getAbsoluteTop(); int alignWidth = alignWidget.getOffsetWidth(); int alignHeight = alignWidget.getOffsetHeight(); if (alignAt == Align.BOTTOM_LEFT) { x = alignX + xoffset; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.BOTTOM_RIGHT) { x = alignX + alignWidth + xoffset; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.AUTO_POINTER) { dir = PointerDir.NORTH; definePointerDirection(dir); x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight + yoffset; if (y + popupHeight > Window.getClientHeight()) { dir = PointerDir.SOUTH_WEST; definePointerDirection(dir); x = alignX + alignWidth + xoffset; if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = (alignY - popupHeight + 5) - yoffset; } } else if (alignAt == Align.BOTTOM_CENTER) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.VISIBLE_BOTTOM) { //todo rootHeight = Window.getClientHeight(); x = Window.getScrollLeft() + xoffset; y = Window.getScrollTop() + Window.getClientHeight() - popupHeight + yoffset; } else if (alignAt == Align.BOTTOM_CENTER_POPUP_BOTTOM) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight - popupHeight + yoffset; } else if (alignAt == Align.TOP_CENTER) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = (alignY - popupHeight) - yoffset; } else if (alignAt == Align.TOP_RIGHT) { x = alignX + alignWidth + xoffset - popupWidth; y = alignY + yoffset; } else if (alignAt == Align.TOP_RIGHT_POPUP_RIGHT) { x = alignX + alignWidth + xoffset; y = alignY + yoffset; } else if (alignAt == Align.CENTER) { if (alignWidget == null) { int left = (Window.getClientWidth() - popupWidth) >> 1; int top = (Window.getClientHeight() - popupHeight) >> 1; x = Window.getScrollLeft() + left; y = Window.getScrollTop() + top; } else { int width = content.getOffsetWidth(); int height = content.getOffsetHeight(); x = alignX + alignWidth / 2; x = x - width / 2 + xoffset; y = alignY + alignHeight / 2; y = y - height / 2 + yoffset; } if (y < 0) y = 10; if (x < 0) x = 10; } else if (alignAt == Align.TOP_LEFT_POPUP_RIGHT) { x = alignX + xoffset - popupWidth; if (x < 0) x = 0; y = alignY + yoffset; } else if (alignAt == Align.TOP_LEFT_POPUP_BOTTOM) { x = alignX + xoffset; if (x < 0) x = 0; y = alignY + yoffset - popupHeight; } else if (alignAt == Align.TOP_RIGHT_OR_LEFT) { if (Window.getClientWidth() < (alignWidth + popupWidth)) { x = Window.getClientWidth() - ((xoffset + 35) + popupWidth); if (x < 0) x = 0; y = alignY + yoffset; } else { x = alignX + alignWidth + xoffset; y = alignY + yoffset; } } else { // default to TOP_LEFT x = 1 + xoffset; y = 1 + yoffset; } //---- // Now adjust the popup to fit in the viewable area //---- if (x + popupWidth > rootWidth) { x = x - ((x + popupWidth) - rootWidth); // move if over by the amount it is off the side } if (y + popupHeight > rootHeight && rootHeight > 10) { //if bottom of dialog is off the bottom, if root height is near 0 then don't adjust y = y - ((y + popupHeight) - rootHeight); // move if up by the amount it is off the bottom } if (y < Window.getScrollTop()) y = Window.getScrollTop() + 1; // if it is off the top set it to the top +1 if (x < Window.getScrollLeft()) x = Window.getScrollLeft() + 1;// if it is off the left set it to the left +1 if (_doAlign) _doAlign = _autoAlign; alignPointer(dir); if (popup.isVisible()) { if (popup.getAbsoluteLeft() != x || popup.getAbsoluteTop() != y) { popup.setPopupPosition(x, y); } } }
From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadout.java
private ScreenPt adjustXY(int x, int y) { int popWidth = _popupPanel.getPopupPanel().getOffsetWidth(); int popHeight = _popupPanel.getPopupPanel().getOffsetHeight(); int bWidth = Window.getClientWidth(); int bHeight = Window.getClientHeight(); int sx = Window.getScrollLeft(); int sy = Window.getScrollTop(); if (x + popWidth > bWidth) x = (bWidth - popWidth) + sx;/*from w ww.j a va 2s .c o m*/ if (y + popHeight > bHeight) y = (bHeight - popHeight) + sy; if (x < sx) x = sx; if (y < sy) y = sy; return new ScreenPt(x, y); }
From source file:fr.putnami.pwt.core.widget.client.base.SimpleDropdown.java
License:Open Source License
@Override public void open() { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN); Element menuElt = this.menuContainer.getElement(); int topMenu = menuElt.getAbsoluteTop() - Window.getScrollTop(); int menuHeight = menuElt.getOffsetHeight(); int anchorHeight = this.anchor.getOffsetHeight(); int clientHeight = Window.getClientHeight(); if (topMenu + menuHeight > clientHeight && topMenu >= anchorHeight + menuHeight) { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_UP); }//from ww w.j ava2 s. c om int leftMenu = menuElt.getAbsoluteLeft() - Window.getScrollLeft(); int menuWidth = menuElt.getOffsetWidth(); int anchorWidth = this.anchor.getOffsetWidth(); int clientWidth = Window.getClientWidth(); if (leftMenu + menuWidth > clientWidth && leftMenu >= anchorWidth + menuWidth) { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_LEFT); } this.open = true; this.updateHandlers(); }
From source file:fr.putnami.pwt.doc.client.application.DocumentationDisplay.java
License:Open Source License
private void redraw(boolean autoScroll) { if (autoScroll) { String historyToken = History.getToken(); if (!Strings.isNullOrEmpty(historyToken)) { int top = this.affixMenu.getPinnedOffset(); Window.scrollTo(Window.getScrollLeft(), top); } else {//from w w w . j av a2 s . co m Window.scrollTo(Window.getScrollLeft(), 0); } } }
From source file:geogebra.web.gui.util.PopupPanel.java
License:Apache License
/** * Centers the popup in the browser window and shows it. If the popup was * already showing, then the popup is centered. *//*from w w w. j a v a 2 s . c o m*/ public void center() { boolean initiallyShowing = showing; boolean initiallyAnimated = isAnimationEnabled; if (!initiallyShowing) { setVisible(false); setAnimationEnabled(false); show(); } // If left/top are set from a previous center() call, and our content // has changed, we may get a bogus getOffsetWidth because our new content // is wrapping (giving a lower offset width) then it would without the // previous left. Setting left/top back to 0 avoids this. Element elem = getElement(); 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)); if (!initiallyShowing) { setAnimationEnabled(initiallyAnimated); // Run the animation. The popup is already visible, so we can skip the // call to setState. if (initiallyAnimated) { impl.setClip(getElement(), "rect(0px, 0px, 0px, 0px)"); setVisible(true); resizeAnimation.run(ANIMATION_DURATION); } else { setVisible(true); } } }
From source file:geogebra.web.gui.view.algebra.RadioButtonTreeItem.java
License:Open Source License
private void onRightClick(int x, int y) { if (av.isEditing() || isThisEdited() || newCreationMode) return;/*from ww w .jav a2 s . co m*/ SelectionManager selection = app.getSelectionManager(); GPoint point = new GPoint(x + Window.getScrollLeft(), y + Window.getScrollTop()); if (geo != null) { if (selection.containsSelectedGeo(geo)) {// popup // menu for // current // selection // (including // selected // object) ((GuiManagerW) app.getGuiManager()).showPopupMenu(selection.getSelectedGeos(), av, point); } else {// select only this object and popup menu selection.clearSelectedGeos(false); selection.addSelectedGeo(geo, true, true); ArrayList<GeoElement> temp = new ArrayList<GeoElement>(); temp.add(geo); ((GuiManagerW) app.getGuiManager()).showPopupMenu(temp, av, point); } } }