Wednesday, September 22, 2010

MVP - model question

The Google's Contacts example is nice for showing events, history, and
the MVP pattern, but too simplistic to really show complex models.

I have a situation where I would like to use the same model object
between several presenters. Also note that this model object is
created on the client side and passed to the server later. It will
never be retrieved from the server.

What is the best way to accomplish this?

I was thinking that I could use the AppController event framework
(onChangeValue) to handle creation/passing the model to the different
presenters.

Something like this...

public void onValueChange(ValueChangeEvent<String> event) {
....
....
MyExampleObject eo = new MyExampleObject();

if (token.equals("list")) {
presenter = new ContactsPresenter(rpcService, eventBus, new
ContactsView(),eo );
} else if (token.equals("add")) {
presenter = new EditContactPresenter(rpcService, eventBus, new
EditContactView(), eo);
}
....
....

Thoughts? Ideas? Curses?

Regards,
Mike

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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