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

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

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

Element.getOffsetWidth介绍

[英]The width of an element relative to the layout.
[中]元素相对于布局的宽度。

代码示例

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

  1. /**
  2. * Get the width in pixels of the scrollable content that the scrollbar
  3. * controls.
  4. *
  5. * <p>
  6. * This is not the same as the maximum scroll left position. The maximum
  7. * scroll position equals the <code>scrollWidth - offsetWidth</code>;
  8. *
  9. * @return the scroll width
  10. * @see #setScrollWidth(int)
  11. */
  12. public int getScrollWidth() {
  13. return contentDiv.getOffsetWidth();
  14. }

代码示例来源: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.haulmont.cuba/cuba-web-toolkit

  1. protected boolean isBordersVisible() {
  2. CubaGroupBoxWidget panel = getWidget();
  3. return panel.captionStartDeco.getOffsetWidth() > 0 || panel.captionEndDeco.getOffsetWidth() > 0;
  4. }
  5. }

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

  1. int offsetWidth = parent.getOffsetWidth();
  2. int height = offsetHeight + 100;
  3. int width = offsetWidth + 100;

代码示例来源: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.googlecode.gwtquery/gwtquery

  1. public boolean f(Element e, int index) {
  2. return (e.getOffsetWidth() + e.getOffsetHeight()) > 0 &&
  3. !"none".equalsIgnoreCase(styleImpl.curCSS(e, "display", true));
  4. }
  5. });

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

  1. public static void centerElementOnPosition(Element elem, int posX, int posY){
  2. int elementWidth = elem.getOffsetWidth();
  3. int elementHeight = elem.getOffsetHeight();
  4. setElementPosition(elem, posX - elementWidth/2, posY - elementHeight/2);
  5. }

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

  1. private void detectIndent(VTreeTableRow vTreeTableRow) {
  2. indentWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
  3. if (indentWidth == 0) {
  4. indentWidth = -1;
  5. return;
  6. }
  7. for (Widget w : this) {
  8. ((VTreeTableRow) w).setIndent();
  9. }
  10. calculateMaxIndent();
  11. }

代码示例来源:origin: de.esoco/gewt

  1. @Override
  2. void animate(Element rElement, double fProgress)
  3. {
  4. double fWidth = rElement.getOffsetWidth();
  5. rElement.getStyle()
  6. .setHeight(fWidth * (1.0d - fProgress), Unit.PX);
  7. }
  8. },

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

  1. private void setSliderPos(int value) {
  2. if (!isAttached()) {
  3. return;
  4. }
  5. int width = bar.getOffsetWidth();
  6. int sliderPos = value * width / max;
  7. setPos(sliderPos);
  8. }

代码示例来源:origin: fr.lteconsulting/hexa.core

  1. @Override
  2. public Size getDisplaySize()
  3. {
  4. Element td = getTd();
  5. Size size = new Size( td.getOffsetWidth(), td.getOffsetHeight() );
  6. return size;
  7. }

代码示例来源:origin: OpenNMS/opennms

  1. @Override
  2. public int getPhysicalWidth() {
  3. return getSVGElement().getParentElement().getOffsetWidth() - getLeftMargin();
  4. }

代码示例来源:origin: ltearno/hexa.tools

  1. @Override
  2. public Size getDisplaySize()
  3. {
  4. Element td = getTd();
  5. Size size = new Size( td.getOffsetWidth(), td.getOffsetHeight() );
  6. return size;
  7. }

代码示例来源:origin: org.kie.workbench/kie-wb-common-dmn-client

  1. @Override
  2. public void onResize() {
  3. final Element parentElement = getElement().getParentElement();
  4. final Integer width = parentElement.getOffsetWidth();
  5. final Integer height = parentElement.getOffsetHeight();
  6. if (width > 0 && height > 0) {
  7. setPixelSize(width, height);
  8. }
  9. resizableContent.ifPresent(RequiresResize::onResize);
  10. }
  11. }

代码示例来源:origin: fr.lteconsulting/hexa.core

  1. public Size getSize()
  2. {
  3. Element td = getTdElement();
  4. return new Size( td.getOffsetWidth(), td.getOffsetHeight() );
  5. }
  6. }

代码示例来源: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: org.uberfire/uberfire-wires-core-grids

  1. @Override
  2. public void updatePanelSize() {
  3. final Element parentElement = getElement().getParentElement();
  4. final Integer width = parentElement.getOffsetWidth();
  5. final Integer height = parentElement.getOffsetHeight();
  6. if (width > 0 && height > 0) {
  7. updatePanelSize(width,
  8. height);
  9. }
  10. }

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

  1. @Override
  2. public int getWidth(Element e) {
  3. return (int) (e.getOffsetWidth() - num(curCSS(e, "paddingLeft", true))
  4. - num(curCSS(e, "paddingRight", true))
  5. - num(curCSS(e, "borderRightWidth", true)) - num(curCSS(e, "borderRightWidth", true)));
  6. }

代码示例来源:origin: io.github.nibiruos.ui/org.nibiru.ui.gwt

  1. @Override
  2. protected int getNativeWidth() {
  3. Element e = DOM.createDiv();
  4. e.setInnerText(getValue().get() != null ? getValue().get() : "I");
  5. e.getStyle().setPosition(Style.Position.ABSOLUTE);
  6. Document.get().getBody().appendChild(e);
  7. int width = e.getOffsetWidth();
  8. e.removeFromParent();
  9. return width + MAGIC_PADDING;
  10. }

相关文章

Element类方法