1
|
=== modified file 'src/com/goldencode/p2j/ui/chui/ThinClient.java'
|
2
|
--- src/com/goldencode/p2j/ui/chui/ThinClient.java 2015-11-03 15:54:27 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/chui/ThinClient.java 2015-11-03 19:46:38 +0000
|
4
|
@@ -2177,6 +2177,7 @@
|
5
|
** SVL 20151029 Added queryRepositioned.
|
6
|
** EVL 20151103 Adding handing image names without extensions while loading from
|
7
|
** client file system.
|
8
|
+** SBI 20151103 Changed terminate() to reset windows for gui as for chui.
|
9
|
*/
|
10
|
|
11
|
package com.goldencode.p2j.ui.chui;
|
12
|
@@ -2879,11 +2880,7 @@
|
13
|
ClientConfigManager mgr = ConfigManager.getInstance();
|
14
|
mgr.deactivateConfigUpdates();
|
15
|
|
16
|
- if (tc.isChui())
|
17
|
- {
|
18
|
- // this is needed only for chui...
|
19
|
- WindowManager.resetWindow();
|
20
|
- }
|
21
|
+ WindowManager.resetWindow();
|
22
|
}
|
23
|
|
24
|
/**
|
25
|
|
26
|
=== modified file 'src/com/goldencode/p2j/ui/client/WindowManager.java'
|
27
|
--- src/com/goldencode/p2j/ui/client/WindowManager.java 2015-10-16 12:11:54 +0000
|
28
|
+++ src/com/goldencode/p2j/ui/client/WindowManager.java 2015-11-03 19:46:38 +0000
|
29
|
@@ -45,6 +45,7 @@
|
30
|
** 020 HC 20151013 Changes to extend GUI multi-window focus management and ACTIVE-WINDOW system
|
31
|
** handle processing to modal windows.
|
32
|
** 021 GES 20151015 moveToTop()/moveToBottom() forces the driver to move the specified window.
|
33
|
+** SBI 20151103 Changed clearWindowList() to dispose the default window.
|
34
|
*/
|
35
|
|
36
|
package com.goldencode.p2j.ui.client;
|
37
|
@@ -310,7 +311,7 @@
|
38
|
w.hide();
|
39
|
if (w instanceof Window)
|
40
|
{
|
41
|
- removeWindow(w.getId().asInt());
|
42
|
+ remove(w);
|
43
|
}
|
44
|
else
|
45
|
{
|
46
|
|
47
|
=== added file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedKeyboardFocusManager.java'
|
48
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedKeyboardFocusManager.java 1970-01-01 00:00:00 +0000
|
49
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedKeyboardFocusManager.java 2015-11-04 18:48:08 +0000
|
50
|
@@ -0,0 +1,41 @@
|
51
|
+/*
|
52
|
+** Module : SwingEmulatedKeyboardFocusManager.java
|
53
|
+** Abstract : The application driver's level keyboard focus manager
|
54
|
+**
|
55
|
+** Copyright (c) 2014-2015, Golden Code Development Corporation.
|
56
|
+** ALL RIGHTS RESERVED. Use is subject to license terms.
|
57
|
+**
|
58
|
+** Golden Code Development Corporation
|
59
|
+** CONFIDENTIAL
|
60
|
+**
|
61
|
+** -#- -I- --Date-- ---------------------------------Description---------------------------------
|
62
|
+** 001 SBI 20151104 Added the driver's level keyboard focus manager.
|
63
|
+*/
|
64
|
+
|
65
|
+package com.goldencode.p2j.ui.client.gui.driver.swing;
|
66
|
+
|
67
|
+import java.awt.DefaultKeyboardFocusManager;
|
68
|
+import java.awt.Window;
|
69
|
+
|
70
|
+/**
|
71
|
+ * The driver level keyboard focus manager.
|
72
|
+ */
|
73
|
+class SwingEmulatedKeyboardFocusManager extends DefaultKeyboardFocusManager
|
74
|
+{
|
75
|
+ /**
|
76
|
+ * Sets the target window to be able to receive keys input.
|
77
|
+ *
|
78
|
+ * @param focusedWindow
|
79
|
+ * The target clients window
|
80
|
+ * @throws SecurityException
|
81
|
+ * if this KeyboardFocusManager is not the current KeyboardFocusManager
|
82
|
+ * for the calling thread's context and if the calling thread does not have
|
83
|
+ * "replaceKeyboardFocusManager" permission.
|
84
|
+ */
|
85
|
+ public void setWindowFocused(Window focusedWindow) throws SecurityException
|
86
|
+ {
|
87
|
+ setGlobalFocusOwner(focusedWindow);
|
88
|
+ setGlobalFocusedWindow(focusedWindow);
|
89
|
+ setGlobalActiveWindow(focusedWindow);
|
90
|
+ }
|
91
|
+}
|
92
|
\ No newline at end of file
|
93
|
|
94
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java'
|
95
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java 2015-10-24 19:51:34 +0000
|
96
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java 2015-11-04 18:44:47 +0000
|
97
|
@@ -73,6 +73,7 @@
|
98
|
** operations. Removed save/restore of focus listeners and replaced it with
|
99
|
** a global flag.
|
100
|
** 035 CA 20151024 Added support for WINDOW:SENSITIVE attribute.
|
101
|
+** SBI 20151103 Added the on show component listener to fix the lost keys input.
|
102
|
*/
|
103
|
|
104
|
package com.goldencode.p2j.ui.client.gui.driver.swing;
|
105
|
@@ -104,6 +105,7 @@
|
106
|
import com.goldencode.p2j.ui.client.event.*;
|
107
|
import com.goldencode.p2j.ui.client.gui.*;
|
108
|
import com.goldencode.p2j.ui.client.gui.driver.*;
|
109
|
+
|
110
|
import sun.java2d.*;
|
111
|
import sun.java2d.loops.*;
|
112
|
|
113
|
@@ -302,7 +304,22 @@
|
114
|
}
|
115
|
}
|
116
|
});
|
117
|
-
|
118
|
+
|
119
|
+ window.addComponentListener(new ComponentAdapter()
|
120
|
+ {
|
121
|
+
|
122
|
+ @Override
|
123
|
+ public void componentShown(ComponentEvent e)
|
124
|
+ {
|
125
|
+ KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
126
|
+ if (kfm instanceof SwingEmulatedKeyboardFocusManager)
|
127
|
+ {
|
128
|
+ ((SwingEmulatedKeyboardFocusManager) kfm).setWindowFocused(window);
|
129
|
+ }
|
130
|
+ }
|
131
|
+
|
132
|
+ });
|
133
|
+
|
134
|
// setup mouse listeners
|
135
|
pane.addMouseListener(mouseHandler);
|
136
|
pane.addMouseMotionListener(mouseHandler);
|
137
|
@@ -375,37 +392,63 @@
|
138
|
@Override
|
139
|
public void quit()
|
140
|
{
|
141
|
- for (MouseListener l : pane.getMouseListeners())
|
142
|
- {
|
143
|
- pane.removeMouseListener(l);
|
144
|
- }
|
145
|
- for (MouseMotionListener l : pane.getMouseMotionListeners())
|
146
|
- {
|
147
|
- pane.removeMouseMotionListener(l);
|
148
|
- }
|
149
|
- for (MouseWheelListener l : pane.getMouseWheelListeners())
|
150
|
- {
|
151
|
- pane.removeMouseWheelListener(l);
|
152
|
- }
|
153
|
- for (WindowListener l : window.getWindowListeners())
|
154
|
- {
|
155
|
- window.removeWindowListener(l);
|
156
|
- }
|
157
|
- for (WindowFocusListener l : window.getWindowFocusListeners())
|
158
|
- {
|
159
|
- window.removeWindowFocusListener(l);
|
160
|
- }
|
161
|
- for (WindowStateListener l : window.getWindowStateListeners())
|
162
|
- {
|
163
|
- window.removeWindowStateListener(l);
|
164
|
- }
|
165
|
- for (KeyListener l : window.getKeyListeners())
|
166
|
- {
|
167
|
- window.removeKeyListener(l);
|
168
|
- }
|
169
|
-
|
170
|
- // cleanup window resources
|
171
|
- pane.quit();
|
172
|
+ Runnable r = new Runnable()
|
173
|
+ {
|
174
|
+
|
175
|
+ @Override
|
176
|
+ public void run()
|
177
|
+ {
|
178
|
+ for (MouseListener l : pane.getMouseListeners())
|
179
|
+ {
|
180
|
+ pane.removeMouseListener(l);
|
181
|
+ }
|
182
|
+ for (MouseMotionListener l : pane.getMouseMotionListeners())
|
183
|
+ {
|
184
|
+ pane.removeMouseMotionListener(l);
|
185
|
+ }
|
186
|
+ for (MouseWheelListener l : pane.getMouseWheelListeners())
|
187
|
+ {
|
188
|
+ pane.removeMouseWheelListener(l);
|
189
|
+ }
|
190
|
+ for (WindowListener l : window.getWindowListeners())
|
191
|
+ {
|
192
|
+ window.removeWindowListener(l);
|
193
|
+ }
|
194
|
+ for (WindowFocusListener l : window.getWindowFocusListeners())
|
195
|
+ {
|
196
|
+ window.removeWindowFocusListener(l);
|
197
|
+ }
|
198
|
+ for (WindowStateListener l : window.getWindowStateListeners())
|
199
|
+ {
|
200
|
+ window.removeWindowStateListener(l);
|
201
|
+ }
|
202
|
+ for (KeyListener l : window.getKeyListeners())
|
203
|
+ {
|
204
|
+ window.removeKeyListener(l);
|
205
|
+ }
|
206
|
+ for (ComponentListener l : window.getComponentListeners())
|
207
|
+ {
|
208
|
+ window.removeComponentListener(l);
|
209
|
+ }
|
210
|
+
|
211
|
+ // cleanup window resources
|
212
|
+ pane.quit();
|
213
|
+ }
|
214
|
+ };
|
215
|
+ if (SwingUtilities.isEventDispatchThread())
|
216
|
+ {
|
217
|
+ r.run();
|
218
|
+ }
|
219
|
+ else
|
220
|
+ {
|
221
|
+ try
|
222
|
+ {
|
223
|
+ SwingUtilities.invokeAndWait(r);
|
224
|
+ }
|
225
|
+ catch (InvocationTargetException | InterruptedException e)
|
226
|
+ {
|
227
|
+ }
|
228
|
+ }
|
229
|
}
|
230
|
|
231
|
/**
|
232
|
@@ -1448,4 +1491,5 @@
|
233
|
|
234
|
highlightRestoreBuffer = null;
|
235
|
}
|
236
|
+
|
237
|
}
|
238
|
|
239
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiClient.java'
|
240
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiClient.java 2015-10-22 22:00:01 +0000
|
241
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiClient.java 2015-11-04 18:43:44 +0000
|
242
|
@@ -28,6 +28,7 @@
|
243
|
|
244
|
package com.goldencode.p2j.ui.client.gui.driver.swing;
|
245
|
|
246
|
+import java.awt.KeyboardFocusManager;
|
247
|
import java.lang.reflect.*;
|
248
|
|
249
|
import javax.swing.*;
|
250
|
@@ -50,13 +51,15 @@
|
251
|
* Construct the new frame by instantiating the {@link SwingEmulatedWindow} as the
|
252
|
* content pane and initializing it using the given <code>options</code>.
|
253
|
*
|
254
|
+ * @param focusManager
|
255
|
+ * The driver's level keyboard focus manager.
|
256
|
* @param keyReader
|
257
|
* The {@link SwingKeyboardReader key reader} which listens for incoming keys.
|
258
|
* @param showOnTaskbar
|
259
|
* If <code>true</code>, the window backed by this emulator will be displayed
|
260
|
* on OS task bar.
|
261
|
*/
|
262
|
- private SwingGuiClient(SwingKeyboardReader keyReader, boolean showOnTaskbar)
|
263
|
+ private SwingGuiClient(KeyboardFocusManager focusManager, SwingKeyboardReader keyReader, boolean showOnTaskbar)
|
264
|
{
|
265
|
super(WindowGuiImpl.DEFAULT_TITLE);
|
266
|
|
267
|
@@ -64,7 +67,7 @@
|
268
|
{
|
269
|
setType(javax.swing.JFrame.Type.POPUP);
|
270
|
}
|
271
|
-
|
272
|
+ KeyboardFocusManager.setCurrentKeyboardFocusManager(focusManager);
|
273
|
// common initialization
|
274
|
sew = new SwingEmulatedWindow(this, keyReader);
|
275
|
init(sew.getContentPane(), false);
|
276
|
@@ -74,6 +77,8 @@
|
277
|
* Initialize the application frame by creating a new instance of this class
|
278
|
* and of the content pane which is an instance of {@link SwingEmulatedWindow}.
|
279
|
*
|
280
|
+ * @param focusManager
|
281
|
+ * The driver's level keyboard focus manager.
|
282
|
* @param keyReader
|
283
|
* The {@link SwingKeyboardReader key reader} which listens for incoming keys.
|
284
|
* @param showOnTaskbar
|
285
|
@@ -82,7 +87,8 @@
|
286
|
*
|
287
|
* @return The simulator instance.
|
288
|
*/
|
289
|
- public static EmulatedWindowState load(final SwingKeyboardReader keyReader,
|
290
|
+ public static EmulatedWindowState load(final KeyboardFocusManager focusManager,
|
291
|
+ final SwingKeyboardReader keyReader,
|
292
|
final boolean showOnTaskbar)
|
293
|
throws InterruptedException,
|
294
|
InvocationTargetException
|
295
|
@@ -95,7 +101,7 @@
|
296
|
{
|
297
|
public void run()
|
298
|
{
|
299
|
- client[0] = new SwingGuiClient(keyReader, showOnTaskbar);
|
300
|
+ client[0] = new SwingGuiClient(focusManager, keyReader, showOnTaskbar);
|
301
|
}
|
302
|
});
|
303
|
|
304
|
|
305
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java'
|
306
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java 2015-10-22 23:14:19 +0000
|
307
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java 2015-11-04 18:48:24 +0000
|
308
|
@@ -68,6 +68,7 @@
|
309
|
** HC 20151022 A fix for JWindow not able to receive focus when its owner window is not
|
310
|
** visible. This resolves ALERT-BOX and DIALOG-BOX not receiving key input when
|
311
|
** no main window visible.
|
312
|
+** SBI 20151102 To do the keyboard reader a final driver's field.
|
313
|
*/
|
314
|
|
315
|
package com.goldencode.p2j.ui.client.gui.driver.swing;
|
316
|
@@ -82,7 +83,6 @@
|
317
|
import java.io.*;
|
318
|
import java.util.*;
|
319
|
|
320
|
-import com.goldencode.p2j.security.*;
|
321
|
import com.goldencode.p2j.ui.client.*;
|
322
|
import com.goldencode.p2j.ui.client.gui.driver.*;
|
323
|
import com.goldencode.p2j.ui.client.driver.swing.*;
|
324
|
@@ -97,14 +97,12 @@
|
325
|
* The key reader. This is global per the entire application, no matter how many frames are
|
326
|
* alive.
|
327
|
*/
|
328
|
- private static final ContextLocal<SwingKeyboardReader> keyReader =
|
329
|
- new ContextLocal<SwingKeyboardReader>()
|
330
|
- {
|
331
|
- protected SwingKeyboardReader initialValue()
|
332
|
- {
|
333
|
- return new WinKeyboardReader();
|
334
|
- };
|
335
|
- };
|
336
|
+ private final SwingKeyboardReader keyReader = new WinKeyboardReader();
|
337
|
+
|
338
|
+ /**
|
339
|
+ * The driver's level keyboard focus manager.
|
340
|
+ */
|
341
|
+ private final KeyboardFocusManager keyboardFocusManager = new SwingEmulatedKeyboardFocusManager();
|
342
|
|
343
|
/** A special map containing the attributes of a underlined font. */
|
344
|
static Map<TextAttribute, Integer> UNDERLINE_FONT = new HashMap<>();
|
345
|
@@ -246,7 +244,7 @@
|
346
|
@Override
|
347
|
public int readKey()
|
348
|
{
|
349
|
- return keyReader.get().read();
|
350
|
+ return keyReader.read();
|
351
|
}
|
352
|
|
353
|
/**
|
354
|
@@ -264,7 +262,7 @@
|
355
|
|
356
|
try
|
357
|
{
|
358
|
- ews = SwingGuiClient.load(keyReader.get(), true);
|
359
|
+ ews = SwingGuiClient.load(keyboardFocusManager, keyReader, true);
|
360
|
|
361
|
// the real window size is unknown at this time; it will be set later, when the layout
|
362
|
// is performed
|
363
|
@@ -304,14 +302,14 @@
|
364
|
{
|
365
|
ews = GuiWindowContainer.load((SwingEmulatedWindow) owner,
|
366
|
windowTitle,
|
367
|
- keyReader.get());
|
368
|
+ keyReader);
|
369
|
}
|
370
|
else
|
371
|
{
|
372
|
// GuiWindowContainer is backed by JWindow Swing component which
|
373
|
// requires a visible owner window in order to be focusable.
|
374
|
// So if no visible owner, use SwingGuiClient backed by JFrame.
|
375
|
- ews = SwingGuiClient.load(keyReader.get(), false);
|
376
|
+ ews = SwingGuiClient.load(keyboardFocusManager, keyReader, false);
|
377
|
}
|
378
|
|
379
|
// the real window size is unknown at this time; it will be set later, when the layout
|
380
|
@@ -515,5 +513,6 @@
|
381
|
public void setCurrentSelection(String txt)
|
382
|
{
|
383
|
// not needed for clipboard support in Swing
|
384
|
- }
|
385
|
+ };
|
386
|
+
|
387
|
}
|
388
|
|