I checked in an experimental update of Tree2 last night.  I added a
TreeModel interface so that users can provide their own TreeModels. 
The idea is that the toggleExpanded and isNodeExpanded methods would
also become part of this interface.  This would give users more
control over node expansion without having to subclass tree2.

My plan was to not force the user to provide a TreeModel.  In other
words, existing examples, etc. work fine.  If the user provide
TreeNode instead of TreeModel (like the examples do) we create a
TreeModelBase out of this data (latest source code does just this.)

The problem starts when you want to keep track of the expanded state
inside the TreeModel now.  Currently the code dumps the _model
variable whenever processDecodes occurs.  This causes the state
information to be lost because a new TreeModelBase is created from the
TreeNode passed in through the value binding.  Since the TreeNode data
does not know the expanded states, the information is lost.

If we forced @value to be a TreeModel instead of allowing TreeNode
this might solve some problems.  The TreeModel could then come from a
*session* scoped backing bean and the information should be preserved.
 This change (while trivial) would break backwards compatability.

I've made changes since the last checkin in an attempt to get the
expanded stuff into the model (as I've described in this message.) 
I'm attaching a patch b/c I don't want to check it in.  If you want
you can apply the patch to the latest source code so we're all on the
same page with the discussion.

TIA,

sean

Attachment: tree2.patch
Description: Binary data

Reply via email to