• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTree problem (Pushing MVC?)

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic