Popup Presenter

A popup presenter is a standard presenter with a view that extends PopupView.


Display a Popup Presenter

The Popup Presenter skips the view's slot methods altogether. It will be added directly to the DOM and displayed at the specified location.

  • Example of rendering a popup presenter.
  • Removing a popup presenter. Calling either of these methods will hide the popup presenter and remove it from it's parent. Note that these methods should only be called from the Popup Presenter.

Create a Popup Presenter


To create a popup presenter, MyView should extends PopupView.

public class InfoPopupPresenterWidget extends PresenterWidget<InfoPopupPresenterWidget.MyView> {
    interface MyView extends PopupView {

    InfoPopupPresenterWidget(EventBus eventBus,
                             MyView view) {
        super(eventBus, view);


The view extends PopupViewImpl or PopupViewWithUiHandlers<PresentersUiHandlers>. If the content of the view is defined using UiBinder, make sure that the type of the host object is a PopupPanel.

public class InfoPopupView extends PopupViewImpl implements InfoPopupPresenterWidget.MyView {
    interface Binder extends UiBinder<PopupPanel, InfoPopupView> {

    InfoPopupView(Binder uiBinder,
                  EventBus eventBus) {



<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
        .popup {
            background-color: aqua;
            border: 3px double black;
            padding: 0 15px;

    <g:PopupPanel autoHideOnHistoryEventsEnabled="true" autoHideEnabled="true" styleName="{style.popup}">


GWTP provides a PopupPositioner to automatically position a popup.

By default Popups use the CenterPopupPositioner which displays the Popup in the center of the screen. Popups will automatically be repositioned when the window is resized.

There are 3 provided Popup Presenters

  • CenterPopupPositioner - The default, will center the popup

  • TopLeftPopupPositioner - Will position the popup at the (x, y) coordinates provided.

  • RelativeToWidgetPopupPositioner - Will position the popup relative to a widget.

To create a PopupPositioner, extend the PopupPositioner class.

The popupPositioner can be set by calling the super constructor:
java super(eventBus, myPositioner);
java getView().setPopupPositioner(myPositioner);

Custom Reposition.

To perform any operation before the popup is repositioned, The method onReposition() has to be overriden in the popup view.
This is where any custom styling of the Popup view should happen.