开发者

How to use UiHandler in a MVP pattern

开发者 https://www.devze.com 2022-12-21 15:09 出处:网络
Accoring to the MVP pattern the view should contain allthe UI components. Then i read about the new UiHandler introduced in the GWT 2.0. The UiHandler can be used only in the view.

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.


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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消