Such a feature has been requested earlier on this list.  I think this
would require a major change to tree2 but such a change has been
cotemplated for some time now.

The change would be to make TreeModel an interface and take the code
in the current TreeModel class and rename it DefaultTreeModel. 
Existing code would work fine (if you don't supply a model the new
"default" one is used) but users would have the option of implementing
their own (more complex) models.

Its been argued that such a change would make it easier for the user
to build a "dynamic" (server-side) tree b/c they would not have to
explicitly create and nest all of TreeNode data ahead of time.  I
haven't thought through exactly how this would work (as its not my
idea) but I think it would involve creating TreeNode wrappers for data
on-the-fly, as it was requested.

If anyone is interested in taking the lead on this, please let me
know.  Its not really an itch that I need to scratch for myself so I'm
not in a big hurry to do the work.  There are a few important issues
that would have to be resolved first but I will save that discussion
until there are people who are prepared to contribute some code to
address this.

Your specific request might be handled in this overall change.  Right
now HtmlTree takes care of the check using isNodeExpanded but this
functionality might be something that could be moved to the model.

One workaround would be for you to subclass HtmlTree and add an
attribute for a single node to be expanded by default (assuming you
only need a single node expanded.)  Then you could "discover" the full
path of that node and update the _expandedNodes Map to include these
nodes.

sean


On 5/23/05, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>  
> Hi, 
>  
> I wonder if it is possible to modify the state (collapse/expand) of the
> tree2 on the server. I want to expand the tree down to a node (to help the
> user locating the specific node). As far as I can see, the component does
> not provide methods for this. You can check if the node was expanded by the
> user, but you can't expand or collapse a node by code explicitly. 
>  
> This would be an important feature for me. 
> Any suggestions?

Reply via email to