I would like to create a custom GWT composite widget that I can later use this way in *.ui.xml using uiBinder (cw is prefix for my custom widgets package):
<cw:CustomPanel>
<cw:header><g:Label>test</g:Label></cw:header>
<cw:content><g:Label>test</g:Label></cw:content>
</cw:CustomPanel>
In short, I would expect that setHeader
and setContent
methods on my custom widget are called by the framework somehow.
Is that at all possible?
This is what @UiChild
is for, see the JavaDoc at http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/uibinder/client/UiChild.html
If you want to keep the method names setHeader
and setContent
(instead of addHeader
and addContent
), you'll have to use
@UiChild(tagname = "header")
void setHeader(Widget headerWidget) {
...
}