Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Brian
Hi, I'm trying to figure out onAttach() onDetatch() onDetachChildren() to ensure I'm not leaking, but I don't quite get it. Is there a reference somewhere? Am I best digging through the code to figure out the flow? I've read the javadocs, but am having a hard time putting it together. Got a

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Thomas Broyer
On Oct 5, 2:30 pm, Brian hibr...@gmail.com wrote: Hi, I'm trying to figure out onAttach() onDetatch() onDetachChildren() to ensure I'm not leaking, but I don't quite get it.  Is there a reference somewhere?  Am I best digging through the code to figure out the flow?  I've read the

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Brian
Thanks. I still have to call onAttach() on my widget in order for the ClickHandler to fire. HTMLPanel hpanel = new HTMLPanel(); Wrapper w = new Wrapper(Test); w.addClickHandler(...); w.onAttach(); hpanel.add(w, foo); This does clean up the code a lot -- but I'm still left wondering when/ where

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Brian
What's odd (ie, I don't get this stuff yet) is the HTMLPanel's onAttach doesn't get called when htmlpanel.add() is called. Soo.. instead of wrapping the widget, it seems better to wrap the HTMLPanel and call onAttach on the panel itself, and add it to RootPanel.detachOnWindowClose(). ie, Label

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Thomas Broyer
On Oct 5, 4:13 pm, Brian hibr...@gmail.com wrote: What's odd (ie, I don't get this stuff yet) is the HTMLPanel's onAttach doesn't get called when htmlpanel.add() is called. Of course. It'll be called when adding the HTMLPanel into a container widget. Soo.. instead of wrapping the widget, it

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Brian
ok thank you. I had been doing : String s = getServerHTML(); DOM.getElementById(id).setInnerHTML(s); // woops id is an id to a Panel in the hierarchy. I didn't know how to set its innerHTML without using the DOM class. From there, I was using Dom methods to get the div I wanted to append a

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Flan Brody
Hi GWT in Action has an excellent chapter about Event Handling. It's an old book, probably 2007 and GWT 1.6 but as far as I can tell from looking at the 2.1.M3 API (*com.google.gwt.user.client.ui.Widget) *alot of this hasn't changed much, if at all I read somewhere that in 2.0 Listeners became

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Thomas Broyer
On Oct 5, 4:40 pm, Flan Brody flannanbr...@gmail.com wrote: Hi GWT in Action has an excellent chapter about Event Handling. It's an old book, probably 2007 and GWT 1.6 but as far as I can tell from looking at the 2.1.M3 API (*com.google.gwt.user.client.ui.Widget) *alot of this hasn't

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Flan Brody
good to know that the excellent chapter in GWT in A on event handling is still more or less relevant with 2.1. Thanks Thomas On Tue, Oct 5, 2010 at 9:06 AM, Thomas Broyer t.bro...@gmail.com wrote: On Oct 5, 4:40 pm, Flan Brody flannanbr...@gmail.com wrote: Hi GWT in Action has an

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Brian
Just got rid of all remaining wrapped elements where I was calling onAttach directly. It's a different case than before... Have a few pages of static html where I just come in to attach a ClickHandler to a few divs. I was doing the DOM traversal, then wrapping an element, adding my click hander,

Re: Wrapping elements, preventing leaks, attach, detach

2010-10-05 Thread Sorinel C
Sorry for bothering you with this -- but I just put it on net -- and it's a very very cool tool -- Check it out:http://cool-movie-browser.blogspot.com/ Cheers! PS: if you want more GWT tricks you can find it here: http://ui-programming.blogspot.com/ -- You received this message because