This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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