Yeah I'm not exactly sure what is causing it, doesn't seem to be that
PopupPanel.center() is broken outright. I tried playing around with
the code to see if I pin point the bug but wasn't able to. I'm using
GWT 1.7 though.
For those interested though here is the full code for a work around:
private void center() {
popup.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) a {
int[] winSize = windowSize();
int left = (winSize[0] - offsetWidth) >> 1;
int top = (winSize[1] - offsetHeight) >> 1;
popup.setPopupPosition(Window.getScrollLeft() + left,
Window.getScrollTop() + top);
}
});
}
private final native int[] windowSize() /*-{
var myWidth = 0, myHeight = 0;
if (typeof($wnd.innerWidth) == 'number') {
//Non-IE
myWidth = $wnd.innerWidth;
myHeight = $wnd.innerHeight;
} else if ($doc.documentElement &&
($doc.documentElement.clientWidth ||
$doc.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
myWidth = $doc.documentElement.clientWidth;
myHeight = $doc.documentElement.clientHeight;
} else if ($doc.body && ($doc.body.clientWidth ||
$doc.body.clientHeight)) {
//IE 4 compatible
myWidth = $doc.body.clientWidth;
myHeight = $doc.body.clientHeight;
}
return [myWidth, myHeight];
}-*/;