Example usage for com.google.gwt.dom.client Document getBodyOffsetTop

List of usage examples for com.google.gwt.dom.client Document getBodyOffsetTop

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Document getBodyOffsetTop.

Prototype

public int getBodyOffsetTop() 

Source Link

Usage

From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java

License:Apache License

/**
 * Sets the popup's position relative to the browser's client area. The
 * popup's position may be set before calling {@link #show()}.
 * //from   ww  w .ja v  a2  s .  com
 * @param left
 *            the left position, in pixels
 * @param top
 *            the top position, in pixels
 */
public void setPosition(int left, int top) {
    if (centered) {
        uncentralizeMe();
    }

    // Account for the difference between absolute position and the
    // body's positioning context.
    Document document = Document.get();
    left -= document.getBodyOffsetLeft();
    top -= document.getBodyOffsetTop();

    this.left = left;
    this.top = top;
    setPopupPositionStyle(left, top);
}