Harsha G
unread,Jul 5, 2012, 1:42:53 PM7/5/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
A rookie here. I have this specific issue in implementing Model View
Presenter Pattern using GWT in one of my use cases.
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.
Here's the issue.
I have my AppController onValueChage method like this
public void onValueChange(ValueChangeEvent<String> event) {
if(token != null){
presenter = null;
if(token == "display")
{
presenter = new DefaultPresenter(rpcService, eventBus, new
DefaultView());
}
else if(token == "popup")
{
presenter = new PopUpPresenter(rpcService, eventBus, new
PopUpView());
}
else if(token == "dialog")
{
presenter = new DialogPresenter(rpcService, eventBus, new
DialogView());
}
if (presenter!= null) {
presenter.go(container);
}
}
}
And my app flows like this, first Display then a selection in there
causes a Dialog and then Dialog sets some variable. And then after the
Dialog is hidden, i need to comeback to my original Display and carry
on. But the problem is i'm not able to come back to my original
DisplayPresenter with the same view because i end up creating a new
instance of the presenter whenever there's a history change.
All the things in bold are separate presenters which extends the
Presenter and all of them have specific views.
Questions ? 1. Help me come out of this limbo of creating new
instances of the presenters everytime there's a history change.
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?