Wednesday, June 30, 2010

Re: Creating new Presenter/View in a Presenter

On 30 juin, 17:31, Jyaif <> wrote:
> Hi,
> I am beginning to work on a big app created in GWT and I have a
> question regarding the MVP pattern in GWT.
> I have read,
> and I understand that the AppController creates Presenters, and
> provides them a rpcService, an eventBus, and a view.
> This makes it easy (among other things) to target mobile phones or
> desktop computers by submitting different views to the Presenters
> However, if one of the Presenter creates some widget, also programmed
> in a VP fashion, it will be the Presenter's responsibility to
> instantiate the view for the widget :-(
> How can I make it so the Presenter knows what kind of view (mobile
> phone/desktop) it has to create?
> Should I submit to all my Presenters a Factory with the methods
> newViewForWidgetA(), newViewForWidgetB(), etc... ?

Yes, more or less. But I'd encourage you to use some dependency
injection framework, such as Google GIN, to make this waaaay easier to
write and maintain.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment