On 30 juin, 17:31, Jyaif <[email protected]> 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 readhttp://code.google.com/webtoolkit/articles/mvp-architecture.html, > 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 [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.
