title: display open nodes in a GWT Tree
body: <p>I create a GWT Tree, and I would like it to be initially displayed with open nodes. Let's take the standard <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/Tree.html" rel="nofollow">Tree example from GWT javadocs</a>:</p>
  
  <pre><code>public class TreeExample implements EntryPoint {
  
    public void onModuleLoad() {
      // Create a tree with a few items in it.
      TreeItem root = new TreeItem("root");
      root.addItem("item0");
      root.addItem("item1");
      root.addItem("item2");
  
      // Add a CheckBox to the tree
      TreeItem item = new TreeItem(new CheckBox("item3"));
      root.addItem(item);
  
      Tree t = new Tree();
      t.addItem(root);
  
      // Add it to the root panel.
      RootPanel.get().add(t);
    }
  }
  </code></pre>
  
  <p>I want it initially displayed as:</p>
  
  <pre>
  root
    item0
    item1
    item2
    item3
  </pre>
  
  <p>Now, I thought that it was as simple as setting the state of the <code>TreeItem</code> that I want to be opened by calling <code>setState(true)</code>: <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/TreeItem.html#setState%28boolean%29" rel="nofollow">javadoc</a> for <code>setState</code> says "Sets whether this item's children are displayed". However, if I add for example</p>
  
  <pre><code>root.setState(true);
  </code></pre>
  
  <p>to the above example, I don't get the expected effect. Apparently nothing changes when I do <code>root.setState(true);</code> or <code>root.setState(false);</code>: the tree is always displayed with its nodes closed.</p>
  
  <p>How do I get the desired behaviour?</p>