Affects Version/s: None
Fix Version/s: 1.1.2
Environment:Tomcat 4.1.31, SDK 1.4.2, windows XP Pro
We are using the tree2 component in a situation where nodes can be dynamically added, deleted and re-parented.
The tree can also be completely re-populated with a different version of data.
We have also simulated multiple node selection, by placing a checkbox
next to certain nodes. Clicking a button then causes bulk-deletion of all ticked nodes.
We were using the myfaces 1.0.9 version in this way:
The backing bean is in Session Scope; treeData was a TreeNode.
All this was basically working, with the exception of a refresh problem after a re-population (reported in
and a problem whereby you had to click twice to expand the root node when the page first displayed.
We want to migrate to the nightly builds, in which these two issues are fixed (thanks!)
But we hit problems with the new TreeState: (using nightly build of 11-Sep-05)
1. When moving to another page and then coming back, the tree is always collapsed.
2. When re-populating the tree with a different data set, OR
3. When deleting or reparenting a node, often this kind of error (eventually) occurs:
Encountered a node [0:4] + with an illogical state.
Node is expanded but it is also considered a leaf (a leaf cannot be considered expanded.
By reading thru the various postings and forums I have fixed:
1 by creating our own TreeModel and value-binding to that (rather than a TreeNode)
(Incidentally, adding a component-binding, ie <t:tree2 binding="#
also fixed the problem without using our own TreeModel)
2 by setting the Transient property of our TreeModel's TreeState to True
(which I understand is OK since our backing bean is session-scoped)
But I can't figure out 3.
How can you fix up the TreeState after programatically causing nodes to change positions or disappear,
since the TreeState maintains its node expansion knowledge via a Hashmap keyed on positional node ids
As a work-around I've thought of collapsing any node (and its subnodes) before trying to delete or move it, or even
collapsing the whole tree, but I can't work out how....
UITreeData only gives you the nodeId of the 'current' node, so I don't understand how you get at
nodeIds of arbitrary nodes to feed to the new collapsePath() method.
(Incidentally, maybe a collapseAll() method might be useful to have as well as expandAll()?)
Thanks for any help, and please set me straight if I've misunderstood anything about the changes made to tree2 along the way!