Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Composite widget in *.ui.xml

Tags:

gwt

uibinder

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?

like image 908
Ula Krukar Avatar asked Feb 28 '26 12:02

Ula Krukar


1 Answers

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) {
  ...
}
like image 147
Chris Lercher Avatar answered Mar 02 '26 15:03

Chris Lercher