Thinking about this some more, I think the problem for me is that the
UiBinder forces me to use two separate classes:

- the UIObject created
- the Owner object used to bind the fields

Whereas I want these to be the same object. So can anyone see a
problem with a new method that binds the UI fields to the same object
it just created?

<ui:UiBinder xmlns... >
  <my:MyPanel>
    <g:HTMLPanel>
      <div ui:field="myDiv">Caption Here</div>
    </g:HTMLPanel>
  </my:MyPanel>
</ui:UiBinder>

public class MyPanel extends DecoratorPanel {

  // could create a new interface UiSelfBinder<MyPanel> instead...
  interface Binder extends UiBinder<MyPanel, MyPanel> {}
  private static final Binder binder = GWT.create(Binder.class);

  public static MyPanel create() {
    // create and bind to the same MyPanel instance
    return binder.createAndBindUi();
  }

  @UiField DivElement myDiv;

  MyPanel() {
    //  provided at package visibility for the binder
  }

}

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to