martes, 3 de julio de 2012

GWT-Platform and GXT3

Previously I wrote about GXT3 and RequestFactory to perform basic crud operations
This time I will be focused in GWTPlatform using GXT3 widgets.
The source code is available through Github

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.

Final Project

 Project Structure

I copied the style of Sencha examples

Project Layout is the main presenter it contains the header and footer of the page.
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.

Presenter lifecycle
  • 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.
References GWTP Page and Dani GWTP Course.

Nested Presenters
Your header, footer and menu are in one presenter the "parent presenter".

Presenter Widget
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
References Dani GWTP course

For Example MenuPresenter use Place Request to navigate through the programs.

Popup Presenters
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

UPDATED and are available through maven central

add to your GWT module

<inherits name='com.rhemsolutions.PopupWindow'/>

2 comentarios:

  1. Some useful links about GXT3 uibinder

  2. Wow nice article. :) - I shared it with the GWTP community.