Nop.Lists@gmail.com wrote in news:9bcf6229-6519-4b06-9e05-06925c6c7189
@e23g2000prf.googlegroups.com:
> G'day,
> I would be very grateful for insights considering modeling a JTree.
[quoted text clipped - 24 lines]
> Thank you very much for your insights!
> nop.lists
Hi,
1) I would definitely write a custom TreeModel and not
extend or use DefaultTreeModel.
2) I would consider the possibility to NOT define ALL
operations in that model, but, in certain cases, to
have the nodel listen to events fired from the domain
itself. (For File objects I can't think instantly of
an example of a possible event, but other domains may have).
As a sample, you might have a look at my abstract tree model
http://www.pbjar.org/docs/src/org/pbjar/swing/AbstractTreeModel.java
And an implementation for DOM trees
http://www.pbjar.org/docs/src/org/pbjar/dom/DOMTreeModel.java
Hope this helps
Piet