A Curse ! ^^ Do you mean you want to share a model between multiple presenters ? That's the not the "MVP described by Ray Ryan" way of doing things. A presenter shoul d be able to get a model object in two ways only : - RPC call - being passed an event by the EventBus Maybe your models are too big, or your presenters too small.
Anyway, if I wanted to do something like this (god preserve me), I'd go with a Ginjected @Singleton model object. Or else, a model object that listens to the Presenters via the EventBus to know when it needs to update or send itself to the server. On 22 sep, 16:44, mike b <[email protected]> wrote: > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
