Java Code Examples for com.google.gwt.dom.client.Element#getOffsetHeight()
The following examples show how to use
com.google.gwt.dom.client.Element#getOffsetHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleDropdown.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void open() { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN); Element menuElt = this.menuContainer.getElement(); int topMenu = menuElt.getAbsoluteTop() - Window.getScrollTop(); int menuHeight = menuElt.getOffsetHeight(); int anchorHeight = this.anchor.getOffsetHeight(); int clientHeight = Window.getClientHeight(); if (topMenu + menuHeight > clientHeight && topMenu >= anchorHeight + menuHeight) { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_UP); } int leftMenu = menuElt.getAbsoluteLeft() - Window.getScrollLeft(); int menuWidth = menuElt.getOffsetWidth(); int anchorWidth = this.anchor.getOffsetWidth(); int clientWidth = Window.getClientWidth(); if (leftMenu + menuWidth > clientWidth && leftMenu >= anchorWidth + menuWidth) { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_LEFT); } this.open = true; this.updateHandlers(); }
Example 2
Source File: ArrowPositionData.java From gantt with Apache License 2.0 | 6 votes |
public ArrowPositionData(Element from, Element to) { this.from = from; this.to = to; predecessorHeightCenter = from.getOffsetHeight() / 2; predecessorTop = from.getOffsetTop(); predecesorBottom = from.getOffsetTop() + from.getOffsetHeight(); predecessorRight = from.getOffsetLeft() + from.getOffsetWidth(); predecessorLeft = from.getOffsetLeft(); thisBottom = to.getOffsetTop() + to.getOffsetHeight(); thisCenter = to.getOffsetHeight() / 2; top = Math.min(predecessorTop, to.getOffsetTop()); bottom = Math.max(predecesorBottom, thisBottom); height = bottom - top; left = Math.min(predecessorRight, to.getOffsetLeft()); right = Math.max(predecessorRight, to.getOffsetLeft()); width = right - left; fromTop = predecessorTop <= to.getOffsetTop(); fromLeft = predecessorRight <= to.getOffsetLeft(); halfWidth = (int) width / 2; }
Example 3
Source File: CubaGridLayoutSlot.java From cuba with Apache License 2.0 | 5 votes |
protected int getButtonHeight(CubaButtonWidget widget) { Element element = widget.getElement(); if (!element.hasClassName("link")) { return getWidgetHeight(widget); } Element captionElement = findLinkButtonCaptionElement(element); if (captionElement == null) { return getWidgetHeight(widget); } // The LinkButton component has an ability to wrap caption onto multiple rows. // Thus, at the first recalculation of the heights for the slots, the "getWidgetHeight()" call // returns an invalid multiline component height. // In order to calculate the really required caption height, regardless of the 'white-space' mode, // we need to explicitly set it to 'nowrap'. After calculation, it's reverted back. Style style = captionElement.getStyle(); String prevWhiteSpace = style.getWhiteSpace(); style.setWhiteSpace(Style.WhiteSpace.NOWRAP); int buttonHeight = element.getOffsetHeight(); if (prevWhiteSpace != null && !prevWhiteSpace.isEmpty()) { style.setWhiteSpace(Style.WhiteSpace.valueOf(prevWhiteSpace)); } else { style.clearWhiteSpace(); } return buttonHeight; }
Example 4
Source File: SuggestionsContainer.java From cuba with Apache License 2.0 | 5 votes |
public void initPaging() { int containerHeight = getElement().getOffsetHeight(); Element childEl = container.getFirstChildElement(); if (childEl != null) { itemsPerPage = containerHeight / childEl.getOffsetHeight(); } }
Example 5
Source File: MaterialCutOut.java From gwt-material-addins with Apache License 2.0 | 5 votes |
/** * Setups the cut out position when the screen changes size or is scrolled. */ protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) { float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop())); float left = relativeTo.getAbsoluteLeft(); float width = relativeTo.getOffsetWidth(); float height = relativeTo.getOffsetHeight(); if (circle) { if (width != height) { float dif = width - height; if (width > height) { height += dif; top -= dif / 2; } else { dif = -dif; width += dif; left -= dif / 2; } } } top -= padding; left -= padding; width += padding * 2; height += padding * 2; $(cutOut).css("top", top + "px"); $(cutOut).css("left", left + "px"); $(cutOut).css("width", width + "px"); $(cutOut).css("height", height + "px"); }
Example 6
Source File: TextLayer.java From djvu-html5 with GNU General Public License v2.0 | 5 votes |
@Override public void onScroll(ScrollEvent event) { int scrollTop = getElement().getScrollTop(); int page = currentPage; Element pageElement = pages.get(page).getElement(); while (page > 0 && pageElement.getOffsetTop() > scrollTop) { pageElement = pages.get(--page).getElement(); } while (page + 1 < pages.size() && pageElement.getOffsetTop() + pageElement.getOffsetHeight() < scrollTop) { pageElement = pages.get(++page).getElement(); } int left = pageElement.getOffsetLeft() - getElement().getScrollLeft(); int top = pageElement.getOffsetTop() - scrollTop; app.getPageLayout().externalScroll(page, left, top); }
Example 7
Source File: Geometry.java From gwt-traction with Apache License 2.0 | 5 votes |
/** * Updated to factor in border and padding */ public static final int getH(Element e) { int ret = e.getOffsetHeight(); ret -= MiscUtils.getComputedStyleInt(e, "paddingTop"); ret -= MiscUtils.getComputedStyleInt(e, "paddingBottom"); ret -= MiscUtils.getComputedStyleInt(e, "borderTopWidth"); ret -= MiscUtils.getComputedStyleInt(e, "borderBottomWidth"); return Math.max(ret, 0); }
Example 8
Source File: InputDatePicker.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
public void popup(Widget container, Widget relativeTo) { this.setVisible(true); StyleUtils.addStyle(this, InputDatePicker.STYLE_POPUP); RootPanel.get().add(this); Element positioningElement = this.getElement(); Element relativeElement = relativeTo.getElement(); int targetHeight = relativeElement.getOffsetHeight(); int targetTop = relativeElement.getAbsoluteTop(); int positioningWidth = positioningElement.getOffsetWidth(); int targetRight = relativeElement.getAbsoluteRight(); Style elementStyle = positioningElement.getStyle(); elementStyle.setPosition(Position.ABSOLUTE); elementStyle.setLeft(targetRight - positioningWidth, Unit.PX); elementStyle.setTop(targetTop + targetHeight, Unit.PX); StyleUtils.addStyle(this, InputDatePicker.STYLE_FADE); StyleUtils.addStyle(this, InputDatePicker.STYLE_SHOW); this.setFocus(true); if (this.popupBlurHandler == null) { this.popupBlurHandler = this.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { InputDatePicker.this.hide(); } }); } }
Example 9
Source File: AbstractHover.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void resetPosition(Element toPositionedElement, Widget relativeTo, Placement placement) { Element relativeElement = relativeTo.getElement(); com.google.gwt.dom.client.Style elementStyle = toPositionedElement.getStyle(); int tooltipWidth = toPositionedElement.getOffsetWidth(); int tooltipHeight = toPositionedElement.getOffsetHeight(); int targetWidth = relativeElement.getOffsetWidth(); int targetHeight = relativeElement.getOffsetHeight(); int targetTop = relativeElement.getOffsetTop(); int targetLeft = relativeElement.getOffsetLeft(); elementStyle.setPosition(Position.ABSOLUTE); switch (placement) { case TOP: elementStyle.setLeft(targetLeft + targetWidth / 2 - tooltipWidth / 2, Unit.PX); elementStyle.setTop(targetTop - tooltipHeight, Unit.PX); break; case BOTTOM: elementStyle.setLeft(targetLeft + targetWidth / 2 - tooltipWidth / 2, Unit.PX); elementStyle.setTop(targetTop + targetHeight, Unit.PX); break; case LEFT: elementStyle.setLeft(targetLeft - tooltipWidth, Unit.PX); elementStyle.setTop(targetTop + targetHeight / 2 - tooltipHeight / 2, Unit.PX); break; case RIGHT: elementStyle.setLeft(targetLeft + targetWidth, Unit.PX); elementStyle.setTop(targetTop + targetHeight / 2 - tooltipHeight / 2, Unit.PX); break; default: break; } }
Example 10
Source File: MeasurerInstance.java From swellrt with Apache License 2.0 | 4 votes |
@Override public double height(Element e) { return e.getOffsetHeight(); }
Example 11
Source File: MeasurerInstance.java From swellrt with Apache License 2.0 | 4 votes |
@Override public double offsetBottom(Element e) { return e.getOffsetTop() + e.getOffsetHeight(); }
Example 12
Source File: MeasurerInstance.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public double height(Element e) { return e.getOffsetHeight(); }
Example 13
Source File: MeasurerInstance.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public double offsetBottom(Element e) { return e.getOffsetTop() + e.getOffsetHeight(); }
Example 14
Source File: VDragDropUtil.java From cuba with Apache License 2.0 | 3 votes |
/** * Get the vertical drop location in a ordered layout * * @param element * The target element or cell * @param clientY * The client y-coordinate * @param topBottomRatio * The ratio how the cell has been divided * @return The drop location */ public static VerticalDropLocation getVerticalDropLocation(Element element, int clientY, double topBottomRatio) { int offsetHeight = element.getOffsetHeight(); return getVerticalDropLocation(element, offsetHeight, clientY, topBottomRatio); }