Java Code Examples for com.google.gwt.user.client.ui.Widget#getOffsetHeight()
The following examples show how to use
com.google.gwt.user.client.ui.Widget#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: MockComponentsUtil.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * Returns the preferred size of the specified widget, * in an array of the form {@code [width, height]}. * <p> * It is assumed that: * <ul> * <li>{@code w} has no parent</li> * <li>{@code w} has not been configured to be invisible</li> * </ul> */ public static int[] getPreferredSizeOfDetachedWidget(Widget w) { // Attach the widget to the DOM, so that its preferred size is calculated correctly RootPanel.get().add(w); String[] style = clearSizeStyle(w); int width = w.getOffsetWidth() + 4; int height = w.getOffsetHeight() + 6; if (height < 26) { // Do not make the button smaller height = 26; // then 26, as this mimicks what happens } // on the real device restoreSizeStyle(w, style); // Detach the widget from the DOM before returning RootPanel.get().remove(w); return new int[] { width, height }; }
Example 2
Source File: Djvu_html5.java From djvu-html5 with GNU General Public License v2.0 | 5 votes |
private void resizeCanvas() { Widget panel = canvas.getParent(); int width = panel.getOffsetWidth(); int height = panel.getOffsetHeight(); canvas.setWidth(width + "px"); canvas.setCoordinateSpaceWidth(width); canvas.setHeight(height + "px"); canvas.setCoordinateSpaceHeight(height); if (pageLayout != null) pageLayout.canvasResized(); }
Example 3
Source File: GwtVerticalSplitLayoutImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override protected int getElementSize(Widget widget) { int offsetHeight = widget.getOffsetHeight(); if(offsetHeight == 0) { offsetHeight = Window.getClientHeight(); } return offsetHeight; }
Example 4
Source File: UiHelper.java From gwt-material with Apache License 2.0 | 4 votes |
public static int calculateSpaceToBottom(Widget widget) { return Window.getClientHeight() - widget.getAbsoluteTop() - widget.getOffsetHeight(); }
Example 5
Source File: DragSourceSupport.java From appinventor-extensions with Apache License 2.0 | 3 votes |
/** * Returns whether the specified widget contains a position given * by the absolute coordinates. * * @param w widget to test * @param absX absolute x coordinate of position * @param absY absolute y coordinate of position * @return {@code true} if the position is within the widget, {@code false} * otherwise */ private static boolean isInside(Widget w, int absX, int absY) { int wx = w.getAbsoluteLeft(); int wy = w.getAbsoluteTop(); int ww = w.getOffsetWidth(); int wh = w.getOffsetHeight(); return (wx <= absX) && (absX < wx + ww) && (wy <= absY) && (absY < wy + wh); }