More progress on Tree2.  After a lively debate (with myself) I have
decided (for the moment) to require and instance of TreeModel for
@value.  This will break current JSP pages using tree2 so I suggest
tree2 users follow this thread closely.  You have been warned!

The advantage of maintaining the expanded state in the TreeModel
outweigh the minor hassle of adding a TreeModel foo = new
TreeModelBase(oldFoo) to your code to get it to work.  (Note: oldFoo
would be the root TreeNode that was previously used for @value.)

Given the likely dynamic nature of the data underlying the model, this
new approach makes sense.  If a node is added (or dropped) in the
model, the expanded state (and eventually selected state) can also be
modified accordingly.  The HtmlTree is absolved of all responsibility
in this area so if your expanded state is wrong, it will be the user's
fault.  Now users can specify the expanded state in their own
implementation of TreeModel.  I've also added a setExpandAll method to
TreeModelBase so that you can specify all of the nodes to start off
expanded.  So no more talk of tree3 please :-)

Feedback is welcome.  I'm checking in the code momentarily.

Regards,

sean

Reply via email to