comparison src/org/tn5250j/framework/tn5250/ScreenOIA.java @ 112:77ac18bc1b2f

cleanup java formatting
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 13:03:01 -0700
parents e8d2a24e85c6
children
comparison
equal deleted inserted replaced
111:6a0ad4d384ea 112:77ac18bc1b2f
33 * the cursor. A ScreenOIA object can be obtained using the GetOIA() method on 33 * the cursor. A ScreenOIA object can be obtained using the GetOIA() method on
34 * an instance of Screen5250. 34 * an instance of Screen5250.
35 * 35 *
36 * 36 *
37 */ 37 */
38 public class ScreenOIA 38 public class ScreenOIA {
39 { 39 // OIA_LEVEL
40 // OIA_LEVEL 40 public static final int OIA_LEVEL_INPUT_INHIBITED = 1;
41 public static final int OIA_LEVEL_INPUT_INHIBITED = 1; 41 public static final int OIA_LEVEL_NOT_INHIBITED = 2;
42 public static final int OIA_LEVEL_NOT_INHIBITED = 2; 42 public static final int OIA_LEVEL_MESSAGE_LIGHT_ON = 3;
43 public static final int OIA_LEVEL_MESSAGE_LIGHT_ON = 3; 43 public static final int OIA_LEVEL_MESSAGE_LIGHT_OFF = 4;
44 public static final int OIA_LEVEL_MESSAGE_LIGHT_OFF = 4; 44 public static final int OIA_LEVEL_AUDIBLE_BELL = 5;
45 public static final int OIA_LEVEL_AUDIBLE_BELL = 5; 45 public static final int OIA_LEVEL_INSERT_MODE = 6;
46 public static final int OIA_LEVEL_INSERT_MODE = 6; 46 public static final int OIA_LEVEL_KEYBOARD = 7;
47 public static final int OIA_LEVEL_KEYBOARD = 7; 47 public static final int OIA_LEVEL_CLEAR_SCREEN = 8;
48 public static final int OIA_LEVEL_CLEAR_SCREEN = 8; 48 public static final int OIA_LEVEL_SCREEN_SIZE = 9;
49 public static final int OIA_LEVEL_SCREEN_SIZE = 9; 49 public static final int OIA_LEVEL_INPUT_ERROR = 10;
50 public static final int OIA_LEVEL_INPUT_ERROR = 10; 50 public static final int OIA_LEVEL_KEYS_BUFFERED = 11;
51 public static final int OIA_LEVEL_KEYS_BUFFERED = 11; 51 public static final int OIA_LEVEL_SCRIPT = 12;
52 public static final int OIA_LEVEL_SCRIPT = 12; 52
53 53 // INPUTINHIBITED
54 // INPUTINHIBITED 54 public static final int INPUTINHIBITED_NOTINHIBITED = 0;
55 public static final int INPUTINHIBITED_NOTINHIBITED = 0; 55 public static final int INPUTINHIBITED_SYSTEM_WAIT = 1;
56 public static final int INPUTINHIBITED_SYSTEM_WAIT = 1; 56 public static final int INPUTINHIBITED_COMMCHECK = 2;
57 public static final int INPUTINHIBITED_COMMCHECK = 2; 57 public static final int INPUTINHIBITED_PROGCHECK = 3;
58 public static final int INPUTINHIBITED_PROGCHECK = 3; 58 public static final int INPUTINHIBITED_MACHINECHECK = 4;
59 public static final int INPUTINHIBITED_MACHINECHECK = 4; 59 public static final int INPUTINHIBITED_OTHER = 5;
60 public static final int INPUTINHIBITED_OTHER = 5; 60
61 61 public ScreenOIA(Screen5250 screen) {
62 public ScreenOIA (Screen5250 screen) { 62 source = screen;
63 63 }
64 source = screen; 64
65 65 public boolean isInsertMode() {
66 } 66 return insertMode;
67 67 }
68 public boolean isInsertMode() { 68
69 69 protected void setInsertMode(boolean mode) {
70 return insertMode; 70 level = OIA_LEVEL_INSERT_MODE;
71 } 71 insertMode = mode;
72 72 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_INSERT_MODE);
73 protected void setInsertMode(boolean mode) { 73 }
74 74
75 level = OIA_LEVEL_INSERT_MODE; 75 public int getCommCheckCode() {
76 insertMode = mode; 76 return commCheck;
77 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_INSERT_MODE); 77 }
78 } 78
79 79 public int getInputInhibited() {
80 public int getCommCheckCode() { 80 return inputInhibited;
81 81 }
82 return commCheck; 82
83 } 83 public int getMachineCheckCode() {
84 84 return machineCheck;
85 public int getInputInhibited() { 85 }
86 86
87 return inputInhibited; 87 public int getOwner() {
88 } 88 return owner;
89 89 }
90 public int getMachineCheckCode() { 90
91 91 public int getProgCheckCode() {
92 return machineCheck; 92 return 0;
93 } 93 }
94 94
95 public int getOwner() { 95 /**
96 return owner; 96 * Is the keyboard locked or not
97 } 97 *
98 98 * @return locked or not
99 public int getProgCheckCode() { 99 */
100 return 0; 100 public boolean isKeyBoardLocked() {
101 } 101 return locked;
102 102 }
103 /** 103
104 * Is the keyboard locked or not 104 public boolean isKeysBuffered() {
105 * 105 return keysBuffered;
106 * @return locked or not 106 }
107 */ 107
108 public boolean isKeyBoardLocked() { 108 public void setKeysBuffered(boolean kb) {
109 return locked; 109 level = OIA_LEVEL_KEYS_BUFFERED;
110 } 110 boolean oldKB = keysBuffered;
111 111 keysBuffered = kb;
112 public boolean isKeysBuffered() { 112
113 return keysBuffered; 113 if (keysBuffered != oldKB)
114 } 114 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_KEYS_BUFFERED);
115 115 }
116 public void setKeysBuffered(boolean kb) { 116
117 level = OIA_LEVEL_KEYS_BUFFERED; 117 protected void setKeyBoardLocked(boolean lockIt) {
118 boolean oldKB = keysBuffered; 118 level = OIA_LEVEL_KEYBOARD;
119 keysBuffered = kb; 119 boolean oldLocked = locked;
120 if (keysBuffered != oldKB) 120 locked = lockIt;
121 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_KEYS_BUFFERED); 121
122 } 122 if (!lockIt) {
123 123 if (isKeysBuffered()) {
124 protected void setKeyBoardLocked(boolean lockIt) { 124 source.sendKeys("");
125 level = OIA_LEVEL_KEYBOARD; 125 }
126 boolean oldLocked = locked; 126 }
127 locked = lockIt; 127
128 if (!lockIt) { 128 if (locked != oldLocked)
129 129 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_KEYBOARD_LOCKED);
130 if (isKeysBuffered()) { 130 }
131 source.sendKeys(""); 131
132 } 132 public boolean isMessageWait() {
133 } 133 return messageWait;
134 134 }
135 if (locked != oldLocked) 135
136 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_KEYBOARD_LOCKED); 136 protected void setMessageLightOn() {
137 } 137 level = OIA_LEVEL_MESSAGE_LIGHT_ON;
138 138 messageWait = true;
139 public boolean isMessageWait() { 139 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_MESSAGELIGHT);
140 return messageWait; 140 }
141 } 141
142 142 protected void setMessageLightOff() {
143 protected void setMessageLightOn() { 143 level = OIA_LEVEL_MESSAGE_LIGHT_OFF;
144 level = OIA_LEVEL_MESSAGE_LIGHT_ON; 144 messageWait = false;
145 messageWait = true; 145 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_MESSAGELIGHT);
146 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_MESSAGELIGHT); 146 }
147 } 147
148 148 public void setScriptActive(boolean running) {
149 protected void setMessageLightOff() { 149 level = OIA_LEVEL_SCRIPT;
150 level = OIA_LEVEL_MESSAGE_LIGHT_OFF; 150 scriptRunning = running;
151 messageWait = false; 151 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_SCRIPT);
152 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_MESSAGELIGHT); 152 }
153 } 153
154 154 public boolean isScriptActive() {
155 public void setScriptActive(boolean running) { 155 return scriptRunning;
156 level = OIA_LEVEL_SCRIPT; 156 }
157 scriptRunning = running; 157
158 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_SCRIPT); 158 public void setAudibleBell() {
159 } 159 level = OIA_LEVEL_AUDIBLE_BELL;
160 160 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_BELL);
161 public boolean isScriptActive() { 161 }
162 return scriptRunning; 162
163 } 163 protected void clearScreen() {
164 164 level = OIA_LEVEL_CLEAR_SCREEN;
165 public void setAudibleBell() { 165 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_CLEAR_SCREEN);
166 level = OIA_LEVEL_AUDIBLE_BELL; 166 }
167 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_BELL); 167
168 } 168 /**
169 169 * Add a ScreenOIAListener to the listener list.
170 protected void clearScreen() { 170 *
171 level = OIA_LEVEL_CLEAR_SCREEN; 171 * @param listener The ScreenOIAListener to be added
172 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_CLEAR_SCREEN); 172 */
173 } 173 public void addOIAListener(ScreenOIAListener listener) {
174 174 if (listeners == null) {
175 /** 175 listeners = new java.util.Vector<ScreenOIAListener>(3);
176 * Add a ScreenOIAListener to the listener list. 176 }
177 * 177
178 * @param listener The ScreenOIAListener to be added 178 listeners.addElement(listener);
179 */ 179 }
180 public void addOIAListener(ScreenOIAListener listener) { 180
181 181 /**
182 if (listeners == null) { 182 * Remove a iOhioSessionListener from the listener list.
183 listeners = new java.util.Vector<ScreenOIAListener>(3); 183 *
184 } 184 * @param listener The iOhioSessionListener to be removed
185 listeners.addElement(listener); 185 */
186 186 public void removeOIAListener(ScreenOIAListener listener) {
187 } 187 if (listeners == null) {
188 188 return;
189 /** 189 }
190 * Remove a iOhioSessionListener from the listener list. 190
191 * 191 listeners.removeElement(listener);
192 * @param listener The iOhioSessionListener to be removed 192 }
193 */ 193
194 public void removeOIAListener(ScreenOIAListener listener) { 194 // object methods
195 195 public Screen5250 getSource() {
196 if (listeners == null) { 196 return source;
197 return; 197 }
198 } 198
199 listeners.removeElement(listener); 199
200 } 200 public void setSource(Screen5250 screen) {
201 201 source = screen;
202 // object methods 202 }
203 public Screen5250 getSource() { 203
204 204 public void setOwner(int newOwner) {
205 return source; 205 owner = newOwner;
206 } 206 }
207 207
208 208 public int getLevel() {
209 public void setSource(Screen5250 screen) { 209 return level;
210 210 }
211 source = screen; 211
212 212 public String getInhibitedText() {
213 } 213 return inhibitedText;
214 214 }
215 public void setOwner(int newOwner) { 215
216 216 public void setInputInhibited(int inhibit , int whatCode) {
217 owner = newOwner; 217 setInputInhibited(inhibit, whatCode, null);
218 218 }
219 } 219
220 220 public void setInputInhibited(int inhibit , int whatCode, String message) {
221 public int getLevel() { 221 inputInhibited = inhibit;
222 222 level = OIA_LEVEL_INPUT_INHIBITED;
223 return level; 223 inhibitedText = message;
224 }
225
226 public String getInhibitedText() {
227 return inhibitedText;
228 }
229
230 public void setInputInhibited(int inhibit , int whatCode) {
231 setInputInhibited(inhibit, whatCode, null);
232 }
233
234 public void setInputInhibited(int inhibit , int whatCode, String message) {
235
236 inputInhibited = inhibit;
237 level = OIA_LEVEL_INPUT_INHIBITED;
238 inhibitedText = message;
239 224
240 // if (saveInhibit != inhibit || saveInhibitLevel != whatCode) { 225 // if (saveInhibit != inhibit || saveInhibitLevel != whatCode) {
241 switch(inhibit) { 226 switch (inhibit) {
242
243 case INPUTINHIBITED_COMMCHECK : 227 case INPUTINHIBITED_COMMCHECK :
244 commCheck = whatCode; 228 commCheck = whatCode;
245 break; 229 break;
230
246 case INPUTINHIBITED_PROGCHECK : 231 case INPUTINHIBITED_PROGCHECK :
247 // progCheck = whatCode; // never used 232 // progCheck = whatCode; // never used
248 break; 233 break;
234
249 case INPUTINHIBITED_MACHINECHECK : 235 case INPUTINHIBITED_MACHINECHECK :
250 machineCheck = whatCode; 236 machineCheck = whatCode;
251 break; 237 break;
238
252 case INPUTINHIBITED_SYSTEM_WAIT : 239 case INPUTINHIBITED_SYSTEM_WAIT :
253 level = whatCode; 240 level = whatCode;
254 break; 241 break;
242
255 case INPUTINHIBITED_NOTINHIBITED : 243 case INPUTINHIBITED_NOTINHIBITED :
256 level = whatCode; 244 level = whatCode;
257 break; 245 break;
258 } 246 }
259 247
260 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_INPUTINHIBITED); 248 fireOIAChanged(ScreenOIAListener.OIA_CHANGED_INPUTINHIBITED);
261 // } 249 // }
262 } 250 }
263 251
264 /** 252 /**
265 * Notify all registered listeners of the onOIAChanged event. 253 * Notify all registered listeners of the onOIAChanged event.
266 * 254 *
267 */ 255 */
268 private void fireOIAChanged(int change) { 256 private void fireOIAChanged(int change) {
269 257 if (listeners != null) {
270 if (listeners != null) { 258 int size = listeners.size();
271 int size = listeners.size(); 259
272 for (int i = 0; i < size; i++) { 260 for (int i = 0; i < size; i++) {
273 ScreenOIAListener target = 261 ScreenOIAListener target =
274 listeners.elementAt(i); 262 listeners.elementAt(i);
275 target.onOIAChanged(this, change); 263 target.onOIAChanged(this, change);
276 } 264 }
277 } 265 }
278 } 266 }
279 267
280 private Vector<ScreenOIAListener> listeners = null; 268 private Vector<ScreenOIAListener> listeners = null;
281 private boolean insertMode; 269 private boolean insertMode;
282 private boolean locked; 270 private boolean locked;
283 private boolean keysBuffered; 271 private boolean keysBuffered;
284 private int owner = 0; 272 private int owner = 0;
285 private int level = 0; 273 private int level = 0;
286 private Screen5250 source = null; 274 private Screen5250 source = null;
287 private int commCheck = 0; 275 private int commCheck = 0;
288 private int machineCheck = 0; 276 private int machineCheck = 0;
289 private boolean messageWait; 277 private boolean messageWait;
290 private boolean scriptRunning; 278 private boolean scriptRunning;
291 private int inputInhibited = INPUTINHIBITED_NOTINHIBITED; 279 private int inputInhibited = INPUTINHIBITED_NOTINHIBITED;
292 private String inhibitedText; 280 private String inhibitedText;
293 281
294 } 282 }