As your view is singleton you have to tell the presenter that it should 
detach itself from the view, e.g. by introducing a public 
Presenter.unbind() method. You then have to call that unbind() method 
before you throw away your presenter instance. Your presenter needs to 
remember the HandlerRegistration instances so unbind() can use them to 
remove the handlers from the view.

Alternative: Let the view know its presenter and let it delegate to the 
presenter once an event has occurred. If the view does not know any 
presenter, nothing will happen. That way you can swap presenters or remove 
the presenter by calling view.setPresenter(null). 

public MyView extends Composite implements View {
  
  Presenter presenter = ...;
  Button createNoteButton = ...;

  public void setPresenter(Presenter p) {
     presenter = p;
  }

   @UiHandler("createNoteButton") //if you use UiBinder. Otherwise you have 
to register the ClickHandler yourself in the view.
   void onClick(ClickEvent event) {
     if(presenter != null) { presenter.onCreateNote() };
   }

}

-- J.

-- 
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/-/zUz9ytH1c6YJ.
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.

Reply via email to