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

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

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

Element.getClientHeight介绍

[英]Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin.
[中]返回元素的内部高度(以像素为单位),包括填充,但不包括水平滚动条高度、边框或边距。

代码示例

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

  1. /**
  2. * The height of the document's client area.
  3. *
  4. * @return the document's client height
  5. */
  6. public final int getClientHeight() {
  7. return getViewportElement().getClientHeight();
  8. }

代码示例来源:origin: stephenh/tessell

  1. @Override
  2. public int getClientHeight() {
  3. return element.getClientHeight();
  4. }

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

  1. public double getUnitSizeInPixels(
  2. Element parent, Unit unit, boolean vertical) {
  3. if (unit == null) {
  4. return 1;
  5. }
  6. switch (unit) {
  7. case PCT:
  8. return (vertical ? parent.getClientHeight() : parent.getClientWidth())
  9. / 100.0;
  10. case EM:
  11. return relativeRuler.getOffsetWidth() / 10.0;
  12. case EX:
  13. return relativeRuler.getOffsetHeight() / 10.0;
  14. case CM:
  15. return fixedRuler.getOffsetWidth() * 0.1; // 1.0 cm / cm
  16. case MM:
  17. return fixedRuler.getOffsetWidth() * 0.01; // 0.1 cm / mm
  18. case IN:
  19. return fixedRuler.getOffsetWidth() * 0.254; // 2.54 cm / in
  20. case PT:
  21. return fixedRuler.getOffsetWidth() * 0.00353; // 0.0353 cm / pt
  22. case PC:
  23. return fixedRuler.getOffsetWidth() * 0.0423; // 0.423 cm / pc
  24. default:
  25. case PX:
  26. return 1;
  27. }
  28. }

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

  1. int parentHeight = parentElem.getClientHeight();
  2. for (Layer l : layers) {
  3. adjustHorizontalConstraints(parentWidth, l);

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

  1. /**
  2. * The height of the document's client area.
  3. *
  4. * @return the document's client height
  5. */
  6. public final int getClientHeight() {
  7. return getViewportElement().getClientHeight();
  8. }

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

  1. /**
  2. * Uses scrollHeight to detect vertical overflow.
  3. */
  4. public static boolean detectVerticalOverflow(Element element) {
  5. int scrollHeight = element.getScrollHeight();
  6. int clientHeight = element.getClientHeight();
  7. return scrollHeight > clientHeight;
  8. }

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

  1. /**
  2. * The height of the document's client area.
  3. *
  4. * @return the document's client height
  5. */
  6. public final int getClientHeight() {
  7. return getViewportElement().getClientHeight();
  8. }

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

  1. @Override
  2. public int screenHeight() {
  3. return Document.get().getDocumentElement().getClientHeight();
  4. }

代码示例来源:origin: JetBrains/mapper

  1. @Override
  2. public Vector get() {
  3. return new Vector(el.getClientWidth(), el.getClientHeight());
  4. }
  5. }, 200);

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

  1. private int getSize(Element e, String name) {
  2. int ret = 0;
  3. if ("width".equals(name)) {
  4. ret = getWidth(e);
  5. } else if ("height".equals(name)) {
  6. ret = getHeight(e);
  7. } else if ("clientWidth".equals(name)) {
  8. ret = e.getClientWidth();
  9. } else if ("clientHeight".equals(name)) {
  10. ret = e.getClientHeight();
  11. } else if ("offsetWidth".equals(name)) {
  12. ret = e.getOffsetWidth();
  13. } else if ("offsetHeight".equals(name)) {
  14. ret = e.getOffsetHeight();
  15. }
  16. return ret;
  17. }

代码示例来源: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: pl.touk.gwtaculous/gwtaculous-lib

  1. private void calculateMoveRestriction(DragObject dragObject){
  2. isMouseMoveAxisX = dragOptionsCache.contains(DragOption.MOVE_AXIS_X) && (!dragOptionsCache.contains(DragOption.BLOCK_WIDGET));
  3. isMouseMoveAxisY = dragOptionsCache.contains(DragOption.MOVE_AXIS_Y) && (!dragOptionsCache.contains(DragOption.BLOCK_WIDGET));;
  4. isMouseMoveRestricted = (isMouseMoveAxisX != isMouseMoveAxisY) || (dragOptionsCache.contains(DragOption.BLOCK_WIDGET));
  5. if (dragObject.getContainerElement()!= null) {
  6. Element container = dragObject.getContainerElement();
  7. Element dragged = dragObject.getDragElement();
  8. maxMousePositionX = container.getAbsoluteRight() - dragged.getClientWidth();
  9. maxMousePositionY = container.getAbsoluteBottom() - dragged.getClientHeight();
  10. minMousePositionX = container.getAbsoluteLeft();
  11. minMousePositionY = container.getAbsoluteTop();
  12. isMouseMoveRestricted = true;
  13. }
  14. }

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

  1. private void fixInlineElement(Element e) {
  2. if (e.getClientHeight() == 0 && e.getClientWidth() == 0
  3. && "inline".equals(curCSS(e, "display", true))) {
  4. setStyleProperty(e, "display", "inline-block");
  5. setStyleProperty(e, "width", "auto");
  6. setStyleProperty(e, "height", "auto");
  7. }
  8. }

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

  1. public int getHeight(Element e) {
  2. fixInlineElement(e);
  3. return (int) (e.getClientHeight() - num(curCSS(e, "paddingTop", true)) - num(curCSS(e,
  4. "paddingBottom", true)));
  5. }

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

  1. @Override public IDimension screenSize () {
  2. // TODO: inverse scale?
  3. screenSize.width = Document.get().getDocumentElement().getClientWidth();
  4. screenSize.height = Document.get().getDocumentElement().getClientHeight();
  5. return screenSize;
  6. }

代码示例来源:origin: io.playn/playn-html

  1. @Override public IDimension screenSize () {
  2. // TODO: inverse scale?
  3. screenSize.width = Document.get().getDocumentElement().getClientWidth();
  4. screenSize.height = Document.get().getDocumentElement().getClientHeight();
  5. return screenSize;
  6. }

代码示例来源:origin: com.rht-emitrom/lienzo-core

  1. @Override
  2. public void run()
  3. {
  4. m_resizing = false;
  5. if (!m_resizing)
  6. {
  7. int w = getElement().getParentElement().getClientWidth();
  8. int h = getElement().getParentElement().getClientHeight();
  9. getViewport().getHandlerManager().fireEvent(new ResizeEndEvent(w, h));
  10. cancel();
  11. }
  12. }
  13. };

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

  1. public static <T> void initiate( Element element, Callback<T> callback, T cookie, Event event )
  2. {
  3. int x = event.getClientX();
  4. int y = event.getClientY();
  5. int w = element.getClientWidth();
  6. int h = element.getClientHeight();
  7. CaptureWidget captureWidget = new CaptureWidget();
  8. Ghost<T> ghost = new Ghost<T>( x, y, w, h, element, callback, cookie );
  9. // append the ghost to the body of the document
  10. RootPanel.get().add( captureWidget );
  11. // capture the mouse on the captureWidget and update the ghost position
  12. captureWidget.start( x, y, ghost );
  13. event.preventDefault();
  14. event.stopPropagation();
  15. }
  16. }

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

  1. public static <T> void initiate( Element element, Callback<T> callback, T cookie, Event event )
  2. {
  3. int x = event.getClientX();
  4. int y = event.getClientY();
  5. int w = element.getClientWidth();
  6. int h = element.getClientHeight();
  7. CaptureWidget captureWidget = new CaptureWidget();
  8. Ghost<T> ghost = new Ghost<T>( x, y, w, h, element, callback, cookie );
  9. // append the ghost to the body of the document
  10. RootPanel.get().add( captureWidget );
  11. // capture the mouse on the captureWidget and update the ghost position
  12. captureWidget.start( x, y, ghost );
  13. event.preventDefault();
  14. event.stopPropagation();
  15. }
  16. }

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

  1. /**
  2. * Determine the thickness of a scroll-bar if it was visible. Assumes width of vertical scrollbar and height
  3. * of a horizontal scrollbar are the same.
  4. * @return The height in PX.
  5. */
  6. public static int determineScrollbarThickness() {
  7. Element panel = DOM.createDiv();
  8. panel.getStyle().setWidth(100, Unit.PX);
  9. panel.getStyle().setHeight(100, Unit.PX);
  10. panel.getStyle().setOverflow(Overflow.SCROLL);
  11. Document.get().getBody().appendChild(panel);
  12. int scrollbarHeight = panel.getOffsetHeight() - panel.getClientHeight();
  13. Document.get().getBody().removeChild(panel);
  14. return scrollbarHeight;
  15. }

相关文章

Element类方法