com.google.gwt.dom.client.Element.getAbsoluteLeft()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(322)

本文整理了Java中com.google.gwt.dom.client.Element.getAbsoluteLeft()方法的一些代码示例,展示了Element.getAbsoluteLeft()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getAbsoluteLeft()方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getAbsoluteLeft

Element.getAbsoluteLeft介绍

[英]Gets an element's absolute left coordinate in the document's coordinate system.
[中]

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets an element's absolute left coordinate in the document's coordinate
  3. * system.
  4. *
  5. * @param elem the element to be measured
  6. * @return the element's absolute left coordinate
  7. * @deprecated Use {@link Element#getAbsoluteLeft()} instead.
  8. */
  9. @Deprecated
  10. public static int getAbsoluteLeft(Element elem) {
  11. return elem.getAbsoluteLeft();
  12. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets an element's absolute right coordinate in the document's coordinate
  3. * system.
  4. */
  5. public final int getAbsoluteRight() {
  6. return getAbsoluteLeft() + getOffsetWidth();
  7. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public void setPosition(int offsetWidth, int offsetHeight) {
  2. panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX,
  3. lastParent.getAbsoluteTop() + offsetY);
  4. }
  5. });

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets the touch x-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative x-position
  6. */
  7. public final int getRelativeX(Element target) {
  8. return getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
  9. + target.getOwnerDocument().getScrollLeft();
  10. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets the mouse x-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative x-position
  6. */
  7. public int getRelativeX(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
  10. target.getOwnerDocument().getScrollLeft();
  11. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Gets an element's absolute left coordinate in the document's coordinate
  3. * system.
  4. *
  5. * @param elem the element to be measured
  6. * @return the element's absolute left coordinate
  7. * @deprecated Use {@link Element#getAbsoluteLeft()} instead.
  8. */
  9. @Deprecated
  10. public static int getAbsoluteLeft(Element elem) {
  11. return elem.getAbsoluteLeft();
  12. }

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

  1. /**
  2. * Measures the left margin of an element
  3. *
  4. * @param element
  5. * The element to measure
  6. * @return Left margin in pixels
  7. */
  8. public static int measureMarginLeft(Element element) {
  9. return element.getAbsoluteLeft()
  10. - element.getParentElement().getAbsoluteLeft();
  11. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Gets an element's absolute right coordinate in the document's coordinate
  3. * system.
  4. */
  5. public final int getAbsoluteRight() {
  6. return getAbsoluteLeft() + getOffsetWidth();
  7. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Gets an element's absolute right coordinate in the document's coordinate
  3. * system.
  4. */
  5. public final int getAbsoluteRight() {
  6. return getAbsoluteLeft() + getOffsetWidth();
  7. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Recalculate the height and width of a native scrollbar.
  3. */
  4. private static void maybeRecalculateNativeScrollbarSize() {
  5. // Check if the size has already been calculated.
  6. if (nativeHeight > -1) {
  7. return;
  8. }
  9. // Create a scrollable element and attach it to the body.
  10. Element scrollable = Document.get().createDivElement();
  11. scrollable.getStyle().setPosition(Position.ABSOLUTE);
  12. scrollable.getStyle().setTop(-1000.0, Unit.PX);
  13. scrollable.getStyle().setLeft(-1000.0, Unit.PX);
  14. scrollable.getStyle().setHeight(100.0, Unit.PX);
  15. scrollable.getStyle().setWidth(100.0, Unit.PX);
  16. scrollable.getStyle().setOverflow(Overflow.SCROLL);
  17. scrollable.getStyle().setProperty("direction", "rtl");
  18. Document.get().getBody().appendChild(scrollable);
  19. // Add some content.
  20. Element content = Document.get().createDivElement();
  21. content.setInnerText("content");
  22. scrollable.appendChild(content);
  23. // Measure the height and width.
  24. nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight();
  25. nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth();
  26. nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft());
  27. // Detach the scrollable element.
  28. scrollable.removeFromParent();
  29. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. int x = event.getClientX() - senderElem.getAbsoluteLeft()
  2. + senderElem.getPropertyInt("scrollLeft")
  3. + Window.getScrollLeft();

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. public void setPosition(int offsetWidth, int offsetHeight) {
  2. panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX,
  3. lastParent.getAbsoluteTop() + offsetY);
  4. }
  5. });

代码示例来源:origin: oVirt/ovirt-engine

  1. public ColumnResizeHandler(Element headerElement, Column<T, ?> column, HasResizableColumns<T> table) {
  2. this.headerElement = headerElement;
  3. this.column = column;
  4. this.table = table;
  5. this.eventHandler = Event.addNativePreviewHandler(this);
  6. this.columnAbsoluteLeft = headerElement.getAbsoluteLeft();
  7. // Indicate resize start
  8. table.onResizeStart(column, headerElement);
  9. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. int containerTop = getAbsoluteTop();
  2. int left = selectedElem.getAbsoluteLeft() - containerLeft;
  3. int top = selectedElem.getAbsoluteTop() - containerTop;
  4. int width = selectedElem.getPropertyInt("offsetWidth");

代码示例来源:origin: pl.touk.gwtaculous/gwtaculous-lib

  1. public static boolean isMouseCursorWithinElement(Element element, int mousePosX, int mousePosY){
  2. int elementTop = element.getAbsoluteTop();
  3. int elementLeft = element.getAbsoluteLeft();
  4. int elementBottom = element.getAbsoluteBottom();
  5. int elementRight = element.getAbsoluteRight();
  6. if (mousePosX > elementLeft && mousePosX < elementRight && mousePosY > elementTop && mousePosY < elementBottom) {
  7. return true;
  8. }
  9. return false;
  10. }

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

  1. /**
  2. * Get the current offset of the first matched element, in pixels, relative to the document. The
  3. * returned object contains two integer properties, top and left. The method works only with
  4. * visible elements.
  5. */
  6. public Offset offset() {
  7. Element e = get(0);
  8. return e == null ? new Offset(0, 0) : new Offset(e.getAbsoluteLeft(), e.getAbsoluteTop());
  9. }

代码示例来源:origin: threerings/playn

  1. /**
  2. * Gets the event's x-position relative to a given element.
  3. *
  4. * @param e native event
  5. * @param target the element whose coordinate system is to be used
  6. * @return the relative x-position
  7. */
  8. static float getRelativeX(NativeEvent e, Element target) {
  9. return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
  10. + target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
  11. }

代码示例来源:origin: org.uberfire/uberfire-wires-core-grids

  1. public static int getRelativeXOfEvent(final DomEvent event) {
  2. final NativeEvent e = event.getNativeEvent();
  3. final Element target = event.getRelativeElement();
  4. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();
  5. }

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

  1. private int getRelativeX(final ContextMenuEvent event) {
  2. final NativeEvent e = event.getNativeEvent();
  3. final Element target = event.getRelativeElement();
  4. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();
  5. }

代码示例来源:origin: org.jboss.ballroom/widgets

  1. @Override
  2. protected void onEnterKeyDown(Context context, Element parent, String value,
  3. NativeEvent event, ValueUpdater<String> valueUpdater) {
  4. popup.setPopupPosition(parent.getAbsoluteLeft()-5, parent.getAbsoluteTop()-5);
  5. popup.show();
  6. popup.setAutoHideEnabled(true);
  7. delegate.onRowSelection(context.getIndex());
  8. }

相关文章

Element类方法