aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTree problem (Pushing MVC?) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree problem (Pushing MVC?)" Watch "JTree problem (Pushing MVC?)" New topic
Author

JTree problem (Pushing MVC?)

Kevin Jaffe
Greenhorn

Joined: Jun 07, 2001
Posts: 15
We have some data that, after long debate in our group, we have
decided to represent using a JTree (i.e. this choice is a hard
constraint on further design).
The nodes of this tree fall into disjoint sets, each set consisting of
up to about 10 elements. For any node in the tree, the other nodes
that belong to the same set can be dispersed widely all over the tree.
The problem is to modify the functionality of JTree so that
selecting/deselecting one node automatically selects/deselects all the
nodes in the same set.
What's the best way to modify this behavior? Where does the code
responsible for highlighting selected nodes reside?
Thanks,
KJ
Peter Deschamps
Greenhorn

Joined: Aug 04, 2001
Posts: 5
Hi,
I have a similar issue where if a user double clicks on a child node and the UserObject indicates it is of a cetain type (i.e. GOTO type node), then the user "jumps" to the node indicated and expands it accordingly. Extended one step further, if the user right clicks and selects the popup menutiem, "Show cross references", the tree automatically displays and highlights the selected nodes of this "set" ie xref.
I think based on reading some message threads that a Hashmap method which crossrefs node objects with node string keys might make sense. I resisted the hashmap idea early on in my JTree endeavors only because I figured that the JTree already had node objects and I was safer scanning and searching the JTree than to trust that my hashmap was perfectly identically to the JTree. I am not a hash expert and didn't want two duplicate structures of 1000 nodes (the Jtree and the hashmap). Saying all that, it still doesn't make sense to me to scan and rescan a JTree of 1000 nodes linearly and creating the hash should be super fast. comments?
Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree problem (Pushing MVC?)