In general I think you should keep it with the class that does needs to remove the handler. I hope you know about setEnabled/setDisabled - that's the proper way to disable a buttons functionality, not to remove the handler. In general, I have only encountered 1 situation where I would be interested in removing a handler - more often than not, you will be adding/removing the widget itself which should take care off removing the handlers to free up memory.
On Thu, Apr 23, 2009 at 10:50 AM, romant <[email protected]> wrote: > > Hi guys, > with GWT 1.6 there is the new handler-based approach for managing > events. > When I register, let's say, a button handler > > HandlerRegistration buttonRegistration = button.addClickHandler(new > ClickHandler() {...do something...}); > > I get an instance of HandlerRegistration. Then, if I want to remove > the button's handler, let's say for a while just to make the button > functionality temporarily unavailable, I just call > > buttonRegistration.removeHandler(); > > But now the point is where to store the buttonHandler instance. With > listeners it was easy, you just called button.removeClickListener() > because the button kept the listener. > > If I have a large project with many buttons what is the best approach > for storing and handling the HandlerRegistration instances of my > buttons and other widgets? Is there any recommended design pattern? > This can make a real mess in my application if I do not find some > general solution of this. > > Thanks. > Roman > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
