title: How to combine multiple uiBinder-based widgets?
body: <p>I need to insert a [number of] uiBinder-based widgets into another one, at a particular spot.  The inserted widget has a somewhat complicated layout, so I am trying to define it in HTML. </p>
  
  <p>referencePanel.add(...) fails with java.lang.IllegalStateException: This widget's parent does not implement HasWidgets. Don't know which widget's parent it's unhappy about - innerPanel or referencePanel. </p>
  
  <p>If the ReferenceUI object is added to RootPanel, and then it's added to the bottom of the page.  But if it's added to RootPanel first, 
  then there is a JavaScriptException Code 3 (HIERARCHY_REQUEST_ERR) when added to referencePanel. </p>
  
  <p>Any suggestions?  </p>
  
  <pre><code>public class AppUIDemo extends Composite {
      @UiTemplate("AppUIDemo.ui.xml")
      interface AppUIDemoUiBinder extends UiBinder&lt;Widget, AppUIDemo&gt; {
      }
  
      @UiTemplate("ReferenceUI.ui.xml")
      interface ReferenceUIUiBinder extends
              UiBinder&lt;Widget, ReferenceUI&gt; {
      }
  
      private static AppUIDemoUiBinder uiBinder = GWT
              .create(AppUIDemoUiBinder.class);
      private static ReferenceUIUiBinder refUIBinder = GWT
              .create(ReferenceUIUiBinder.class);
  
      @UiField
      FlowPanel referencePanel;
  
      public AppUIDemo() {
              initWidget(uiBinder.createAndBindUi(this));
              ReferenceUI reference = new ReferenceUI(refUIBinder);
  
              HTMLPanel innerPanel = reference.getRefPanel();
              innerPanel.getElement().setId(HTMLPanel.createUniqueId());
              referencePanel.add(innerPanel);
          }
  }
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code>public class ReferenceUI extends Composite {
  
      interface ReferenceUIUiBinder extends
              UiBinder&lt;Widget,ReferenceUI&gt; {
      }
  
      private static ReferenceUIUiBinder uiBinder = GWT
              .create(ReferenceUIUiBinder.class);
  
  
      @UiField
  HTMLPanel refPanel;
  
      public ReferenceUI() {
          initWidget(uiBinder.createAndBindUi(this));
      }
  
      public CreditReferenceUI(final UiBinder&lt;Widget, CreditReferenceUI&gt; binder) {
          initWidget(binder.createAndBindUi(this));
      }
  
      public HTMLPanel getRefPanel() {
          return refPanel;
      }
  }
  </code></pre>
  
  <p>ReferenceUI.ui.xml </p>
  
  <pre><code>&lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt;
  &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
      xmlns:g="urn:import:com.google.gwt.user.client.ui"
      xmlns:gwittir="urn:import:com.totsp.gwittir.client.ui"&gt;
              &lt;g:HTMLPanel ui:field="referencePanel"&gt;
              &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;b&gt;First Name&lt;/b&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;b&gt;Last Name&lt;/b&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;b&gt;Phone&lt;/b&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;b&gt;Fax&lt;/b&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;gwittir:TextBox ui:field="referenceFirstName" styleName="input"/&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;gwittir:TextBox ui:field="referenceLastName" styleName="input"/&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;table&gt;&lt;tr&gt;
              &lt;td&gt; ( &lt;/td&gt; &lt;td&gt;
                  &lt;gwittir:TextBox ui:field="referencePhoneAreaCode" styleName="input" maxLength="3"/&gt;&lt;/td&gt;
                  &lt;td&gt; ) &lt;/td&gt; &lt;td&gt;
                  &lt;gwittir:TextBox ui:field="referencePhoneNumber" styleName="input" maxLength="7"/&gt;&lt;/td&gt;
              &lt;td&gt; # &lt;/td&gt; &lt;td&gt;
                  &lt;gwittir:TextBox ui:field="referencePhoneExtension" styleName="input" maxLength="25"/&gt;&lt;/td&gt;
          &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
                  &lt;td&gt;
                       &lt;table&gt;&lt;tr&gt;
              &lt;td&gt; ( &lt;/td&gt; &lt;td&gt;
                  &lt;gwittir:TextBox ui:field="referenceFaxAreaCode" styleName="input" maxLength="3"/&gt;&lt;/td&gt;
                  &lt;td&gt; ) &lt;/td&gt; &lt;td&gt;
                  &lt;gwittir:TextBox ui:field="referenceFaxNumber" styleName="input" maxLength="7"/&gt;&lt;/td&gt;
          &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td style="text-align:right"&gt;
                      &lt;b&gt;Address: &lt;/b&gt; Street&lt;/td&gt;
                  &lt;td&gt;
                      &lt;gwittir:TextBox ui:field="referenceStreet" styleName="input"/&gt;&lt;/td&gt;
                  &lt;td colspan="2" style="width:50%"&gt;
                      &lt;table&gt;&lt;tr&gt;&lt;td&gt;   City&lt;/td&gt;
                      &lt;td&gt;&lt;gwittir:TextBox ui:field="referenceCity" styleName="input" maxLength="25"/&gt;&lt;/td&gt;
                      &lt;td&gt; State &lt;/td&gt;
                      &lt;td class="state"&gt;&lt;gwittir:TextBox ui:field="referenceState" styleName="input" maxLength="2"/&gt;&lt;/td&gt;
                      &lt;td&gt; ZIP&lt;/td&gt;
                      &lt;td&gt;&lt;gwittir:TextBox ui:field="referenceZIP" styleName="input" maxLength="9"/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/g:HTMLPanel&gt;
  &lt;/ui:UiBinder&gt;
  </code></pre>
  
  <p>AppUIDemo.ui.xml</p>
  
  <pre><code>&lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt;
  &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
      xmlns:g="urn:import:com.google.gwt.user.client.ui"
      xmlns:gwittir="urn:import:com.totsp.gwittir.client.ui"&gt;
      &lt;g:HTMLPanel ui:field="basePanel"&gt;
          &lt;!--  &lt;div id="MainContent"&gt;  --&gt;
          &lt;p&gt;&lt;h2&gt;&lt;b&gt;Application Demo&lt;/b&gt;&lt;/h2&gt;&lt;/p&gt;
  
          &lt;g:FlowPanel ui:field="referencePanel"&gt;
          &lt;/g:FlowPanel&gt;
      &lt;/g:HTMLPanel&gt;
  &lt;/ui:UiBinder&gt;
  </code></pre>