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-04 21:26:19 +0000
|
29
|
@@ -45,6 +45,8 @@
|
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 and to clear windows
|
34
|
+** following the reverse order of their creations.
|
35
|
*/
|
36
|
|
37
|
package com.goldencode.p2j.ui.client;
|
38
|
@@ -301,16 +303,16 @@
|
39
|
|
40
|
synchronized (wa.windows)
|
41
|
{
|
42
|
- wins.addAll(wa.windows);
|
43
|
+ wins.addAll(wa.fixedOrderWindows);
|
44
|
}
|
45
|
-
|
46
|
- // notify the windows are being destroyed
|
47
|
+ Collections.reverse(wins);
|
48
|
+ // notify the windows are being destroyed in the reverse to their creations
|
49
|
for (TitledWindow<?> w : wins)
|
50
|
{
|
51
|
w.hide();
|
52
|
if (w instanceof Window)
|
53
|
{
|
54
|
- removeWindow(w.getId().asInt());
|
55
|
+ remove(w);
|
56
|
}
|
57
|
else
|
58
|
{
|
59
|
|
60
|
=== added file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedKeyboardFocusManager.java'
|
61
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedKeyboardFocusManager.java 1970-01-01 00:00:00 +0000
|
62
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedKeyboardFocusManager.java 2015-11-04 21:28:15 +0000
|
63
|
@@ -0,0 +1,40 @@
|
64
|
+/*
|
65
|
+** Module : SwingEmulatedKeyboardFocusManager.java
|
66
|
+** Abstract : The application driver's level keyboard focus manager
|
67
|
+**
|
68
|
+** Copyright (c) 2014-2015, Golden Code Development Corporation.
|
69
|
+** ALL RIGHTS RESERVED. Use is subject to license terms.
|
70
|
+**
|
71
|
+** Golden Code Development Corporation
|
72
|
+** CONFIDENTIAL
|
73
|
+**
|
74
|
+** -#- -I- --Date-- ---------------------------------Description---------------------------------
|
75
|
+** 001 SBI 20151104 Added the driver's level keyboard focus manager.
|
76
|
+*/
|
77
|
+
|
78
|
+package com.goldencode.p2j.ui.client.gui.driver.swing;
|
79
|
+
|
80
|
+import java.awt.*;
|
81
|
+
|
82
|
+/**
|
83
|
+ * The driver level keyboard focus manager.
|
84
|
+ */
|
85
|
+class SwingEmulatedKeyboardFocusManager extends DefaultKeyboardFocusManager
|
86
|
+{
|
87
|
+ /**
|
88
|
+ * Sets the target window to be able to receive keys input.
|
89
|
+ *
|
90
|
+ * @param focusedWindow
|
91
|
+ * The target clients window
|
92
|
+ * @throws SecurityException
|
93
|
+ * if this KeyboardFocusManager is not the current KeyboardFocusManager
|
94
|
+ * for the calling thread's context and if the calling thread does not have
|
95
|
+ * "replaceKeyboardFocusManager" permission.
|
96
|
+ */
|
97
|
+ public void setWindowFocused(Window focusedWindow) throws SecurityException
|
98
|
+ {
|
99
|
+ setGlobalFocusOwner(focusedWindow);
|
100
|
+ setGlobalFocusedWindow(focusedWindow);
|
101
|
+ setGlobalActiveWindow(focusedWindow);
|
102
|
+ }
|
103
|
+}
|
104
|
|
105
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java'
|
106
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java 2015-10-24 19:51:34 +0000
|
107
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java 2015-11-04 20:07:33 +0000
|
108
|
@@ -73,6 +73,7 @@
|
109
|
** operations. Removed save/restore of focus listeners and replaced it with
|
110
|
** a global flag.
|
111
|
** 035 CA 20151024 Added support for WINDOW:SENSITIVE attribute.
|
112
|
+** SBI 20151103 Added the on show component listener to fix the lost keys input.
|
113
|
*/
|
114
|
|
115
|
package com.goldencode.p2j.ui.client.gui.driver.swing;
|
116
|
@@ -104,6 +105,7 @@
|
117
|
import com.goldencode.p2j.ui.client.event.*;
|
118
|
import com.goldencode.p2j.ui.client.gui.*;
|
119
|
import com.goldencode.p2j.ui.client.gui.driver.*;
|
120
|
+
|
121
|
import sun.java2d.*;
|
122
|
import sun.java2d.loops.*;
|
123
|
|
124
|
@@ -302,7 +304,22 @@
|
125
|
}
|
126
|
}
|
127
|
});
|
128
|
-
|
129
|
+
|
130
|
+ window.addComponentListener(new ComponentAdapter()
|
131
|
+ {
|
132
|
+
|
133
|
+ @Override
|
134
|
+ public void componentShown(ComponentEvent e)
|
135
|
+ {
|
136
|
+ KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
137
|
+ if (kfm instanceof SwingEmulatedKeyboardFocusManager)
|
138
|
+ {
|
139
|
+ ((SwingEmulatedKeyboardFocusManager) kfm).setWindowFocused(window);
|
140
|
+ }
|
141
|
+ }
|
142
|
+
|
143
|
+ });
|
144
|
+
|
145
|
// setup mouse listeners
|
146
|
pane.addMouseListener(mouseHandler);
|
147
|
pane.addMouseMotionListener(mouseHandler);
|
148
|
@@ -403,6 +420,10 @@
|
149
|
{
|
150
|
window.removeKeyListener(l);
|
151
|
}
|
152
|
+ for (ComponentListener l : window.getComponentListeners())
|
153
|
+ {
|
154
|
+ window.removeComponentListener(l);
|
155
|
+ }
|
156
|
|
157
|
// cleanup window resources
|
158
|
pane.quit();
|
159
|
@@ -1448,4 +1469,5 @@
|
160
|
|
161
|
highlightRestoreBuffer = null;
|
162
|
}
|
163
|
+
|
164
|
}
|
165
|
|
166
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiClient.java'
|
167
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiClient.java 2015-10-22 22:00:01 +0000
|
168
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiClient.java 2015-11-04 21:27:24 +0000
|
169
|
@@ -23,11 +23,13 @@
|
170
|
** 008 CA 20150921 Mouse and focus fixes.
|
171
|
** 009 HC 20151022 A fix for JWindow not able to receive focus when its owner window is not
|
172
|
** visible. This resolves ALERT-BOX and DIALOG-BOX not receiving key input when
|
173
|
-** no main window visible.
|
174
|
+** no main window visible.
|
175
|
+** SBI 20151104 Setup the driver's level keyboard focus manager.
|
176
|
*/
|
177
|
|
178
|
package com.goldencode.p2j.ui.client.gui.driver.swing;
|
179
|
|
180
|
+import java.awt.KeyboardFocusManager;
|
181
|
import java.lang.reflect.*;
|
182
|
|
183
|
import javax.swing.*;
|
184
|
@@ -50,13 +52,15 @@
|
185
|
* Construct the new frame by instantiating the {@link SwingEmulatedWindow} as the
|
186
|
* content pane and initializing it using the given <code>options</code>.
|
187
|
*
|
188
|
+ * @param focusManager
|
189
|
+ * The driver's level keyboard focus manager.
|
190
|
* @param keyReader
|
191
|
* The {@link SwingKeyboardReader key reader} which listens for incoming keys.
|
192
|
* @param showOnTaskbar
|
193
|
* If <code>true</code>, the window backed by this emulator will be displayed
|
194
|
* on OS task bar.
|
195
|
*/
|
196
|
- private SwingGuiClient(SwingKeyboardReader keyReader, boolean showOnTaskbar)
|
197
|
+ private SwingGuiClient(KeyboardFocusManager focusManager, SwingKeyboardReader keyReader, boolean showOnTaskbar)
|
198
|
{
|
199
|
super(WindowGuiImpl.DEFAULT_TITLE);
|
200
|
|
201
|
@@ -64,7 +68,7 @@
|
202
|
{
|
203
|
setType(javax.swing.JFrame.Type.POPUP);
|
204
|
}
|
205
|
-
|
206
|
+ KeyboardFocusManager.setCurrentKeyboardFocusManager(focusManager);
|
207
|
// common initialization
|
208
|
sew = new SwingEmulatedWindow(this, keyReader);
|
209
|
init(sew.getContentPane(), false);
|
210
|
@@ -74,6 +78,8 @@
|
211
|
* Initialize the application frame by creating a new instance of this class
|
212
|
* and of the content pane which is an instance of {@link SwingEmulatedWindow}.
|
213
|
*
|
214
|
+ * @param focusManager
|
215
|
+ * The driver's level keyboard focus manager.
|
216
|
* @param keyReader
|
217
|
* The {@link SwingKeyboardReader key reader} which listens for incoming keys.
|
218
|
* @param showOnTaskbar
|
219
|
@@ -82,7 +88,8 @@
|
220
|
*
|
221
|
* @return The simulator instance.
|
222
|
*/
|
223
|
- public static EmulatedWindowState load(final SwingKeyboardReader keyReader,
|
224
|
+ public static EmulatedWindowState load(final KeyboardFocusManager focusManager,
|
225
|
+ final SwingKeyboardReader keyReader,
|
226
|
final boolean showOnTaskbar)
|
227
|
throws InterruptedException,
|
228
|
InvocationTargetException
|
229
|
@@ -95,7 +102,7 @@
|
230
|
{
|
231
|
public void run()
|
232
|
{
|
233
|
- client[0] = new SwingGuiClient(keyReader, showOnTaskbar);
|
234
|
+ client[0] = new SwingGuiClient(focusManager, keyReader, showOnTaskbar);
|
235
|
}
|
236
|
});
|
237
|
|
238
|
|
239
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java'
|
240
|
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java 2015-10-22 23:14:19 +0000
|
241
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java 2015-11-04 21:29:39 +0000
|
242
|
@@ -68,6 +68,8 @@
|
243
|
** HC 20151022 A fix for JWindow not able to receive focus when its owner window is not
|
244
|
** visible. This resolves ALERT-BOX and DIALOG-BOX not receiving key input when
|
245
|
** no main window visible.
|
246
|
+** SBI 20151102 To do the keyboard reader a final driver's field, added the driver's level
|
247
|
+** keyboard focus manager.
|
248
|
*/
|
249
|
|
250
|
package com.goldencode.p2j.ui.client.gui.driver.swing;
|
251
|
@@ -82,7 +84,6 @@
|
252
|
import java.io.*;
|
253
|
import java.util.*;
|
254
|
|
255
|
-import com.goldencode.p2j.security.*;
|
256
|
import com.goldencode.p2j.ui.client.*;
|
257
|
import com.goldencode.p2j.ui.client.gui.driver.*;
|
258
|
import com.goldencode.p2j.ui.client.driver.swing.*;
|
259
|
@@ -97,14 +98,12 @@
|
260
|
* The key reader. This is global per the entire application, no matter how many frames are
|
261
|
* alive.
|
262
|
*/
|
263
|
- private static final ContextLocal<SwingKeyboardReader> keyReader =
|
264
|
- new ContextLocal<SwingKeyboardReader>()
|
265
|
- {
|
266
|
- protected SwingKeyboardReader initialValue()
|
267
|
- {
|
268
|
- return new WinKeyboardReader();
|
269
|
- };
|
270
|
- };
|
271
|
+ private final SwingKeyboardReader keyReader = new WinKeyboardReader();
|
272
|
+
|
273
|
+ /**
|
274
|
+ * The driver's level keyboard focus manager.
|
275
|
+ */
|
276
|
+ private final KeyboardFocusManager keyboardFocusManager = new SwingEmulatedKeyboardFocusManager();
|
277
|
|
278
|
/** A special map containing the attributes of a underlined font. */
|
279
|
static Map<TextAttribute, Integer> UNDERLINE_FONT = new HashMap<>();
|
280
|
@@ -246,7 +245,7 @@
|
281
|
@Override
|
282
|
public int readKey()
|
283
|
{
|
284
|
- return keyReader.get().read();
|
285
|
+ return keyReader.read();
|
286
|
}
|
287
|
|
288
|
/**
|
289
|
@@ -264,7 +263,7 @@
|
290
|
|
291
|
try
|
292
|
{
|
293
|
- ews = SwingGuiClient.load(keyReader.get(), true);
|
294
|
+ ews = SwingGuiClient.load(keyboardFocusManager, keyReader, true);
|
295
|
|
296
|
// the real window size is unknown at this time; it will be set later, when the layout
|
297
|
// is performed
|
298
|
@@ -304,14 +303,14 @@
|
299
|
{
|
300
|
ews = GuiWindowContainer.load((SwingEmulatedWindow) owner,
|
301
|
windowTitle,
|
302
|
- keyReader.get());
|
303
|
+ keyReader);
|
304
|
}
|
305
|
else
|
306
|
{
|
307
|
// GuiWindowContainer is backed by JWindow Swing component which
|
308
|
// requires a visible owner window in order to be focusable.
|
309
|
// So if no visible owner, use SwingGuiClient backed by JFrame.
|
310
|
- ews = SwingGuiClient.load(keyReader.get(), false);
|
311
|
+ ews = SwingGuiClient.load(keyboardFocusManager, keyReader, false);
|
312
|
}
|
313
|
|
314
|
// the real window size is unknown at this time; it will be set later, when the layout
|
315
|
|