Sunday, February 3, 2013

How to pass UiFields from one class to another using uibinder?

Hi,

I have a main page layout defined with a DockLayoutPanel. Each north south center etc is split into single classes as the code gets very big.

Now, I want to pass a label from "north" to the class "Foo".
1. How can I pass this label best using uibinder?
2. Why does the following code not work (getting a UnableToCompleteException when launching the page)?


MyMain.ui.xml
<g:DockLayoutPanel>
 <g:north>
  <g:Label ui:field="label" />
 </g:north>

 <g:center>
  <my:Foo label="{label}" />
 </g:center>
</g:DockLayoutPanel>



MyMain.java
class MyMain extends Composite {
    @UiField
    Label label;
}


Foo.java:
class Foo extends Composite {
    private Label label;

    public void setLabel(Label label) {
        this.label = label;
    }
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment