google-code-export / gwt-platform

Automatically exported from code.google.com/p/gwt-platform
1 stars 0 forks source link

Add support for automatically unregistering handlers in onHide #408

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be helpful to have a way to automatically unregister some handlers 
when the presenter is hidden.  The attached patch creates a list of 
'visibleHandlerRegistrations'.  The methods addVisibleRegisteredHandler(type, 
handler) and registerVisibleHandler(registration) add to this list and 
internalHide calls removeHandler on all items in the list before calling 
onHide().

The intended usage is that a presenter would call addVisibleRegisteredHandler() 
in onReveal(), similar to a call to addRegisteredHandler in onBind() except the 
removeHandler is called when the presenter is hidden.

Original issue reported on code.google.com by snstan...@gmail.com on 16 Mar 2012 at 5:26

Attachments:

GoogleCodeExporter commented 9 years ago
This is awesome.  Thanks so much.  I will test it out.

Original comment by drgenejones on 16 Mar 2012 at 5:30

GoogleCodeExporter commented 9 years ago
Hi,
I also did something like that but with an added fonctionnality :
handler are registered in the hook onReveal and removed in the hook onHide.
I'm joining a class extending PresenterWidget that is doing the trick.

My method was first named addRegisteredVisibleHandler, but the name you use in 
your patch is better, so addVisibleRegisteredHandler it is now.

Mathieu

Original comment by math.cla...@gmail.com on 23 Mar 2012 at 10:21

Attachments:

GoogleCodeExporter commented 9 years ago
As a patch made with mercurial.

Original comment by math.cla...@gmail.com on 23 Mar 2012 at 2:12

Attachments: