/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.TreeNode; /* */ import java.io.PrintStream; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class PropTreeNode /* */ extends TreeNode /* */ { /* */ private Object obj; /* 27 */ private boolean allowSorting = true; /* */ /* */ public PropTreeNode(Object obj) /* */ { /* 31 */ super(null); /* 32 */ this.obj = obj; /* 33 */ assert (obj != null); /* */ } /* */ /* */ public PropTreeNode(Object obj, TreeNode parent) /* */ { /* 38 */ super(parent); /* 39 */ this.obj = obj; /* 40 */ assert (obj != null); /* */ } /* */ /* */ public boolean shouldSort() /* */ { /* 45 */ return this.allowSorting; /* */ } /* */ /* */ public Vector getChildren() /* */ { /* 50 */ Vector ret = null; /* 51 */ Object obj = this.obj; /* 52 */ if ((obj instanceof VectorProperty)) { /* 53 */ VectorProperty vp = (VectorProperty)obj; /* 54 */ this.allowSorting = vp.shouldSort(); /* 55 */ ret = new Vector(); /* */ /* 57 */ Vector v = (Vector)vp.get(); /* 58 */ if (v != null) { /* 59 */ int count = v.size(); /* 60 */ for (int i = 0; i < count; i++) { /* 61 */ Object child = v.elementAt(i); /* 62 */ if (child == null) { /* 63 */ System.out.println("Error: VectorProperty " + /* 64 */ vp.getName() + " of " + /* 65 */ vp.getOwner() + " was null."); /* */ } else { /* 67 */ ret.addElement(new PropTreeNode(child, this)); /* */ } /* */ } /* */ } /* */ } else { /* 72 */ if ((obj instanceof Property)) /* 73 */ obj = ((Property)obj).get(); /* 74 */ if ((obj instanceof Properties)) { /* 75 */ ret = new Vector(); /* 76 */ EnumProperties e = new EnumProperties(obj); /* 77 */ while (e.hasMoreElements()) { /* 78 */ Property p = (Property)e.nextElement(); /* 79 */ if (((p instanceof VectorProperty)) || ( /* 80 */ (p.getEditor() == null) && /* 81 */ ((p.get() instanceof Properties)))) /* 82 */ ret.addElement(new PropTreeNode(p, this)); /* */ } /* */ } /* */ } /* 86 */ return ret; /* */ } /* */ /* */ public Object getObject() /* */ { /* 91 */ return this.obj; /* */ } /* */ /* */ public boolean displayAsTitle() /* */ { /* 96 */ return ((this.obj instanceof VectorProperty)) || ((this.obj instanceof Property)); /* */ } /* */ /* */ public boolean canEdit() /* */ { /* 101 */ return false; /* */ } /* */ /* */ public VectorProperty getContainingVectorProperty() /* */ { /* 106 */ Object obj = this.obj; /* 107 */ TreeNode e = getParent(); /* 108 */ if (((obj instanceof VectorProperty)) || ( /* 109 */ (e != null) && (((obj = e.getObject()) instanceof VectorProperty)))) /* 110 */ return (VectorProperty)obj; /* 111 */ return null; /* */ } /* */ /* */ public PropAdder getAdder() /* */ { /* 116 */ VectorProperty vec = getContainingVectorProperty(); /* 117 */ if (vec != null) /* 118 */ return vec.getAdder(); /* 119 */ return null; /* */ } /* */ /* */ public String getContainerName() /* */ { /* 124 */ return getContainingVectorProperty().getName(); /* */ } /* */ /* */ public boolean canAdd() /* */ { /* 129 */ PropAdder adder = getAdder(); /* 130 */ return (adder != null) && (adder.hasAddDialog()); /* */ } /* */ /* */ /* */ public boolean canDelete() /* */ { /* 136 */ TreeNode e = getParent(); /* 137 */ Object obj; return (e != null) && ( /* 138 */ ((((obj = e.getObject()) instanceof VectorProperty)) && /* 139 */ (((VectorProperty)obj).getAdder() != null)) || ( /* 140 */ (((obj = getObject()) instanceof Property)) && /* 141 */ (((Property)obj).canSetNull()) && /* 142 */ (((Property)obj).get() != null))); /* */ } /* */ /* */ public Undoable delete(boolean isCut) /* */ { /* 147 */ assert (canDelete()); /* 148 */ Object o = getParent().getObject(); /* 149 */ if ((o instanceof VectorProperty)) { /* 150 */ VectorProperty owner = (VectorProperty)o; /* */ /* 152 */ Vector v = (Vector)owner.get(); /* 153 */ int i = v.indexOf(this.obj); /* 154 */ assert (i != -1); /* 155 */ return isCut ? new UndoablCut(owner, i) : /* 156 */ new UndoablDelete(owner, i); /* */ } /* 158 */ return new UndoablSet((Property)getObject(), null); /* */ } /* */ /* */ public String toString() /* */ { /* 163 */ if ((this.obj instanceof SuperRoot)) /* 164 */ return ((SuperRoot)this.obj).getName(); /* 165 */ if ((this.obj instanceof Property)) /* 166 */ return ((Property)this.obj).getName(); /* 167 */ return this.obj.toString(); /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PropTreeNode.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */