- Timestamp:
- 2003-06-11T13:39:48+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/TreeSynchronizer.java
r4364 r4555 35 35 import javax.swing.tree.TreePath; 36 36 import org.greenstone.gatherer.gui.tree.DragTree; 37 /** My latest diabolical class synchronizes the expansion state of two or more JTrees. Muh-hahahaha. Note that these tree should be based on the same model. 37 /** My latest diabolical class synchronizes the expansion state of two or more JTrees. Muh-hahahaha. Note that these tree should be based on the same model. If they aren't it won't work. So there. 38 38 * @author John Thompson, Greenstone Digital Library, University of Waikato 39 39 * @version 2.1 … … 52 52 super.add(tree); 53 53 tree.addTreeExpansionListener(this); 54 //tree.addTreeSelectionListener(this);54 tree.addTreeSelectionListener(this); 55 55 } 56 56 … … 86 86 if(!ignore) { 87 87 ignore = true; 88 88 // Expand that path in all registered trees. 89 89 JTree tree = (JTree)event.getSource(); 90 90 TreePath path = event.getPath(); … … 104 104 if(!ignore) { 105 105 ignore = true; 106 106 // Recover the tree that is the source. 107 107 JTree tree = (JTree) event.getSource(); 108 109 108 // Brute Force approach. 109 // Extract the currently selected paths. 110 110 TreePath paths[] = tree.getSelectionPaths(); 111 // Then for every registered tree, that isn't this one, ensure those paths are selected. 111 // Then for every registered tree, that isn't this one, ensure those paths are selected. 112 /* 112 113 for(int i = size(); paths != null && i != 0; i--) { 113 114 JTree sibling = (JTree) get(i - 1); … … 128 129 } 129 130 } 130 // Pass on message to all listeners. 131 */ 132 // Pass on message to all listeners. 131 133 for(int i = 0; i < selection_listeners.size(); i++) { 132 134 ((TreeSelectionListener) selection_listeners.get(i)).valueChanged(event);
Note:
See TracChangeset
for help on using the changeset viewer.