Thanks for ur advise. How about if i define a interface ( View Listener ), then my presenter implement the View Listener?
Example : public class MyView extend Composite implement MyPresenter.View { public interface Listerner { public void onEdit(String id); } ..... ..... Listener listener; // a List of Button here button.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ listener.onEdit(id); } ); } public class MyPresenter implement MyView.Listener { public interface View { } public void onEdit(String id){ // Do something here. }; } Please correct me if i am following the wrong way. Thanks. On Sep 7, 8:32 am, "Jason A. Beranek" <jason.bera...@gmail.com> wrote: > 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 theMVPmore 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 <fonghuang...@gmail.com> wrote: > > > > > Hihi , > > After i go through so manyMVPexample, i found that we always use > > presenter to get thoseHasClickHandlerfrom 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 ofHasClickHandler > > 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 google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---