title: Replace GWT DockLayoutPanel Contents
body: <p>I'm trying to replace the contents of the CENTER portion of a DockLayoutPanel from a MenuBar. The MenuBar will sit at the North, but "content" (forms, reports, etc) will reside in Center. </p>
  
  <p>I thought I could do it by grabbing the entire DockLayoutPanel from the RootPanel (index 0, since that's the only widget directly attached to it), then somehow remove the current contents of center and insert the new. Unfortunately, getWidget(int index) is non-static, so it's not working.</p>
  
  <p>Can anyone how me with the right way to do this? Non-working code is below:</p>
  
  <pre><code>// snipped package and import details
  
  public class menubar extends Composite {
  
  private static menubarUiBinder uiBinder = GWT.create(menubarUiBinder.class);
  
  interface menubarUiBinder extends UiBinder&lt;Widget, menubar&gt; {
  }
  
  @UiField MenuBar applicationMenuBar;
  @UiField MenuBar processMenuBar;
  @UiField MenuBar reportsMenuBar;
  @UiField MenuItem addPowerRequirementCmd;
  @UiField MenuItem powerUsageReportCmd;
  
  public menubar() {
      initWidget(uiBinder.createAndBindUi(this));
  
      // command to replace whatever is in DockLayoutPanel.CENTER w/ AddPowerRequirement
      // FormPanel
      addPowerRequirementCmd.setCommand(new Command() {
  
          @Override
          public void execute() {
  
              // get DockLayoutPanel from the RootPanel (it's the only widget, should be
              // index 0
              DockLayoutPanel dlp = (DockLayoutPanel) RootPanel.getWidget(0);
  
              // clear out DockLayoutPanel.CENTER
  
              // insert the FormLayoutPanel into DockLayoutPanel.CENTER
              dlp.add(new PowerRequirementForm());
          }
      });
  
      // command to replace whatever is in DockLayoutPanel.CENTER w/ power usage report
      powerUsageReportCmd.setCommand(new Command() {
  
          @Override
          public void execute() {
  
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks!</p>