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
|
/* */ package NET.worlds.console;
/* */
/* */ import NET.worlds.scape.Action;
/* */ import NET.worlds.scape.EditTile;
/* */ import NET.worlds.scape.RunningActionHandler;
/* */ import NET.worlds.scape.WObject;
/* */ import java.util.Enumeration;
/* */ import java.util.Hashtable;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class RightMenu
/* */ implements MainCallback
/* */ {
/* 26 */ private static RightMenu _current = null;
/* */
/* */
/* */
/* */ private WObject _obj;
/* */
/* */
/* */ private Enumeration<Action> _acts;
/* */
/* */
/* 36 */ private Hashtable<Integer, Action> _inttobuttons = new Hashtable();
/* */
/* 38 */ private int _edit = 0;
/* */
/* */
/* 41 */ private int _pm = 0;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public RightMenu(WObject obj, Enumeration<Action> acts)
/* */ {
/* 51 */ this._obj = obj;
/* 52 */ this._acts = acts;
/* 53 */ Main.register(this);
/* */ }
/* */
/* 56 */ private int _lastID = 0;
/* */
/* */ private int add(String label) {
/* 59 */ if (this._lastID == 0) {
/* 60 */ this._lastID = 100;
/* */ }
/* 62 */ int id = this._lastID++;
/* 63 */ assert (this._lastID < 200);
/* */
/* 65 */ nativeAdd(label, id, this._pm);
/* 66 */ return id;
/* */ }
/* */
/* */
/* */
/* */ private static native int create();
/* */
/* */
/* */ private static native void nativeAdd(String paramString, int paramInt1, int paramInt2);
/* */
/* */
/* */ private static native void addSeparator(int paramInt);
/* */
/* */
/* */ private static native void show(int paramInt1, int paramInt2);
/* */
/* */
/* */ private static native void discard(int paramInt);
/* */
/* */
/* */ private static native int checkPressed();
/* */
/* */
/* */ private void build(Enumeration<Action> acts)
/* */ {
/* 91 */ if (_current != null) {
/* 92 */ _current.close();
/* */ }
/* 94 */ _current = this;
/* 95 */ int rows = 0;
/* 96 */ Hashtable<String, Action> buttons = new Hashtable();
/* 97 */ while (acts.hasMoreElements()) {
/* 98 */ Action act = (Action)acts.nextElement();
/* 99 */ String label = act.rightMenuLabel;
/* 100 */ if ((label != null) && (label != "")) {
/* 101 */ buttons.put(label, act);
/* 102 */ rows++;
/* */ }
/* */ }
/* 105 */ if ((rows > 0) || (Gamma.getShaper() != null)) {
/* 106 */ this._pm = create();
/* 107 */ if (Gamma.getShaper() != null)
/* */ {
/* 109 */ this._edit = add("Edit Properties...");
/* 110 */ if (rows > 0)
/* 111 */ addSeparator(this._pm);
/* */ }
/* 113 */ for (Enumeration<String> en = buttons.keys(); en.hasMoreElements();) {
/* 114 */ String label = (String)en.nextElement();
/* 115 */ this._inttobuttons.put(new Integer(add(label)), (Action)buttons.get(label));
/* */ }
/* 117 */ show(Window.getHWnd(), this._pm);
/* */ } else {
/* 119 */ close();
/* */ }
/* */ }
/* */
/* 123 */ private void close() { discard(this._pm);
/* 124 */ this._pm = 0;
/* 125 */ Main.unregister(this);
/* 126 */ _current = null;
/* */ }
/* */
/* */ private void checkButton() {
/* 130 */ int pressed = checkPressed();
/* 131 */ if (pressed == 0)
/* 132 */ return;
/* 133 */ if (pressed == this._edit) {
/* 134 */ Console.getFrame().getEditTile().viewProperties(this._obj);
/* */ } else {
/* 136 */ Action action = (Action)this._inttobuttons.get(new Integer(pressed));
/* 137 */ RunningActionHandler.trigger(action, this._obj.getWorld(), null);
/* */ }
/* 139 */ close();
/* */ }
/* */
/* */
/* */
/* */
/* */ public void mainCallback()
/* */ {
/* 147 */ if (this._acts != null) {
/* 148 */ build(this._acts);
/* 149 */ this._acts = null;
/* */ } else {
/* 151 */ checkButton();
/* */ }
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\RightMenu.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|