Why does the view need to be a singleton ? Anyway, when you are done with the presenter, then you need to tell it so. In that case it can unregister any installed handlers. David
On Thursday, September 13, 2012 8:09:30 PM UTC+2, Aryan wrote: > Hi all, > > lets look at the code: > > public class MyView implements IMyView { > > Button click; > ..... > public HasClickHandlers getClick(){ > return click; > } > > } > > > public class MyPresenter { > > public interface IMyView { > public HasClickHandlers getClick(); > } > > private IMyView view; > > public MyPresenter(IMyView view){ > this.view = view; > bind(); > } > > private void bind(){ > view.addClickHandler(new ClickHandler(){ > public void onClick(ClickEvent e){ > Window.alert("heellllo"); > > } > }//binds end > > }// class ends > > //(We are not using Activities or any MVP framework) > > ok tats it. Now in applicaton the view is singleton. but the presenter are > not, so they are made as and when needed like : > > MyPresenter p = new MyPresenter(view); //view is singleton throughout the > application; assume getting it by some factory > > Now suppose after a while if I have created *10 MyPresenter *instance > that will add *10 clickHandler *to button "c*lick" . So one click event > will be handled 10 times by 10 different handlers.* > ** > I can see here it as happening when click the button I get 10 times alert > window. > > So where I misunderstood the MVP architecture, what I am missing..... > please help > ** > Thanks in advance. > > > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/kqPCgpq2N1IJ. 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.