You could try storing the child widget in a private member variable and
then in onAttach() actually add the child widget to its parent. This is the
approach I have taken when using UiChild.
On Friday, January 3, 2014 9:16:23 AM UTC-5, Ben Cuthbert wrote:
Hi All,
I have created a custom widget that extends ComplexPanel so that it can
have children.
The UIBinder looks like so
layout:Layout ui:field=layoutPanel
layout:top
g:HTMLPanel styleName=links-container
/g:HTMLPanel
/layout:top
/layout:Layout
In the Layout class that extends ComplexPanel I have a method to add to top
@UiChild( tagname = top )
public final void addTopPanel(Element widget) {
addPanelToParent(TOP_CONTENT_TAG, widget);
}
The issue I see is that when UIBinder builds the page it trys to load the
child element of layoutPanel before building and calling onLoad of
layoutPanel. The child needs to the parent element layoutPanel to be
initialised before it attempts to load itself onto the parent if that
makes sense. Basically like the Document.ready(), once that is called the
child can add to the parent.
The only way around this was to create an eventBus msg and fire it into
the application once the entire app has loaded and then manually create a
class of the Child widget and add it to the parent.
--
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-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.