I would like to create a component to decorate its children, such as:
mycomponent.ui.xml:
<g:FlowPanel addStyleNames="myStyle">
<!-- how can i render children ? -->
</g:FlowPanel>
and then others can use:
<myapp:mycomponent>
<g:Label>Decorated child</g:Label>
</myapp:mycomponent>
How can i render the children in uibinder? (or in Java, if i must)
Let
MyComponent
implement theHasWidgets
interface for adding/removing child widgets.The
MyComponent.ui.xml
looks as simple aswhile you delegate the methods specified ind
HasWidgets
to theFlowPanel
:Calling
will work this way.
Using this XML:
will instantiate
MyComponent
and then callMyComponent.add(label)
. All you have to do is override.add(..)
in your classMyComponent
and apply any styles that you want to passed components.