Thanks for the reply Thomas.

Perhaps what I'm doing is premature optimisation.

I'm trying to make my widget simpler, by not using a composite. What I
have looks like this:

Foo.java:

class Foo extends ComplexPanel {
  ...ui binder boilerplate...
  @UiField
  Element childLocation;
  public Foo() {
      setElement(ui.createAndBindUi(this));
  }

  @Override
  public void add(Widget child) {
       // record the child widget for attachment during onLoad()
       this.child = child;
  }
  @Override
  protected void onLoad() {
        addAndReplaceElement(child,
childLocation.<com.google.gwt.user.client.Element>cast());
  }
  private void addAndReplaceElement(Widget widget,
com.google.gwt.user.client.Element toReplace) {
  ... copied from HTMLPanel ...
  }
}

Foo.ui.xml:

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

<div>
    ...plain html...
        <span ui:field="childLocation"/>
    ...more html...
</div>

</ui:UiBinder>

So my template is simpler than a Composite would be.

-- 
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