I use (2) personally: ContainingPresenter just knows about WidgetPresenter and calls its methods (which in turn call methods on WidgetView). ContainingPresenter has a factory to create WidgetPresenter and WidgetPresenter has a factory to create WidgetView. (Truth is, I never write these factories, I let Gin inject the components.)
Cheers, Philippe On Dec 7, 11:10 am, Brian Reilly <[email protected]> wrote: > What do you think is the best way for ContainingPresenter get an > instance of WidgetView? I think that either: > > 1. WidgetView needs to be an interface and ContainingPresenter is > given a factory/provider for creating them > 2. ContainingPresenter doesn't reference WidgetView at all > > One of the main benefits of using MVP is that the Presenter can be > tested with a simple JRE test. To achieve that, you have to be very > careful with how your view and presenter interact with each other. > > -Brian > > On Tue, Dec 7, 2010 at 11:44 AM, PhilBeaudoin > > > > > > > > <[email protected]> wrote: > > Thanks metalhammer, the support is always appreciated. > > > Also, Fkereki, even if you don't want to use GWTP it might still be a > > good place to look at for the pattern you are looking for. > > > Basically, the idea in GWTP is to compose the presenter of your widget > > within your view's presenter. A bit more details. > > > Say you have: > > ContainingPresenter > > ContainingView > > WidgetPresenter > > WidgetView > > > You want to create WidgetPresenter (i.e. inject, or inject a > > Provider<>) within ContainingPresenter. Then: > > - ConainingPresenter call ContainingView.addWidget(WidgetView) > > - ContainingPresenter can hold a reference to the created > > WidgetPresenter, if it wants to communicate with it. Or you could use > > the event bus for this. > > > Hope it helps! > > > Philippe > > > On Dec 6, 11:50 pm, metalhammer29a <[email protected]> wrote: > >> have a look at GWTP, a popular MVP framework for GWT. > > >>http://code.google.com/p/gwt-platform/ > > >> GWTP is loaded with many added features, > >> including Tabbed Navigation, Breadcrumbs, Spring integration, among > >> others. > >> The community is active, dedicated and very friendly. > > > -- > > 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 > > athttp://groups.google.com/group/google-web-toolkit?hl=en. -- 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.
