GWT - How to define a Widget outside layout hierarchy in uibinder xml file

Posted by mr_room on Stack Overflow See other posts from Stack Overflow or by mr_room
Published on 2010-03-18T12:31:24Z Indexed on 2010/03/19 1:41 UTC
Read the original article Hit count: 462

Filed under:
|

Hello,
this is my first post. I hope someone could help me.
I'm looking for a way to define a widget in UiBinder XML layout file separately, without being part of the layout hierachy. Here's a small example:

<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">

<g:Label ui:field="testlabel" text="Hallo" />
<g:HTMLPanel>       
...
</g:HTMLPanel>

The compile fails since the ui:UiBinder element expects only one child element.
In Java Code i will access and bind the Label widget as usual:

@UiField Label testlabel;

For example, this could be useful when you define a Grid or FlexTable - i want to define the Labels for the table header within the XML layout file, not programmatically within the code.

Many thanks in advance

© Stack Overflow or respective owner

Related posts about gwt

Related posts about uibinder