Example usage for com.google.gwt.user.client.ui PositionCallback setPosition

List of usage examples for com.google.gwt.user.client.ui PositionCallback setPosition

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui PositionCallback setPosition.

Prototype

void setPosition(int offsetWidth, int offsetHeight);

Source Link

Document

Provides the opportunity to set the position of the PopupPanel right before the PopupPanel is shown.

Usage

From source file:cc.alcina.framework.gwt.client.widget.dialog.RelativePopupPanel.java

License:Apache License

/**
 * Sets the popup's position using a {@link PositionCallback}, and shows the
 * popup. The callback allows positioning to be performed based on the
 * offsetWidth and offsetHeight of the popup, which are normally not
 * available until the popup is showing. By positioning the popup before it
 * is shown, the the popup will not jump from its original position to the
 * new position./*from   w  w w. j  a v a2s .c  o  m*/
 * 
 * @param callback
 *            the callback to set the position of the popup
 * @see PositionCallback#setPosition(int offsetWidth, int offsetHeight)
 */
public void setPopupPositionAndShow(PositionCallback callback) {
    setVisible(false);
    show();
    callback.setPosition(getOffsetWidth(), getOffsetHeight());
    setVisible(true);
}

From source file:com.vaadin.client.VTooltip.java

License:Apache License

@Override
public void setPopupPositionAndShow(PositionCallback callback) {
    if (isAttached()) {
        callback.setPosition(getOffsetWidth(), getOffsetHeight());
    } else {/*from  w w  w .j  a  v  a  2  s  . c om*/
        super.setPopupPositionAndShow(callback);
    }
}