List of usage examples for com.google.gwt.user.client Element getClientHeight
@Override public int getClientHeight()
From source file:com.googlecode.kanbanik.client.components.WindowBox.java
License:Apache License
/** * Calculates the position of the mouse relative to the dialog box, and returns the corresponding "drag-mode" * integer, which describes which area of the box is being resized. * * @param clientX The x-coordinate of the mouse in screen pixels * @param clientY The y-coordinate of the mouse in screen pixels * @return A value in range [-1..8] describing the position of the mouse (see {@link #updateCursor(int)} for more * information)//ww w .j a v a 2s .c o m */ protected int calcDragMode(int clientX, int clientY) { com.google.gwt.dom.client.Element resize = this.getCellElement(2, 2).getParentElement(); int xr = this.getRelX(resize, clientX); int yr = this.getRelY(resize, clientY); int w = resize.getClientWidth(); int h = resize.getClientHeight(); if ((xr >= 0 && xr < w && yr >= -5 && yr < h) || (yr >= 0 && yr < h && xr >= -5 && xr < w)) return 8; resize = this.getCellElement(2, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if ((xr >= 0 && xr < w && yr >= -5 && yr < h) || (yr >= 0 && yr < h && xr >= 0 && xr < w + 5)) return 6; resize = this.getCellElement(0, 2).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if ((xr >= 0 && xr < w && yr >= 0 && yr < h + 5) || (yr >= 0 && yr < h && xr >= -5 && xr < w)) return 2; resize = this.getCellElement(0, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if ((xr >= 0 && xr < w && yr >= 0 && yr < h + 5) || (yr >= 0 && yr < h && xr >= 0 && xr < w + 5)) return 0; resize = this.getCellElement(0, 1).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (yr >= 0 && yr < h) return 1; resize = this.getCellElement(1, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (xr >= 0 && xr < w) return 3; resize = this.getCellElement(2, 1).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (yr >= 0 && yr < h) return 7; resize = this.getCellElement(1, 2).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (xr >= 0 && xr < w) return 5; return -1; }
From source file:com.gwtm.ui.client.widgets.TextArea.java
License:Apache License
@Override public void onKeyUp(KeyUpEvent event) { Element ele = getElement(); final int extraLineHeight = 15; int scrollHeight = ele.getScrollHeight(); int clientHeight = ele.getClientHeight(); Utils.Console(scrollHeight + " " + clientHeight); if (clientHeight < scrollHeight) { ele.getStyle().setHeight(scrollHeight + extraLineHeight, Unit.PX); }//from w w w . j a va 2 s .c o m }
From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java
License:Apache License
public static boolean isScrolledToBottom(UIObject source) { Element element = source.getElement(); int pageClientHeight = element.getOwnerDocument().getClientHeight(); int clientHeight = element.getClientHeight(); if (clientHeight > pageClientHeight) { int delta = clientHeight - pageClientHeight; // When scrolling down the absoluteTop will be negative int absoluteTop = element.getAbsoluteTop() * -1; if (absoluteTop >= delta) { return true; }//ww w . j av a2s . com } return false; }
From source file:com.zipsoft.widgets.client.lazylayout.VLazyLayout.java
License:Apache License
@Deprecated private static boolean isBeingShown(final Widget child, final int proximity) { final Element element = child.getElement(); /*/*from w w w .j ava2 s. c o m*/ * track the original element's position as we iterate through the DOM * tree */ int originalTopAdjusted = 0; final int originalHeight = element.getOffsetHeight(); int originalLeftAdjusted = 0; final int originalWidth = element.getOffsetWidth(); com.google.gwt.dom.client.Element childElement = element; com.google.gwt.dom.client.Element parentElement = element.getParentElement(); // while (parentElement != null) { // clientheight == the height as seen in browser // offsetheight == the DOM element's native height // What part of its canvas the parent shows, relative to its own // coordinates (0,0 is the top left corner) final int parentTop = parentElement.getScrollTop(); //OVO JE VISINA CELOG KONTEJNERA - ONE JE MAKSIMALNA - MOZDA TREBA MERITI SAMO VISINU KOJA SE VIDI // final int parentBottom = parentTop + parentElement.getClientHeight(); final int parentBottom = parentTop + parentElement.getClientHeight(); final int parentLeft = parentElement.getScrollLeft(); final int parentRight = parentLeft + parentElement.getClientWidth(); /* * renderbox is the target box that is checked for visibility. If * the renderbox and parent's viewport don't overlap, it should not * be rendered. The renderbox is the child's position with an * adjusted margin. */ final int renderBoxTop = childElement.getOffsetTop() - proximity; final int renderBoxBottom = childElement.getOffsetTop() + childElement.getOffsetHeight() + proximity; final int renderBoxLeft = childElement.getOffsetLeft() - proximity; final int renderBoxRight = childElement.getOffsetLeft() + childElement.getOffsetWidth() + proximity; if (!colliding2D(parentTop, parentRight, parentBottom, parentLeft, renderBoxTop, renderBoxRight, renderBoxBottom, renderBoxLeft)) { return false; } /* * see if the original component is visible from the parent. Move * the object around to correspond the relative changes in position. * The offset is always relative to the parent - not the canvas. */ originalTopAdjusted += childElement.getOffsetTop() - childElement.getScrollTop(); originalLeftAdjusted += childElement.getOffsetLeft() - childElement.getScrollLeft(); if (!colliding2D(parentTop, parentRight, parentBottom, parentLeft, originalTopAdjusted - proximity, originalLeftAdjusted + originalWidth + proximity, originalTopAdjusted + originalHeight + proximity, originalLeftAdjusted - proximity)) { return false; } // debug("Menjam Parent element - OVO NE BI TREBALO DA SE DOGODI!!!"); // childElement = parentElement; // parentElement = childElement.getOffsetParent(); // } //TODO MISLIM DA OVO NE TREBA VISE // lastly, check the browser itself. // final int parentTop = Window.getScrollTop(); // final int parentBottom = parentTop + Window.getClientHeight(); // final int parentLeft = Window.getScrollLeft(); // final int parentRight = parentLeft + Window.getClientWidth(); // // final int renderBoxTop = childElement.getOffsetTop() - proximity; // final int renderBoxBottom = childElement.getOffsetTop() + childElement.getClientHeight() + proximity; // // final int renderBoxLeft = childElement.getOffsetLeft() - proximity; // final int renderBoxRight = childElement.getOffsetLeft() + childElement.getClientWidth() + proximity; // // if (!colliding2D(parentTop, parentRight, parentBottom, parentLeft, // renderBoxTop, renderBoxRight, renderBoxBottom, renderBoxLeft)) { // return false; // } // // originalTopAdjusted += childElement.getOffsetTop(); // originalLeftAdjusted += childElement.getOffsetLeft(); // if (!colliding2D(parentTop, parentRight, parentBottom, parentLeft, // originalTopAdjusted - proximity, originalLeftAdjusted // + originalWidth + proximity, originalTopAdjusted // + originalHeight + proximity, originalLeftAdjusted // - proximity)) { // return false; // } return true; }
From source file:edu.kit.ipd.sonar.client.jsxGraph.JSXBoard.java
License:Open Source License
/** * Returns the pixel height of the jsxboard. * * @return the pixel height//from www . j av a2s . c o m */ int getHeight() { Element b = DOM.getElementById(domElementID); if (b != null) { return b.getClientHeight(); } GWT.log("board element not find in getHeight", null); return 0; }
From source file:org.cruxframework.crux.widgets.client.grid.AbstractTablelessGridStructure.java
License:Apache License
public void onAfterRender() { Element container = this.getElement().getParentElement().cast(); onResize(container.getClientHeight(), container.getClientWidth()); }
From source file:org.kaaproject.kaa.sandbox.web.client.mvp.view.dialog.KaaDialog.java
License:Apache License
/** * Calculates the position of the mouse relative to the dialog box, and returns the corresponding "drag-mode" * integer, which describes which area of the box is being resized. * * @param clientX The x-coordinate of the mouse in screen pixels * @param clientY The y-coordinate of the mouse in screen pixels * @return A value in range [-1..8] describing the position of the mouse (see {@link #updateCursor(int)} for more * information)//www . jav a2 s. c o m */ protected int calcDragMode(int clientX, int clientY) { com.google.gwt.dom.client.Element resize = this.getCellElement(2, 2).getParentElement(); int xr = this.getRelX(resize, clientX); int yr = this.getRelY(resize, clientY); int w = resize.getClientWidth(); int h = resize.getClientHeight(); if ((xr >= 0 && xr < w && yr >= -5 && yr < h) || (yr >= 0 && yr < h && xr >= -5 && xr < w)) return 8; resize = this.getCellElement(2, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if ((xr >= 0 && xr < w && yr >= -5 && yr < h) || (yr >= 0 && yr < h && xr >= 0 && xr < w + 5)) return 6; resize = this.getCellElement(0, 2).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if ((xr >= 0 && xr < w && yr >= 0 && yr < h + 5) || (yr >= 0 && yr < h && xr >= -5 && xr < w)) return 2; resize = this.getCellElement(0, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if ((xr >= 0 && xr < w && yr >= 0 && yr < h + 5) || (yr >= 0 && yr < h && xr >= 0 && xr < w + 5)) return 0; resize = this.getCellElement(0, 1).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (yr >= 0 && yr < h) return 1; resize = this.getCellElement(1, 0).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (xr >= 0 && xr < w) return 3; resize = this.getCellElement(2, 1).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (yr >= 0 && yr < h) return -1;//return 7; resize = this.getCellElement(1, 2).getParentElement(); xr = this.getRelX(resize, clientX); yr = this.getRelY(resize, clientY); if (xr >= 0 && xr < w) return 5; return -1; }
From source file:org.openremote.web.console.util.BrowserUtils.java
License:Open Source License
public static void showAlert(String msg) { ConsoleUnit console = WebConsole.getConsoleUnit(); Element elem = DOM.getElementById("alert_popup"); DOM.getElementById("alert_popup_msg").setInnerHTML(msg); int halfHeight = (int) Math.round((double) elem.getClientHeight() / 2); int halfWidth = (int) Math.round((double) elem.getClientWidth() / 2); elem.getStyle().setMarginTop(-halfHeight, Unit.PX); elem.getStyle().setMarginLeft(-halfWidth, Unit.PX); DOM.getElementById("alert_popup").getStyle().setVisibility(Visibility.VISIBLE); }