I'd like to set the initial expanded state in my tree such that only the
top-level root node is expanded. In my case, there is only one root
node and it may have one or more child nodes.
I thought the following would do it, but the second call to getKeySet()
on the PathSet object returns null:
// Collapse all nodes
CoreTree tree = getTree();
tree.getTreeState().getKeySet().clear();
// Add the first (top-level) node to the current path
ArrayList<String> path = new ArrayList<String>();
path.add(new String("0"));
tree.getTreeState().getKeySet().add(path);
What is wrong with this technique?
Thanks in advance,
Shawn Bertrand
Tyco Electronics