1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
package NET.worlds.scape;
import NET.worlds.core.Std;
import java.util.Enumeration;
import java.util.Vector;
abstract class ObjectSelectorDialog extends ListAdderDialog {
private Property property;
private Vector objectVector = null;
SuperRoot root = null;
Class clas = null;
ObjectSelectorDialog(EditTile parent, String title, Property property, SuperRoot r, Class clas) {
super(parent, title);
this.property = property;
this.root = r;
this.clas = clas;
this.ready();
}
private void quicksort(String[] objectList, int l, int r) {
if (r > l) {
String v = objectList[r];
int i = l - 1;
int j = r;
String tstr;
Object tobj;
do {
while (objectList[++i].compareTo(v) < 0) {
}
do {
j--;
} while (j > l && objectList[j].compareTo(v) > 0);
tstr = objectList[i];
objectList[i] = objectList[j];
objectList[j] = tstr;
tobj = this.objectVector.elementAt(i);
this.objectVector.setElementAt(this.objectVector.elementAt(j), i);
this.objectVector.setElementAt(tobj, j);
} while (j > i);
objectList[j] = objectList[i];
objectList[i] = objectList[r];
objectList[r] = tstr;
this.objectVector.setElementAt(this.objectVector.elementAt(i), j);
this.objectVector.setElementAt(this.objectVector.elementAt(r), i);
this.objectVector.setElementAt(tobj, r);
this.quicksort(objectList, l, i - 1);
this.quicksort(objectList, i + 1, r);
}
}
@Override
protected void build() {
this.objectVector = new Vector();
if (this.root != null) {
Enumeration e = this.root.getDeepOwned();
while (e.hasMoreElements()) {
Object obj = e.nextElement();
if (Std.instanceOf(obj, this.clas)) {
this.objectVector.addElement(obj);
}
}
String[] objectList = new String[this.objectVector.size()];
for (int i = 0; i < objectList.length; i++) {
objectList[i] = this.objectVector.elementAt(i).toString();
}
this.quicksort(objectList, 0, objectList.length - 1);
this.setListContents(objectList);
}
super.build();
}
protected abstract void addIt(Property var1, Object var2);
@Override
protected void add(int option) {
Object obj = this.objectVector.elementAt(option);
if (obj != null) {
this.addIt(this.property, obj);
}
}
}
|