Sorry for not being clearer - self-contained wasn't the correct description. Modular is more what I meant; widgets in the sense that they could be used in multiple views, but still have the ability to interact with the rest of the app (fire events mostly). If they're widgets as used in uiBinder templates, how to I control the construction of them to include an event bus. Should I make the event bus static, declare a UiConstructor, or use injection?
Some of the examples (mobilewebapp) use a container and pass a "presenter" that implements IsWidget into it (for example the piechartpresenter), but others declare the actual widget in the uibinder files (expenses). I'm mostly looking for a design pattern that others have found helpful with actual implementation (where/how to declare/construct) of MVP widgets. On Tuesday, May 15, 2012 7:26:43 AM UTC-4, Thomas Broyer wrote: > > > On Monday, May 14, 2012 9:48:14 PM UTC+2, Shaun Tarves wrote: >> >> I have an application utilizing A&P with an MVP set-up. There are some >> situations where I want to create some self-contained widgets (think, a >> small alert window that needs to fire and event or a box that might want to >> pull some data from a server). They aren't whole views and don't occupy >> entire display regions, but I want to maintain the MVP approach. >> >> I've seen a few approaches that include specifying a callback interface >> in the widget that your presenters (the one driving the view that holds the >> widget) would implement, but that would mean writing the same code multiple >> times if you use the widget in more than one view. >> >> I'm curious what people are doing when faced with this situation. > > > If they're self-contained, why would your presenter need to do anything > special with them? Can't they simply be implementation details of your > views? > > As far as MVP is concerned, your self-contained widget could use MVP > itself, it does not mean it has to be exposed and/or, if it is, the view > should belong to the view of the containing component, and its presenter to > the presenter of the containing component. > As an example, CellList, CellTable, et al. use MVP internally, but they > don't expose it; it's an implementation detail that allows fast > (non-GWTTestCase) unit-testing of the algorithms. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/xDAPV9XxrgYJ. 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.
