summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/PropTreeNode.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/PropTreeNode.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/PropTreeNode.java')
-rw-r--r--NET/worlds/scape/PropTreeNode.java175
1 files changed, 175 insertions, 0 deletions
diff --git a/NET/worlds/scape/PropTreeNode.java b/NET/worlds/scape/PropTreeNode.java
new file mode 100644
index 0000000..fe564f9
--- /dev/null
+++ b/NET/worlds/scape/PropTreeNode.java
@@ -0,0 +1,175 @@
+/* */ 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<PropTreeNode> getChildren()
+/* */ {
+/* 50 */ Vector<PropTreeNode> 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<Object> 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<Object> 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
+ */ \ No newline at end of file