Skip to content

Instantly share code, notes, and snippets.

@vega113
Created August 5, 2011 09:56
Show Gist options
  • Save vega113/1127246 to your computer and use it in GitHub Desktop.
Save vega113/1127246 to your computer and use it in GitHub Desktop.
if (UserAgent.isFirefox()) {
popup =
PopupFactory.createPopup(this.getElement(), new RelativePopupPositioner() {
@Override
public void setPopupPositionAndMakeVisible(Element relative, final Element p) {
ScheduleCommand.addCommand(new Scheduler.Task() {
@Override
public void execute() {
p.getStyle().setLeft((RootPanel.get().getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX);
int top = (RootPanel.get().getOffsetHeight() - p.getOffsetHeight()) / 4;
p.getStyle().setTop(Math.max(top, 280), Unit.PX);
p.getStyle().setVisibility(Visibility.VISIBLE);
}
});
}
}, chrome,
true);
} else {
popup = PopupFactory.createPopup(null, new CenterPopupPositioner(), chrome, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment