Popup Presenter
Last updated
Was this helpful?
Last updated
Was this helpful?
A popup presenter is a standard presenter with a view that extends PopupView.
##Reference
Popup slot
##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
##Presenter
To create a popup presenter, MyView should extends PopupView
.
##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
.
##UiBinder
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:
or
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.