|
@@ -31,8 +31,8 @@ import java.awt.Window;
|
31
|
31
|
import java.awt.event.ActionEvent;
|
32
|
32
|
import java.awt.event.ActionListener;
|
33
|
33
|
import java.util.Enumeration;
|
34
|
|
-import javax.swing.JButton;
|
35
|
34
|
|
|
35
|
+import javax.swing.JButton;
|
36
|
36
|
import javax.swing.JComponent;
|
37
|
37
|
import javax.swing.JPanel;
|
38
|
38
|
import javax.swing.JScrollPane;
|
|
@@ -74,6 +74,7 @@ public class Tree extends JPanel implements TreeSelectionListener,
|
74
|
74
|
* Instantiates a new tree of server groups.
|
75
|
75
|
*
|
76
|
76
|
* @param model Model backing this tree
|
|
77
|
+ * @param parentWindow Dialog's parent window
|
77
|
78
|
*/
|
78
|
79
|
public Tree(final ServerListModel model, final Window parentWindow) {
|
79
|
80
|
super();
|
|
@@ -106,7 +107,8 @@ public class Tree extends JPanel implements TreeSelectionListener,
|
106
|
107
|
items.putClientProperty("JTree.lineStyle", "Angled");
|
107
|
108
|
items.getInputMap().setParent(null);
|
108
|
109
|
items.getInputMap(JComponent.WHEN_FOCUSED).clear();
|
109
|
|
- items.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).clear();
|
|
110
|
+ items.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
|
|
111
|
+ .clear();
|
110
|
112
|
items.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).clear();
|
111
|
113
|
items.getSelectionModel().setSelectionMode(
|
112
|
114
|
TreeSelectionModel.SINGLE_TREE_SELECTION);
|
|
@@ -195,15 +197,16 @@ public class Tree extends JPanel implements TreeSelectionListener,
|
195
|
197
|
}
|
196
|
198
|
|
197
|
199
|
/**
|
198
|
|
- * Find the node for a specified server group item, will return null if the
|
199
|
|
- * group is not found.
|
|
200
|
+ * Find the node for a specified server group item, will return root node
|
|
201
|
+ * if the group isn't found.
|
200
|
202
|
*
|
201
|
203
|
* @param item Item to search for in the tree
|
202
|
204
|
*
|
203
|
205
|
* @return Node for group, or null if not found
|
204
|
206
|
*/
|
205
|
207
|
private DefaultMutableTreeNode getNodeForGroup(final ServerGroupItem item) {
|
206
|
|
- DefaultMutableTreeNode node = null;
|
|
208
|
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) items.getModel()
|
|
209
|
+ .getRoot();
|
207
|
210
|
final Enumeration enumeration = ((DefaultMutableTreeNode) items
|
208
|
211
|
.getModel().getRoot()).breadthFirstEnumeration();
|
209
|
212
|
while (enumeration.hasMoreElements()) {
|