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

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

本文整理了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

/**
 * The height of the document's client area.
 * 
 * @return the document's client height
 */
public final int getClientHeight() {
 return getViewportElement().getClientHeight();
}

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

@Override
public int getClientHeight() {
 return element.getClientHeight();
}

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

public double getUnitSizeInPixels(
  Element parent, Unit unit, boolean vertical) {
 if (unit == null) {
  return 1;
 }
 switch (unit) {
  case PCT:
   return (vertical ? parent.getClientHeight() : parent.getClientWidth())
     / 100.0;
  case EM:
   return relativeRuler.getOffsetWidth() / 10.0;
  case EX:
   return relativeRuler.getOffsetHeight() / 10.0;
  case CM:
   return fixedRuler.getOffsetWidth() * 0.1; // 1.0 cm / cm
  case MM:
   return fixedRuler.getOffsetWidth() * 0.01; // 0.1 cm / mm
  case IN:
   return fixedRuler.getOffsetWidth() * 0.254; // 2.54 cm / in
  case PT:
   return fixedRuler.getOffsetWidth() * 0.00353; // 0.0353 cm / pt
  case PC:
   return fixedRuler.getOffsetWidth() * 0.0423; // 0.423 cm / pc
  default:
  case PX:
   return 1;
 }
}

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

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

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

/**
 * The height of the document's client area.
 * 
 * @return the document's client height
 */
public final int getClientHeight() {
 return getViewportElement().getClientHeight();
}

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

/**
 * Uses scrollHeight to detect vertical overflow.
 */
public static boolean detectVerticalOverflow(Element element) {
  int scrollHeight = element.getScrollHeight();
  int clientHeight = element.getClientHeight();
  return scrollHeight > clientHeight;
}

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

/**
 * The height of the document's client area.
 * 
 * @return the document's client height
 */
public final int getClientHeight() {
 return getViewportElement().getClientHeight();
}

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

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

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

@Override
 public Vector get() {
  return new Vector(el.getClientWidth(), el.getClientHeight());
 }
}, 200);

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

private int getSize(Element e, String name) {
 int ret = 0;
 if ("width".equals(name)) {
  ret = getWidth(e);
 } else if ("height".equals(name)) {
  ret = getHeight(e);
 } else if ("clientWidth".equals(name)) {
  ret = e.getClientWidth();
 } else if ("clientHeight".equals(name)) {
  ret = e.getClientHeight();
 } else if ("offsetWidth".equals(name)) {
  ret = e.getOffsetWidth();
 } else if ("offsetHeight".equals(name)) {
  ret = e.getOffsetHeight();
 }
 return ret;
}

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

/**
 * Recalculate the height and width of a native scrollbar.
 */
private static void maybeRecalculateNativeScrollbarSize() {
 // Check if the size has already been calculated.
 if (nativeHeight > -1) {
  return;
 }
 // Create a scrollable element and attach it to the body.
 Element scrollable = Document.get().createDivElement();
 scrollable.getStyle().setPosition(Position.ABSOLUTE);
 scrollable.getStyle().setTop(-1000.0, Unit.PX);
 scrollable.getStyle().setLeft(-1000.0, Unit.PX);
 scrollable.getStyle().setHeight(100.0, Unit.PX);
 scrollable.getStyle().setWidth(100.0, Unit.PX);
 scrollable.getStyle().setOverflow(Overflow.SCROLL);
 scrollable.getStyle().setProperty("direction", "rtl");
 Document.get().getBody().appendChild(scrollable);
 // Add some content.
 Element content = Document.get().createDivElement();
 content.setInnerText("content");
 scrollable.appendChild(content);
 // Measure the height and width.
 nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight();
 nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth();
 nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft());
 // Detach the scrollable element.
 scrollable.removeFromParent();
}

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

private void calculateMoveRestriction(DragObject dragObject){
  
  isMouseMoveAxisX = dragOptionsCache.contains(DragOption.MOVE_AXIS_X) && (!dragOptionsCache.contains(DragOption.BLOCK_WIDGET));
  isMouseMoveAxisY = dragOptionsCache.contains(DragOption.MOVE_AXIS_Y) && (!dragOptionsCache.contains(DragOption.BLOCK_WIDGET));;
  
  isMouseMoveRestricted = (isMouseMoveAxisX != isMouseMoveAxisY) || (dragOptionsCache.contains(DragOption.BLOCK_WIDGET));
  
  if (dragObject.getContainerElement()!= null) {
    Element container = dragObject.getContainerElement();
    Element dragged = dragObject.getDragElement();
    
    maxMousePositionX = container.getAbsoluteRight() - dragged.getClientWidth();
    maxMousePositionY = container.getAbsoluteBottom() - dragged.getClientHeight();
    minMousePositionX = container.getAbsoluteLeft();
    minMousePositionY = container.getAbsoluteTop();
    
    isMouseMoveRestricted = true;
  }
}

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

private void fixInlineElement(Element e) {
 if (e.getClientHeight() == 0 && e.getClientWidth() == 0
   && "inline".equals(curCSS(e, "display", true))) {
  setStyleProperty(e, "display", "inline-block");
  setStyleProperty(e, "width", "auto");
  setStyleProperty(e, "height", "auto");
 }
}

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

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

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

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

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

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

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

@Override
  public void run()
  {
    m_resizing = false;
    if (!m_resizing)
    {
      int w = getElement().getParentElement().getClientWidth();
      int h = getElement().getParentElement().getClientHeight();
      getViewport().getHandlerManager().fireEvent(new ResizeEndEvent(w, h));
      cancel();
    }
  }
};

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

public static <T> void initiate( Element element, Callback<T> callback, T cookie, Event event )
  {
    int x = event.getClientX();
    int y = event.getClientY();
    int w = element.getClientWidth();
    int h = element.getClientHeight();

    CaptureWidget captureWidget = new CaptureWidget();
    Ghost<T> ghost = new Ghost<T>( x, y, w, h, element, callback, cookie );

    // append the ghost to the body of the document
    RootPanel.get().add( captureWidget );

    // capture the mouse on the captureWidget and update the ghost position
    captureWidget.start( x, y, ghost );

    event.preventDefault();
    event.stopPropagation();
  }
}

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

public static <T> void initiate( Element element, Callback<T> callback, T cookie, Event event )
  {
    int x = event.getClientX();
    int y = event.getClientY();
    int w = element.getClientWidth();
    int h = element.getClientHeight();

    CaptureWidget captureWidget = new CaptureWidget();
    Ghost<T> ghost = new Ghost<T>( x, y, w, h, element, callback, cookie );

    // append the ghost to the body of the document
    RootPanel.get().add( captureWidget );

    // capture the mouse on the captureWidget and update the ghost position
    captureWidget.start( x, y, ghost );

    event.preventDefault();
    event.stopPropagation();
  }
}

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

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

相关文章

微信公众号

最新文章

更多

Element类方法