One approach I've used is to put some logic in the View to forward a different event than the purely GUI events to the Presenter. For example, if you have a table or list of items which can be clicked, and a click signifies selection of an item, use HasSelectionHandlers() in the View, and translate in the View which item is selected by the click. This seems to work for selection use cases, but it makes your View in the MVP more Supervising Controller (http://martinfowler.com/ eaaDev/SupervisingPresenter.html) than Passive View (http:// martinfowler.com/eaaDev/PassiveScreen.html).
If you were to need separate handling for each list item being clicked, then you are likely looking at a Presenter per list item or at having the View include a factory to add list items and return handlers (i.e., HasClickHandlers addListItem() ). Any of these approaches will work, it just depends on what you are looking to do with each click handler. V/r, Jason On Sep 6, 3:19 am, fonghuangyee <[email protected]> wrote: > Hihi , > After i go through so many MVP example, i found that we always use > presenter to get those HasClickHandler from Display( Or View) to do > some action. This way works nice for static clickable action, but if > we have some dynamic button ( example a table listing with a list of > clickable action ), then i have to get a list of HasClickHandler > from > display? and every time i add new row to the table listing, i have to > take care of the handler action, quite troublesome. > any advice? > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
