Lines 934-940
Link Here
|
934 |
rowComparator = new Comparator() { |
934 |
rowComparator = new Comparator() { |
935 |
public int compare(Object o1, Object o2) { |
935 |
public int compare(Object o1, Object o2) { |
936 |
if (o1 == o2) |
936 |
if (o1 == o2) |
937 |
return -1; |
937 |
return 0; |
938 |
|
938 |
|
939 |
Node n1 = ((VisualizerNode) o1).node; |
939 |
Node n1 = ((VisualizerNode) o1).node; |
940 |
Node n2 = ((VisualizerNode) o2).node; |
940 |
Node n2 = ((VisualizerNode) o2).node; |
Lines 1025-1030
Link Here
|
1025 |
} |
1025 |
} |
1026 |
return ""; // NOI18N |
1026 |
return ""; // NOI18N |
1027 |
} |
1027 |
} |
|
|
1028 |
|
1029 |
// override mothod from DefaultTreeModel |
1030 |
public void nodesWereInserted (TreeNode node, int[] childIndices) { |
1031 |
super.nodesWereInserted (node, tranformIndices (node, childIndices)); |
1032 |
} |
1033 |
|
1034 |
// public void nodesWereRemoved(TreeNode node, int[] childIndices, Object[] removedChildren) { |
1035 |
// System.out.println("### nodesWereRemoved"); |
1036 |
// super.nodesWereRemoved (node, tranformIndices (node, childIndices), removedChildren); |
1037 |
// } |
1038 |
|
1039 |
public void nodesChanged(TreeNode node, int[] childIndices) { |
1040 |
if (childIndices == null || childIndices.length == 0) return ; |
1041 |
int[] newIndices = tranformIndices (node, childIndices); |
1042 |
java.util.Arrays.sort (newIndices); |
1043 |
int min = Math.min (childIndices[0], newIndices[0]); |
1044 |
int max = Math.max (childIndices[childIndices.length - 1], newIndices[newIndices.length - 1]); |
1045 |
for (int i = min; i <= max; i++) super.nodesChanged (node, new int[] {i}); |
1046 |
} |
1047 |
|
1048 |
// bugfix #30150, helper method tranforms the original child indices by actually sorting |
1049 |
private int[] tranformIndices (TreeNode parent, int[] original) { |
1050 |
if (parent == null || !(parent instanceof VisualizerNode)) { |
1051 |
// XXX |
1052 |
return original; |
1053 |
} |
1054 |
if (original == null || original.length == 0) { |
1055 |
return original; |
1056 |
} |
1057 |
int[] tranformed = (int[])original.clone (); |
1058 |
if (sortingActive ()) { |
1059 |
java.util.List list = ((VisualizerNode)parent).getChildren (); |
1060 |
for (int i = 0; i < original.length; i++) { |
1061 |
tranformed[i] = getIndexOfChild (parent, list.get (original[i])); |
1062 |
} |
1063 |
} |
1064 |
return tranformed; |
1065 |
} |
1066 |
|
1028 |
} |
1067 |
} |
1029 |
|
1068 |
|
1030 |
/* Cell renderer for sorting column header. |
1069 |
/* Cell renderer for sorting column header. |