The reason I am looking into this is because I want a tree that I can
dynamically fill out based on which item the user clicks on. I do not
want to return the entire tree. I've looked at both onTreeItemSelected
and onTreeItemStateChanged. "onTreeItemStateChanged" seems, so far, to
be the most logical place. However, with onTreeItemStateChanged firing
twice, its kind of hard to manage.
My solution is derived from the KitchenSink tree example. When I create
a new TreeItem, immediately addItem of class PendingItem (extends
TreeItem). Then in method onTreeItemStateChanged:
if (TreeItem.getChild(0) instanceof PendingItem) {
<remove child(0)>
<get child items>
}
The second onTreeItemStateChanged will then skip item retrieval because
the PendingItem is gone.
item.setState(!item.getState(), false);
joel.