It is ok for the Node interface to have methods to easily access the current component, but expande state etc. really should be stored in the component, and not in the model. The methods in the model should be regarded as shortcuts to access the state in the current component.
This is consistent with the philosophy of MVC: this is view state, and belongs in the component, and not in the model. E.g., also, you could have 2 tree's that show the same treemodel, with different view states.
On 4 Aug 2005, at 22:20, Sean Schofield wrote:
More progress on Tree2. After a lively debate (with myself) I have<x-tad-smaller>Met vriendelijke groeten,
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
Jan Dockx
</x-tad-smaller><x-tad-smaller>
PeopleWare NV - Head Office</x-tad-smaller><x-tad-smaller>
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66 </x-tad-smaller><x-tad-bigger>
</x-tad-bigger><x-tad-smaller>
PeopleWare NV - Branch Office Geel</x-tad-smaller><x-tad-smaller>
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25</x-tad-smaller><x-tad-bigger>
</x-tad-bigger><x-tad-smaller>
http://www.peopleware.be/
</x-tad-smaller><x-tad-smaller>http://www.mobileware.be/</x-tad-smaller>
smime.p7s
Description: S/MIME cryptographic signature

