I have a PopupPanel with a Label inside. I'm trying to center the popup horizontally, so I'm calling setPopupPositionAndShow. In the callback, however, the offsetWidth and offsetHeight arguments don't take into account any margins or padding, whether I set them on the popup or the label: the values are always for the text of the label only. Besides the arguments to the callback, I get the same (incorrect) results from calling getOffsetWidth/Height on the label or the popup directly. PopupPanel#center() also does not work correctly. Tested on both Chrome and Firefox.
Here's the code I'm using to set the position:
messageLabel.setText(message);
popup.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
popup.setPopupPosition((Window.getClientWidth() - offsetWidth) / 2, popupTop);
}
});
The PopupPanel is in a UiBinder; not sure if that's relevant. Am I doing something wrong, or should I file a bug?