Friday, December 28, 2012

PresenterWidget In GWTP For Dummies


PresenterWidget In GWTP For Dummies


Presenter widgets are pluggable components in GWTP framework.

Create it and insert into any place you want in the GWT application.

Basically, you need to call setInSlot() method to insert into a slot of the Presenter (SetInSlot() method in Container Presenter).

Sample project creates a Container Presenter and all the (ContentMenuPresenter, ContentHeaderPresenter, ContentFooterPresenter) Presenter Widgets are inserted into Container Presenter when it loads (reveals, revealInParent() method of Container Presenter).

Container Presenter is not a place, so you can’t reveal it with the help of URL. So you have to create Presenter which is a place. In this case, it’s ProfileOverviewPresenter with place token as “profile”. (Append #profile) to URL.

Then, revealInParent() method of ProfileOverviewPresenter call RevealContentEvent.fire(this, ContentContainerPresenter.MAIN_CONTENT_SLOT, this); which will reveal it parent, which is Container Presenter.

The Reveal Event for Container presenter is RevealRootLayoutContentEvent.fire(this, this); and not RevealRootContentEvent, Please note this.

The Reveal Event for ProfileOverviewPresenter is RevealContentEvent.fire(this, ContentContainerPresenter.MAIN_CONTENT_SLOT, this);.

Section Colors might irritate you, please don't mind.




No comments:

Post a Comment