/** * Gets the object's absolute left position in pixels, as measured from the * browser window's client area. * * @return the object's absolute left position */ public int getAbsoluteLeft() { return getElement().getAbsoluteLeft(); }
/** * Gets the popup's left position relative to the browser's client area. * * @return the popup's left position */ public int getPopupLeft() { return getElement().getAbsoluteLeft(); }
/** * Gets the position of the left outer border edge of the widget relative to * the left outer border edge of the panel. * * @param w the widget whose position is to be retrieved * @return the widget's left position */ public int getWidgetLeft(Widget w) { checkWidgetParent(w); return w.getElement().getAbsoluteLeft() - getElement().getAbsoluteLeft(); }
/** * Gets the current X position of the element based on page coordinates. * Element must be part of the DOM tree to have page coordinates. * * @return the x position of the element */ public int getX() { return dom.getAbsoluteLeft(); }
/** * Gets the object's absolute left position in pixels, as measured from the * browser window's client area. * * @return the object's absolute left position */ public int getAbsoluteLeft() { return getElement().getAbsoluteLeft(); }
/** * Gets the object's absolute left position in pixels, as measured from the * browser window's client area. * * @return the object's absolute left position */ public int getAbsoluteLeft() { return getElement().getAbsoluteLeft(); }
/** * Gets the popup's left position relative to the browser's client area. * * @return the popup's left position */ public int getPopupLeft() { return getElement().getAbsoluteLeft(); }
/** * Gets the popup's left position relative to the browser's client area. * * @return the popup's left position */ public int getPopupLeft() { return getElement().getAbsoluteLeft(); }
public float getAbsoluteX() { return this.getElement().getAbsoluteLeft(); }
/** * Gets the position of the left outer border edge of the widget relative to * the left outer border edge of the panel. * * @param w the widget whose position is to be retrieved * @return the widget's left position */ public int getWidgetLeft(Widget w) { checkWidgetParent(w); return w.getElement().getAbsoluteLeft() - getElement().getAbsoluteLeft(); }
/** * Gets the position of the left outer border edge of the widget relative to * the left outer border edge of the panel. * * @param w the widget whose position is to be retrieved * @return the widget's left position */ public int getWidgetLeft(Widget w) { checkWidgetParent(w); return w.getElement().getAbsoluteLeft() - getElement().getAbsoluteLeft(); }
/*************************************** * Get the offset for the horizontal scroll * * @return The offset */ private int getPageScrollLeft() { Element rBodyElement = RootPanel.getBodyElement(); return DOM.getParent(rBodyElement).getAbsoluteLeft(); }
public static boolean isVisible(Element e) { //vp = viewPort, b = bottom, l = left, t = top, r = right int vpWidth = Window.getClientWidth(); int vpHeight = Window.getClientHeight(); boolean tViz = ( e.getAbsoluteTop() >= 0 && e.getAbsoluteTop()< vpHeight); boolean bViz = (e.getAbsoluteBottom() > 0 && e.getAbsoluteBottom() <= vpHeight); boolean lViz = (e.getAbsoluteLeft() >= 0 && e.getAbsoluteLeft() < vpWidth); boolean rViz = (e.getAbsoluteRight() > 0 && e.getAbsoluteRight() <= vpWidth); boolean vVisible = tViz && bViz; boolean hVisible = lViz && rViz; return hVisible && vVisible; }
/** * Slide the knob to a new location. * * @param event * the mouse event */ private void slideKnob(Event event) { int x = DOM.eventGetClientX(event); if (x > 0) { int lineWidth = lineElement.getOffsetWidth(); int lineLeft = lineElement.getAbsoluteLeft(); double percent = (double) (x - lineLeft) / lineWidth * 1.0; setCurrentValue(getTotalRange() * percent + minValue, true); } }
/** * Gets the mouse x-position relative to the canvas element. * @param clientX The event's clientX value. * @return the relative x-position */ private double getRelativeX(final double clientX) { return clientX - getCanvasElement().getAbsoluteLeft() + getCanvasElement().getScrollLeft() + getCanvasElement().getOwnerDocument().getScrollLeft(); }
protected void moveFocus(Element selectedElem) { if (selectedElem == null) return; int containerLeft = getAbsoluteLeft(); int containerTop = getAbsoluteTop(); int left = selectedElem.getAbsoluteLeft() - containerLeft; int top = selectedElem.getAbsoluteTop() - containerTop; int width = selectedElem.getOffsetWidth(); int height = selectedElem.getOffsetHeight(); if (width == 0 || height == 0) { focusEl.setLeftTop(0, 0); return; } focusEl.setLeftTop(left, top); }
private void beginMovingWindow(Event event) { if (draggable) { showDraggingCurtain(); dragging = true; startX = WidgetUtil.getTouchOrMouseClientX(event); startY = WidgetUtil.getTouchOrMouseClientY(event); origX = getElement().getAbsoluteLeft(); origY = getElement().getAbsoluteTop(); DOM.setCapture(getElement()); event.preventDefault(); } }
void resize() { if( fakeDiv == null ) { fakeDiv = DOM.createDiv(); fakeDiv.getStyle().setPosition( Position.FIXED ); fakeDiv.getStyle().setLeft( -10000, Unit.PX ); getElement().getParentElement().insertAfter( fakeDiv, getElement() ); applyStyle( fakeDiv ); } int width = getElement().getAbsoluteRight() - getElement().getAbsoluteLeft(); fakeDiv.getStyle().setWidth( width - 10 - 2, Unit.PX ); fakeDiv.setInnerText( getText() ); int height = getElement().getClientHeight(); int newHeight = fakeDiv.getClientHeight() + 25; if( height < newHeight ) getElement().getStyle().setHeight( newHeight, Unit.PX ); }
void resize() { if( fakeDiv == null ) { fakeDiv = DOM.createDiv(); fakeDiv.getStyle().setPosition( Position.FIXED ); fakeDiv.getStyle().setLeft( -10000, Unit.PX ); getElement().getParentElement().insertAfter( fakeDiv, getElement() ); applyStyle( fakeDiv ); } int width = getElement().getAbsoluteRight() - getElement().getAbsoluteLeft(); fakeDiv.getStyle().setWidth( width - 10 - 2, Unit.PX ); fakeDiv.setInnerText( getText() ); int height = getElement().getClientHeight(); int newHeight = fakeDiv.getClientHeight() + 25; if( height < newHeight ) getElement().getStyle().setHeight( newHeight, Unit.PX ); }
private void attachAutoCloseHandler() { removeAutoCloseHandler(); autoCloseHandler = RootPanel.get().addDomHandler(e -> { if (isVisible()) { int top = content.asWidget().getElement().getAbsoluteTop(); int left = content.asWidget().getElement().getAbsoluteLeft(); int right = content.asWidget().getElement().getAbsoluteRight(); int bottom = content.asWidget().getElement().getAbsoluteBottom(); if (e.getY() < top || e.getY() > bottom || e.getX() < left || e.getX() > right) { hide(); } } }, ClickEvent.getType()); }