> Maybe I try to implement such a feature. But I will need to know more about
> the state and statesaving of the tree. 
> At the moment the model seems not to get saved by UITreeData.  

What do you mean by not getting saved?  If you mean its not saved as
part of the state, you are correct.  TreeModel is serving as a wrapper
for the data which is stored in TreeNodes.  Its kind of like a facade
to the data - helps the user to "walk" the hiearchy of the data.

> And what is
> the method getNode() in UITreeData and TreeModel for? 

The getNode method in UITreeData is return the "curent" node.  It
essentially pass the call to getNode in TreeModel.  Its used by the
renderer to determine the current node and render it.

> I wonder why the state of the node is not saved with the node itself. That
> would make it very easy to expand or collapse a node, as the whole tree of 
> TreeNodes is saved with the component state anyway. 

Its been a while since I looked at this aspect of tree2.  I can't
remember why the TreeNodes are saved with the component state.  I'm
not sure that we really want this behavior.  Since the value attribute
is a method binding, I'm thinking we should only be saving the
expression (not the actual tree nodes.)  I will look into this
further.

I debated storing the expand/collapse state with the nodes themselves
(I believe that is how its done in the original tree.)  My thinking
was to keep TreeNode as a pure representation of the data. 
Expand/collapse is really an HTML or rendering concept so the thinking
was to handle that in HtmlTree.

This is actually one of the major decisions that needs to reconsidered
when talking about supplying your own TreeModel.  If we move the
expand/collaps to TreeNode then this requires that all TreeNodes be
persisted (in order to preserve the expand/collapse state.)  While
that might be happening now, that was not my intent.  For large
server-side expansion solutions (with 3000+ nodes, you don't
necessarily want to preserve the entire set of nodes just because 3 of
them are "open.")

> As I browsed through the code I found a "private boolean expanded" in
> TreeNodeBase. Did you planned such a feature there? 

I went back and forth on the feature.  This was just left over code
that should have been removed.

I definitely welcome another critical review of some of the design
decisions that went into tree2 so if you are willing to do your share
of the work, I am willing to work with you on it.  I don't have a real
life use case for 3000+ nodes, so your insight (and anyone else's)
into how a user-supplied tree model would work would be helpful.

Regards,

sean

Reply via email to