This time I will be focused in GWTPlatform using GXT3 widgets.
The source code is available through Github https://github.com/poseidonjm/GWTP-GXT3
Used to simplify the MVP architecture with minimal boilerplate (GWTP page)
GWTP Plugin for Eclipse
You should install the plugin that offers wizards for create Presenters and Events
Help > Install New Software
I am using Eclipse Indigo.
I copied the style of Sencha examples
LayoutPresenter is not a Place so the user cannot navigate.
Create a Presenter
I choose RevealRootContentEvent because this presenter takes all the screen.
All presenters are composed of three files.
All presenters have a inner interface that view implements.
- Presenters are Singleton so it is instantiated once.
- prepareFromRequest(): Is where you can get url parameters.
- onBind(): Is called when the presenter is instantiated.
- onReveal(): Is called whenever the Presenter was not visible on screen and becomes visible.
- onHide(): Is called whenever the Presenter was visible on screen and is being hidden.
- onReset(): Is called whenever the user navigates to a page that shows the presenter, whether it was visible or not.
Your header, footer and menu are in one presenter the "parent presenter".
Is for reusable graphical and logical code.
Create a Presenter Widget
Create Default Presenter
When you start you program the first page that you see is the default presenter.
Create Colaborador Presenter
Most presenters have a token so the user can navigate.
For example #colaboradores is a token that identifies the program Colaboradores. When there is not token the default presenter is shown.
You can navigate from one presenter to another by:
- Typing another url
- Using a Hyperlink Widget
- Using a Place Request
For Example MenuPresenter use Place Request to navigate through the programs.
Is a presenter widget that is shown inside a popup dialog.
Create a Popup Presenter
Popup Presenters and GXT3
Usually popup views extend PopupViewImpl or PopupViewWithUiHandler. But it works if you use GWT PopupPanel or DialogBox or whatever extend GWT PopupPanel.
I wanna use GXT Window like Popup Presenter so I copied PopupViewImpl and PopupViewWithUiHandler and change GWT PopupPanel by GXT Window.
Its all about GWTP and GXT3
GXTPopupViewImpl.java and GXTPopupViewWithUiHandlers.java are available through maven central
add to your GWT module