summaryrefslogtreecommitdiff
path: root/java/src/IceGridGUI/Application/ListTreeNode.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-05-04 16:15:21 +0000
committerBernard Normier <bernard@zeroc.com>2006-05-04 16:15:21 +0000
commit87ed29e743f1c53e01878259a2c8ba1b352d3933 (patch)
treecf7de9d5ef8ac0362839c6122cad9d5217867e7f /java/src/IceGridGUI/Application/ListTreeNode.java
parentFixed typo. (diff)
downloadice-87ed29e743f1c53e01878259a2c8ba1b352d3933.tar.bz2
ice-87ed29e743f1c53e01878259a2c8ba1b352d3933.tar.xz
ice-87ed29e743f1c53e01878259a2c8ba1b352d3933.zip
Better PropertySets support
Diffstat (limited to 'java/src/IceGridGUI/Application/ListTreeNode.java')
-rwxr-xr-xjava/src/IceGridGUI/Application/ListTreeNode.java69
1 files changed, 6 insertions, 63 deletions
diff --git a/java/src/IceGridGUI/Application/ListTreeNode.java b/java/src/IceGridGUI/Application/ListTreeNode.java
index 7be67779ee1..4b36c3a03a5 100755
--- a/java/src/IceGridGUI/Application/ListTreeNode.java
+++ b/java/src/IceGridGUI/Application/ListTreeNode.java
@@ -120,59 +120,14 @@ abstract class ListTreeNode extends TreeNode
void insertChildren(java.util.List newChildren, boolean fireEvent)
throws UpdateFailedException
{
- TreeNodeBase[] children = (TreeNodeBase[])newChildren.toArray(new TreeNodeBase[0]);
- java.util.Arrays.sort(children, _childComparator);
-
- int[] indices = new int[children.length];
-
- int i = 0;
- boolean checkInsert = true;
- for(int j = 0; j < children.length; ++j)
- {
- String id = children[j].getId();
-
- if(checkInsert)
- {
- while(i < _children.size())
- {
- TreeNodeBase existingChild = (TreeNodeBase)_children.get(i);
- int cmp = id.compareTo(existingChild.getId());
- if(cmp == 0)
- {
- throw new UpdateFailedException(this, id);
- }
- if(cmp < 0)
- {
- break; // while
- }
- i++;
- }
-
- if(i < _children.size())
- {
- // Insert here, and increment i (since children is sorted)
- _children.add(i, children[j]);
- indices[j] = i;
- i++;
- continue; // for
- }
- else
- {
- checkInsert = false;
- }
- }
-
- //
- // Append
- //
- _children.add(children[j]);
- indices[j] = i;
- i++;
- }
+ DefaultTreeModel treeModel = fireEvent ?
+ getRoot().getTreeModel() : null;
- if(fireEvent)
+ String badChildId = insertSortedChildren(newChildren, _children, treeModel);
+
+ if(badChildId != null)
{
- getRoot().getTreeModel().nodesWereInserted(this, indices);
+ throw new UpdateFailedException(this, badChildId);
}
}
@@ -202,18 +157,6 @@ abstract class ListTreeNode extends TreeNode
return _editable;
}
- protected String makeNewChildId(String base)
- {
- String id = base;
- int i = 0;
- while(findChild(id) != null)
- {
- id = base + "-" + (++i);
- }
- return id;
- }
-
-
javax.swing.ComboBoxModel createComboBoxModel()
{
return new ComboBoxModel();