diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/ObjectSelectorDialog.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/scape/ObjectSelectorDialog.java')
| -rw-r--r-- | NET/worlds/scape/ObjectSelectorDialog.java | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/NET/worlds/scape/ObjectSelectorDialog.java b/NET/worlds/scape/ObjectSelectorDialog.java new file mode 100644 index 0000000..20b203c --- /dev/null +++ b/NET/worlds/scape/ObjectSelectorDialog.java @@ -0,0 +1,152 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import NET.worlds.core.Std; +/* */ import java.util.Enumeration; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ abstract class ObjectSelectorDialog +/* */ extends ListAdderDialog +/* */ { +/* */ private static final long serialVersionUID = 1L; +/* */ private Property property; +/* 31 */ private Vector<Object> objectVector = null; +/* 32 */ SuperRoot root = null; +/* 33 */ Class<?> clas = null; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ ObjectSelectorDialog(EditTile parent, String title, Property property, SuperRoot r, Class<?> clas) +/* */ { +/* 42 */ super(parent, title); +/* 43 */ this.property = property; +/* 44 */ this.root = r; +/* 45 */ this.clas = clas; +/* 46 */ ready(); +/* */ } +/* */ +/* */ private void quicksort(String[] objectList, int l, int r) +/* */ { +/* 51 */ if (r > l) { +/* 52 */ String v = objectList[r]; +/* */ +/* */ +/* 55 */ int i = l - 1; +/* 56 */ int j = r; +/* */ String tstr; +/* */ Object tobj; +/* */ do { +/* */ do { +/* 61 */ i++; } while (objectList[i].compareTo(v) < 0); +/* */ do { +/* 63 */ j--; } while ((j > l) && (objectList[j].compareTo(v) > 0)); +/* */ +/* */ +/* */ +/* 67 */ tstr = objectList[i]; +/* 68 */ objectList[i] = objectList[j]; +/* 69 */ objectList[j] = tstr; +/* */ +/* 71 */ tobj = this.objectVector.elementAt(i); +/* 72 */ this.objectVector.setElementAt(this.objectVector.elementAt(j), i); +/* 73 */ this.objectVector.setElementAt(tobj, j); +/* 60 */ } while ( +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 74 */ j > i); +/* */ +/* */ +/* 77 */ objectList[j] = objectList[i]; +/* 78 */ objectList[i] = objectList[r]; +/* 79 */ objectList[r] = tstr; +/* 80 */ this.objectVector.setElementAt(this.objectVector.elementAt(i), j); +/* 81 */ this.objectVector.setElementAt(this.objectVector.elementAt(r), i); +/* 82 */ this.objectVector.setElementAt(tobj, r); +/* 83 */ quicksort(objectList, l, i - 1); +/* 84 */ quicksort(objectList, i + 1, r); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ protected void build() +/* */ { +/* 94 */ this.objectVector = new Vector(); +/* 95 */ if (this.root != null) { +/* 96 */ for (Enumeration<?> e = this.root.getDeepOwned(); e.hasMoreElements();) +/* */ { +/* 98 */ Object obj = e.nextElement(); +/* 99 */ if (Std.instanceOf(obj, this.clas)) { +/* 100 */ this.objectVector.addElement(obj); +/* */ } +/* */ } +/* */ +/* 104 */ String[] objectList = new String[this.objectVector.size()]; +/* 105 */ for (int i = 0; i < objectList.length; i++) { +/* 106 */ objectList[i] = this.objectVector.elementAt(i).toString(); +/* */ } +/* */ +/* 109 */ quicksort(objectList, 0, objectList.length - 1); +/* */ +/* */ +/* 112 */ setListContents(objectList); +/* */ } +/* 114 */ super.build(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ protected abstract void addIt(Property paramProperty, Object paramObject); +/* */ +/* */ +/* */ +/* */ +/* */ protected void add(int option) +/* */ { +/* 127 */ Object obj = this.objectVector.elementAt(option); +/* 128 */ if (obj != null) { +/* 129 */ addIt(this.property, obj); +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\ObjectSelectorDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |