--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks,Mike--
public attachWidget( Widget widget ) {
// Logical attach.
getChildren().add(widget);
adopt(widget);
}
Hi,OK, I forgot about that part - I once had to go through these issues as well but forgot soon after.You need to subclass HTMLPanel and SubmitButton to get what you want. The HTMLPanel only supports adding widgets to existing HTML elements, not just make an Element into a widget without detaching.First you need to subclass the SubmitButton so that you gain access to the SubmitButton(Element) protected constructor. Use that constructor to create the SubmitButton instance.You also need to subclass the HTMLPanel class, you need to add a method that contains something like this:This method does not enforce any checks, so make sure that the widget is a wrapped one of an Element contained in the HTMLPanel.public attachWidget( Widget widget ) {
// Logical attach.
getChildren().add(widget);
adopt(widget);
}
Frankly I don't understand why the HTMLPanel and the Wrapping stuff does not allow you to do this. It is way more useful because you can bulk render and entire GUI and then later attach the widgets.
--
From my experimentation with wrap() I can see very few circumstances in which case it is actually useful. It appears to be useful where there is only one page. The way nesting of widgets is handled would make it tricky in anything more complicated.
They way I use the widgets, maybe not supported, work perfectly. It is made part of the widget hierarchy. And when I remove the widget, everything is again cleaned up. I did a lot of memory leak investigating and it is just working the way it should. Even if the window close event is triggered, they get properly cleaned up just like the rest of the widget hierarchy.The wrap methods on Widget assume and do too much and that makes them not usable beyond the scope of wrapping non nested widgets.
-- J.--