Thursday, July 5, 2012

[GWT Model View Presenter] Reusing of presenters possible ? Problem

Hi,

A rookie here.

I just started with Ray Ryan's Google IO talk and following some articles on Google Developers site. I have not used any of the GWT add-ons like GWTP or MVP4G or GIN or any other stuff. Just followed the contacts example on the GWT site and tried to model my case.

I have a DockLayout panel which has a header, a navigation tree on the left and a central main panel. All of this i have in a single DefaultView which implements DefaultPresenter .

Now i have a DialogBox which  pops up when the user does something in the tree and this is modelled in DialogView and DialogPresenter respectively.

Now when i hide the DialogBox , i am ending up calling a new instance of DefaultPresenter from the AppController which by virtue creates a new DefaultView and all of my tree selections and other changes in the main central panel are gone.

1. Is it possible to re use instances of presenters without creating a new one on history change  ? (for eg, DefaultPresenter in my case)
2.
Is there a way in MVP pattern to pass controls between presenters with values persisting ?
3.  How to load a existing instance of a presenter inside app controller on an event fire ?

Or have i got the whole MVP architecture thing wrong ? I am now planning to have different presenters and views for each of my components say HeaderPresenter / HeaderView, TreePresenter / TreeView , MainContentPresenter/MainContentView ?So that i will only create new instances of presenters which i need (like MainContentPresenter ) and keep the existing ones as it is (like TreePresenter and HeaderPresenter)  Does this solve my problem ? How would i stitch all of this different views in the browser window ? I am not using UiBInder , just sticking to basics .

Help me out all you experts, i am in a deadlock !

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/pLXNc45Q534J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment