BTW handlers can also ignore events while unattached. Lot of choices here.

On Sun, Jan 16, 2011 at 7:18 PM, Jeff Schwartz <jefftschwa...@gmail.com>wrote:

> If your widgets are adding event handlers to the event bus (SimpleEventBus,
> for example) then they would 'probably' need to clean themselves up at some
> point by removing the handlers. When they should do this is really specific
> to the life-cycle of your widgets. If they are singletons with an
> application scope life cycle, for instance (why I used 'probably'), a
> reference to the widget will never go out of scope so there is no need to
> remove the handlers. If you are attaching, unattaching, and reattaching them
> then it would depend on whether the handlers were going to receive events
> while they are unattached and what they would do with them. If they update
> the dom then that wouldn't work so you would want to clean up the handlers
> in this case. But if they were only saving a reference to a list of records
> returned from the server for instance then that would be ok and there would
> be no need to remove the handler when the widget is detached. I hope you see
> where this is going - it all depends on your use case.
>
> Jeff
>
>
> On Wed, Jan 12, 2011 at 9:20 PM, Joe Hudson <joe...@gmail.com> wrote:
>
>> Hi, I'm wondering what, if anything I need to do from a cleanup
>> perspective when using a Widget that creates child elements.  For
>> example:
>>
>> public class MyWidget extends Widget {
>>
>>    public MyWidget() {
>>        Element el = DOM.createDiv();
>>        setElement(el);
>>
>>        Element anotherEl = DOM.createDiv();
>>        el.appendchild(anotherEl);
>>    }
>> }
>>
>> With the code above, should I do anything with "anotherEl" on detatch?
>>  Thanks for the advice.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> 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<google-web-toolkit%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
>
>
> --
> *Jeff Schwartz*
>
>


-- 
*Jeff Schwartz*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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