blob: fe564f914ea07c1c7117a234d644df91dd761d39 (
plain) (
blame)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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
*/
|