Are handlers kept registered on PopupPanel when we call hide() on it ?

20 views
Skip to first unread message

Boris Lenzinger

unread,
Feb 6, 2012, 6:36:56 AM2/6/12
to google-we...@googlegroups.com
Hi,

I was wondering how this is working. I made some code where I registered some event handlers on a PopupPanel so I can keep the data up to date.
But when I call hide on this popup panel and recreate a new one, then handlers are registered 2 times and so events are handler 2 times.

I was expecting another behavior : when the popup panel is hidden, I thought it was some kind of destroy. So I think that my strategy to rebuild a new PopupPanel is not good. Can you explain me how this should be designed please ?

Many thanks in advance.

Boris

Thomas Broyer

unread,
Feb 6, 2012, 8:35:40 AM2/6/12
to google-we...@googlegroups.com
It looks like the issue is not really the PopupPanel but rather the widget(s) you add inside: if you reuse the same widget (either in a single PopupPanel that you hide/show, or within several PopupPanel-s during the lifetime of the application), then handlers won't be unregistered for you, just like for any other widget (the same goes for the CloseHandler attached to a PopupPanel: PopupPanel is a widget like any other –except you don't add it to a parent widget–, so handlers aren't unregistered automatically). If on the other hand you re-create everything from scratch every time, then you'll obviously have to register your handlers on the new instances.

Boris Lenzinger

unread,
Feb 7, 2012, 4:04:19 AM2/7/12
to google-we...@googlegroups.com
Thank you for your answer Thomas. I'll check this and will come back with other questions if I still don't understand :-)

Boris


2012/2/6 Thomas Broyer <t.br...@gmail.com>
It looks like the issue is not really the PopupPanel but rather the widget(s) you add inside: if you reuse the same widget (either in a single PopupPanel that you hide/show, or within several PopupPanel-s during the lifetime of the application), then handlers won't be unregistered for you, just like for any other widget (the same goes for the CloseHandler attached to a PopupPanel: PopupPanel is a widget like any other –except you don't add it to a parent widget–, so handlers aren't unregistered automatically). If on the other hand you re-create everything from scratch every time, then you'll obviously have to register your handlers on the new instances.

--
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/-/J1_fBGcLXMcJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages