Anantha Kumaran
Anantha Kumaran

Reputation: 10379

How to use UiHandler in a MVP pattern

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.

Upvotes: 5

Views: 3922

Answers (3)

James Moore
James Moore

Reputation: 9026

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

Upvotes: 2

Jeroen
Jeroen

Reputation: 441

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.)

Upvotes: 4

Carnell
Carnell

Reputation: 749

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

Upvotes: 2

Related Questions