/** * The height of the document's client area. * * @return the document's client height */ public final int getClientHeight() { return getViewportElement().getClientHeight(); }
@Override public int getClientHeight() { return element.getClientHeight(); }
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; } }
int parentHeight = parentElem.getClientHeight(); for (Layer l : layers) { adjustHorizontalConstraints(parentWidth, l);
/** * The height of the document's client area. * * @return the document's client height */ public final int getClientHeight() { return getViewportElement().getClientHeight(); }
/** * Uses scrollHeight to detect vertical overflow. */ public static boolean detectVerticalOverflow(Element element) { int scrollHeight = element.getScrollHeight(); int clientHeight = element.getClientHeight(); return scrollHeight > clientHeight; }
/** * The height of the document's client area. * * @return the document's client height */ public final int getClientHeight() { return getViewportElement().getClientHeight(); }
@Override public int screenHeight() { return Document.get().getDocumentElement().getClientHeight(); }
@Override public Vector get() { return new Vector(el.getClientWidth(), el.getClientHeight()); } }, 200);
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; }
/** * 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(); }
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; } }
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"); } }
public int getHeight(Element e) { fixInlineElement(e); return (int) (e.getClientHeight() - num(curCSS(e, "paddingTop", true)) - num(curCSS(e, "paddingBottom", true))); }
@Override public IDimension screenSize () { // TODO: inverse scale? screenSize.width = Document.get().getDocumentElement().getClientWidth(); screenSize.height = Document.get().getDocumentElement().getClientHeight(); return screenSize; }
@Override public IDimension screenSize () { // TODO: inverse scale? screenSize.width = Document.get().getDocumentElement().getClientWidth(); screenSize.height = Document.get().getDocumentElement().getClientHeight(); return screenSize; }
@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(); } } };
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(); } }
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(); } }
/** * 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; }