views:

718

answers:

3

Hi

Accoring to the MVP pattern the view should contain all the UI components. Then i read about the new UiHandler introduced in the GWT 2.0. The UiHandler can be used only in the view.

Should we use UiHandler in the mvp pattern, if so where should we use it.

NOTE: i am a GWT n00b.

+1  A: 

In my opinion using UiHandler goes against the MVP as the view will have the logic for the event handling. The presenter should have this logic. However if you have the UiHandler methods only fire events that the presenters would handle you may have a nice middle ground.

There is a discussion about this at http://groups.google.com/group/google-web-toolkit/browse_thread/thread/ff40f7599fcc8709/da8901fe337f19b2?hl=en&lnk=gst&q=Mvp+uibinder#da8901fe337f19b2

Carnell
+2  A: 

Using gwt-presenter, I can perfectly merge UiBinder with MVP. EventHandlers are perfectly dividable in those that handle view events (entering a textbox clicks a submit button) and those that have their place in the presenters (handle service responses etc.)

Jeroen
A: 

Google has a very useful article up here on this exact topic, including sample code.

James Moore