To have your widget usable in Uibinder it must implement at least IsWidget interface. Being a widget already, it of course already implements IsWidget.
Therefore, any non-widget could also be used as a child widget element in uibinder by having it implement IsWidget.
The IsWidget interface requires the non-widget to implement the method asWidget()
. Therefore, such a non-widget would have to act as a widget container.
Implementing IsWidget will only allow the class to be used as a child widget element.
Let's say your class is
com.zzz.client.ui.HelloKitty
In order for it be able to have child widget elements, it must implement HasWidgets
.
<ui:UiBinder
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:z='urn:import:com.zzz.client.ui'>
<g:VerticalPanel>
<z:HelloKitty>
<g:button ..../>
<g:textbox>asdf</g:textbox>
</z:HelloKitty>
<g:VerticalPanel>
</ui:UiBinder>
Or, it could also just implement HasOneWidget.
In order to allow the class to have text between its uibinder tags, it must implement HasText.
<ui:UiBinder
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:z='urn:import:com.zzz.client.ui'>
<g:VerticalPanel>
<z:HelloKitty>qwerty</z:HelloKitty>
<g:VerticalPanel>
</ui:UiBinder>
In order to accept valid HTML between its tags, I believe you should have it implement HasHTML.
@UiField
field, even if you can't specify the generic type in the xml file. – Aimee