1
|
=== modified file 'src/com/goldencode/p2j/ui/chui/ChuiWidgetFactory.java'
|
2
|
--- src/com/goldencode/p2j/ui/chui/ChuiWidgetFactory.java 2016-03-23 18:33:05 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/chui/ChuiWidgetFactory.java 2016-05-13 01:07:40 +0000
|
4
|
@@ -34,6 +34,7 @@
|
5
|
** 018 HC 20150831 Scrolling support overhaul.
|
6
|
** 019 IAS 20160227 Added new createScrollPane method as a synonym for the existing one
|
7
|
** 010 IAS 20160315 Support for the DEBUG-ALERT attribute
|
8
|
+** 011 SBI 20160512 Changed the scrollable list type.
|
9
|
*/
|
10
|
|
11
|
package com.goldencode.p2j.ui.chui;
|
12
|
@@ -195,10 +196,12 @@
|
13
|
* @return instance of UI-specific implementation of {@link ScrollableList}.
|
14
|
*/
|
15
|
@Override
|
16
|
- public ScrollableListImpl createScrollableList(ComboBox<ChuiOutputManager> parent,
|
17
|
- ListModel<String> model)
|
18
|
+ public ScrollableList<ChuiOutputManager,
|
19
|
+ ? extends ComboBox<ChuiOutputManager>> createScrollableList(
|
20
|
+ ComboBox<ChuiOutputManager> parent,
|
21
|
+ ListModel<String> model)
|
22
|
{
|
23
|
- return new ScrollableListImpl(parent, parent.model());
|
24
|
+ return parent.create(parent.model());
|
25
|
}
|
26
|
|
27
|
/**
|
28
|
|
29
|
=== modified file 'src/com/goldencode/p2j/ui/chui/ComboBoxImpl.java'
|
30
|
--- src/com/goldencode/p2j/ui/chui/ComboBoxImpl.java 2016-01-14 04:50:32 +0000
|
31
|
+++ src/com/goldencode/p2j/ui/chui/ComboBoxImpl.java 2016-05-13 01:02:20 +0000
|
32
|
@@ -2,7 +2,7 @@
|
33
|
** Module : ComboBoxImpl.java
|
34
|
** Abstract : chui implementation of the combo-box
|
35
|
**
|
36
|
-** Copyright (c) 2011-2015, Golden Code Development Corporation.
|
37
|
+** Copyright (c) 2011-2016, Golden Code Development Corporation.
|
38
|
** ALL RIGHTS RESERVED. Use is subject to license terms.
|
39
|
**
|
40
|
** Golden Code Development Corporation
|
41
|
@@ -27,6 +27,7 @@
|
42
|
** 009 IAS 20150924 Added AUTO-RESIZE attribute support
|
43
|
** 010 EVL 20151217 Drop-down approach rework. Separation ChUI specific drop-down registration
|
44
|
** and focus gaining.
|
45
|
+** 011 SBI 20160512 Implemented to create the scrollable list factory method.
|
46
|
*/
|
47
|
|
48
|
package com.goldencode.p2j.ui.chui;
|
49
|
@@ -34,6 +35,7 @@
|
50
|
import com.goldencode.p2j.ui.*;
|
51
|
import com.goldencode.p2j.ui.client.*;
|
52
|
import com.goldencode.p2j.ui.client.chui.driver.*;
|
53
|
+import com.goldencode.p2j.ui.client.model.*;
|
54
|
import com.goldencode.p2j.ui.client.widget.*;
|
55
|
import com.goldencode.util.*;
|
56
|
|
57
|
@@ -158,6 +160,21 @@
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
+ * Creates the scrollable list for this combobox based on the provided list model.
|
62
|
+ *
|
63
|
+ * @param model
|
64
|
+ * The scrollable list model.
|
65
|
+ *
|
66
|
+ * @return The scrollable list.
|
67
|
+ */
|
68
|
+ @Override
|
69
|
+ public ScrollableList<ChuiOutputManager, ? extends ComboBox<ChuiOutputManager>> create(
|
70
|
+ ListModel<String> model)
|
71
|
+ {
|
72
|
+ return new ScrollableListImpl(this, model);
|
73
|
+ }
|
74
|
+
|
75
|
+ /**
|
76
|
* Registers drop-down frame in current window system. ChUI specific version.
|
77
|
*/
|
78
|
@Override
|
79
|
|
80
|
=== modified file 'src/com/goldencode/p2j/ui/chui/ScrollableListImpl.java'
|
81
|
--- src/com/goldencode/p2j/ui/chui/ScrollableListImpl.java 2015-09-16 16:53:54 +0000
|
82
|
+++ src/com/goldencode/p2j/ui/chui/ScrollableListImpl.java 2016-05-13 01:13:53 +0000
|
83
|
@@ -17,6 +17,7 @@
|
84
|
** 006 CA 20150603 Removed requestSync from drawCaret.
|
85
|
** 007 EVL 20150517 Adding api to set up the top row index.
|
86
|
** 008 HC 20150913 Scrolling support overhaul.
|
87
|
+** 009 SBI 20160512 Changed to provide the generic combobox parameter.
|
88
|
*/
|
89
|
|
90
|
package com.goldencode.p2j.ui.chui;
|
91
|
@@ -31,7 +32,7 @@
|
92
|
* CHUI-specific portion of ScrollableList.
|
93
|
*/
|
94
|
public class ScrollableListImpl
|
95
|
-extends ScrollableList<ChuiOutputManager>
|
96
|
+extends ScrollableList<ChuiOutputManager, ComboBoxImpl>
|
97
|
{
|
98
|
/**
|
99
|
* Create component using given configuration and data model.
|
100
|
@@ -41,7 +42,7 @@
|
101
|
* @param model
|
102
|
* The data model that represents the contents of the list.
|
103
|
*/
|
104
|
- ScrollableListImpl(ComboBox<ChuiOutputManager> box, ListModel<String> model)
|
105
|
+ ScrollableListImpl(ComboBoxImpl box, ListModel<String> model)
|
106
|
{
|
107
|
super(box, model);
|
108
|
}
|
109
|
|
110
|
=== modified file 'src/com/goldencode/p2j/ui/client/ComboBox.java'
|
111
|
--- src/com/goldencode/p2j/ui/client/ComboBox.java 2016-04-13 19:52:18 +0000
|
112
|
+++ src/com/goldencode/p2j/ui/client/ComboBox.java 2016-05-13 00:57:45 +0000
|
113
|
@@ -201,6 +201,7 @@
|
114
|
** 102 IAS 20160303 Fixed RETURN processing.
|
115
|
** 103 HC 20160406 Fixed COMBO-BOX drop-down resource cleanup.
|
116
|
** 104 HC 20160413 Comment fix.
|
117
|
+** 105 SBI 20160512 Added the scrollable list factory method.
|
118
|
*/
|
119
|
|
120
|
package com.goldencode.p2j.ui.client;
|
121
|
@@ -288,6 +289,16 @@
|
122
|
}
|
123
|
|
124
|
/**
|
125
|
+ * Creates the scrollable list for this combobox based on the provided list model.
|
126
|
+ *
|
127
|
+ * @param model
|
128
|
+ * The scrollable list model.
|
129
|
+ *
|
130
|
+ * @return The scrollable list.
|
131
|
+ */
|
132
|
+ public abstract ScrollableList<O, ? extends ComboBox<O>> create(ListModel<String> model);
|
133
|
+
|
134
|
+ /**
|
135
|
* Replacement API for the logic which should exist in the widget's c'tor, but the logic
|
136
|
* can't be executed as it depends on the widget being registered into the official registry.
|
137
|
* <p>
|
138
|
|
139
|
=== modified file 'src/com/goldencode/p2j/ui/client/DropDown.java'
|
140
|
--- src/com/goldencode/p2j/ui/client/DropDown.java 2016-04-06 15:37:34 +0000
|
141
|
+++ src/com/goldencode/p2j/ui/client/DropDown.java 2016-05-13 01:39:04 +0000
|
142
|
@@ -43,6 +43,7 @@
|
143
|
** 019 EVL 20160224 Javadoc fixes to make compatible with Oracle Java 8 for Solaris 10.
|
144
|
** 020 IAS 20160229 Change scrollpane creation.
|
145
|
** 021 HC 20160406 Fixed COMBO-BOX drop-down resource cleanup.
|
146
|
+** 022 SBI 20160512 Changed the scrollable list type.
|
147
|
*/
|
148
|
|
149
|
package com.goldencode.p2j.ui.client;
|
150
|
@@ -61,7 +62,7 @@
|
151
|
extends OuterFrame<O>
|
152
|
{
|
153
|
/** The list instance to represent the drop-down content. */
|
154
|
- protected final ScrollableList<O> list;
|
155
|
+ protected final ScrollableList<O, ? extends ComboBox<O>> list;
|
156
|
|
157
|
/** Wraps the list of items and handles scrolling. */
|
158
|
protected ScrollPane<O> scrollpane;
|
159
|
@@ -147,7 +148,7 @@
|
160
|
*
|
161
|
* @return See above.
|
162
|
*/
|
163
|
- public ScrollableList<O> getList()
|
164
|
+ public ScrollableList<O, ? extends ComboBox<O>> getList()
|
165
|
{
|
166
|
return list;
|
167
|
}
|
168
|
|
169
|
=== modified file 'src/com/goldencode/p2j/ui/client/ScrollPane.java'
|
170
|
--- src/com/goldencode/p2j/ui/client/ScrollPane.java 2016-03-13 15:10:14 +0000
|
171
|
+++ src/com/goldencode/p2j/ui/client/ScrollPane.java 2016-05-13 01:38:11 +0000
|
172
|
@@ -97,6 +97,7 @@
|
173
|
** duration of the drawing operation or other GUI API invocation which
|
174
|
** requires access to the underlying physical window.
|
175
|
** 050 HC 20160313 Fixed frame scroll layout calculation.
|
176
|
+** 051 SBI 20160512 Changed the scrollable list type.
|
177
|
*/
|
178
|
|
179
|
package com.goldencode.p2j.ui.client;
|
180
|
@@ -414,7 +415,7 @@
|
181
|
}
|
182
|
else if (viewport().getScrollWidget() instanceof ScrollableList)
|
183
|
{
|
184
|
- offset = ((ScrollableList<O>) viewport().getScrollWidget()).getCurrentRow() + 1;
|
185
|
+ offset = ((ScrollableList) viewport().getScrollWidget()).getCurrentRow() + 1;
|
186
|
}
|
187
|
|
188
|
if (offset <= 0)
|
189
|
|
190
|
=== modified file 'src/com/goldencode/p2j/ui/client/ScrollableList.java'
|
191
|
--- src/com/goldencode/p2j/ui/client/ScrollableList.java 2016-04-20 12:23:53 +0000
|
192
|
+++ src/com/goldencode/p2j/ui/client/ScrollableList.java 2016-05-13 01:11:48 +0000
|
193
|
@@ -66,6 +66,7 @@
|
194
|
** smaller than the parent's width.
|
195
|
** 20151110 GUI combo-box fixes.
|
196
|
** 032 VIG 20160420 Added isScrollPopupSupported implementation.
|
197
|
+** 033 SBI 20160512 Changed to have a generic combobox parameter.
|
198
|
*/
|
199
|
|
200
|
package com.goldencode.p2j.ui.client;
|
201
|
@@ -87,11 +88,11 @@
|
202
|
* "contents" inside the drop-down portion of a {@link ComboBox}. For the
|
203
|
* general purpose selection list please use the {@link SelectionList} class.
|
204
|
*/
|
205
|
-public abstract class ScrollableList<O extends OutputManager<?>>
|
206
|
+public abstract class ScrollableList<O extends OutputManager<?>, C extends ComboBox<O>>
|
207
|
extends DefaultList<String, O>
|
208
|
{
|
209
|
/** ComboBox instance which this instance services. */
|
210
|
- protected ComboBox<O> box = null;
|
211
|
+ protected C box = null;
|
212
|
|
213
|
/**
|
214
|
* Create component using given configuration and data model.
|
215
|
@@ -101,7 +102,7 @@
|
216
|
* @param model
|
217
|
* The data model that represents the contents of the list.
|
218
|
*/
|
219
|
- public ScrollableList(ComboBox<O> box, ListModel<String> model)
|
220
|
+ public ScrollableList(C box, ListModel<String> model)
|
221
|
{
|
222
|
super(model);
|
223
|
allowDeselect(false);
|
224
|
@@ -281,7 +282,7 @@
|
225
|
* @return the {@link ComboBox} instance to which this drop-down
|
226
|
* list is attached to.
|
227
|
*/
|
228
|
- public ComboBox<O> getBox()
|
229
|
+ public C getBox()
|
230
|
{
|
231
|
return box;
|
232
|
}
|
233
|
|
234
|
=== modified file 'src/com/goldencode/p2j/ui/client/driver/WidgetFactory.java'
|
235
|
--- src/com/goldencode/p2j/ui/client/driver/WidgetFactory.java 2016-03-15 22:50:52 +0000
|
236
|
+++ src/com/goldencode/p2j/ui/client/driver/WidgetFactory.java 2016-05-13 01:04:43 +0000
|
237
|
@@ -32,6 +32,7 @@
|
238
|
** 014 HC 20150831 Scrolling support overhaul.
|
239
|
** 015 IAS 20160217 Added new flavor for the createScrollPane method.
|
240
|
** 016 IAS 20160315 Support for the DEBUG-ALERT attribute
|
241
|
+** 017 SBI 20160512 Changed the scrollable list type.
|
242
|
*/
|
243
|
|
244
|
package com.goldencode.p2j.ui.client.driver;
|
245
|
@@ -134,7 +135,8 @@
|
246
|
*
|
247
|
* @return instance of UI-specific implementation of {@link ScrollableList}.
|
248
|
*/
|
249
|
- ScrollableList<O> createScrollableList(ComboBox<O> parent, ListModel<String> model);
|
250
|
+ ScrollableList<O, ? extends ComboBox<O>> createScrollableList(ComboBox<O> parent,
|
251
|
+ ListModel<String> model);
|
252
|
|
253
|
/**
|
254
|
* Create UI-specific {@link DropDown} implementation.
|
255
|
|
256
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java'
|
257
|
--- src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java 2016-05-02 13:37:02 +0000
|
258
|
+++ src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java 2016-05-13 01:17:36 +0000
|
259
|
@@ -60,7 +60,7 @@
|
260
|
** 021 HC 20160406 COMBO-BOX drop-down resources cleanup. Various drop-down related fixes.
|
261
|
** 022 HC 20160413 Fixed COMBO-BOX focus management, this also resolves ENTER not confirming
|
262
|
** selected item in the drop-down.
|
263
|
-** 023 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
|
264
|
+** 023 SBI 20160512 Fixed the web combobox entry and drop down list items to be aligned within
|
265
|
** their boxes.
|
266
|
*/
|
267
|
|
268
|
@@ -79,6 +79,7 @@
|
269
|
import com.goldencode.p2j.ui.client.format.*;
|
270
|
import com.goldencode.p2j.ui.client.gui.driver.*;
|
271
|
import com.goldencode.p2j.ui.client.gui.GuiFontResolver.FontCache;
|
272
|
+import com.goldencode.p2j.ui.client.model.*;
|
273
|
import com.goldencode.p2j.ui.client.widget.*;
|
274
|
import com.goldencode.p2j.ui.client.ScrollBar.Bars;
|
275
|
import com.goldencode.p2j.util.*;
|
276
|
@@ -1152,6 +1153,20 @@
|
277
|
}
|
278
|
|
279
|
/**
|
280
|
+ * Creates the scrollable list for this combobox based on the provided list model.
|
281
|
+ *
|
282
|
+ * @param model
|
283
|
+ * The scrollable list model.
|
284
|
+ *
|
285
|
+ * @return The scrollable list.
|
286
|
+ */
|
287
|
+ @Override
|
288
|
+ public ScrollableList<GuiOutputManager, ? extends ComboBox<GuiOutputManager>> create(ListModel<String> model)
|
289
|
+ {
|
290
|
+ return new ScrollableSelectionListGuiImpl(this, model);
|
291
|
+ }
|
292
|
+
|
293
|
+ /**
|
294
|
* Determine the mouse actions processed by this widget.
|
295
|
*
|
296
|
* @return See above.
|
297
|
@@ -1291,7 +1306,9 @@
|
298
|
private void createSimpleList()
|
299
|
{
|
300
|
// create the drop-down box
|
301
|
- simpleList = screen().getFactory().createScrollableList(this, this.model());
|
302
|
+ // The direct cast is save due to the create factory method returns instances of this type
|
303
|
+ simpleList = (ScrollableSelectionListGuiImpl) screen().getFactory().createScrollableList(
|
304
|
+ this, this.model());
|
305
|
|
306
|
// register it as a new frame
|
307
|
simpleListPane = screen().getFactory().createScrollPane(simpleList);
|
308
|
@@ -1499,7 +1516,6 @@
|
309
|
int yt = orig.y + 1 + (dim.height + fnt.pointSize)/2;
|
310
|
gd.setFontStyle(fnt.style);
|
311
|
// enabled state controls text drawing
|
312
|
- int boxWidth = dim.width - DROP_DOWN_BUTTON_SIZE;
|
313
|
if (isEnabled())
|
314
|
{
|
315
|
if (focused)
|
316
|
@@ -1510,14 +1526,14 @@
|
317
|
{
|
318
|
gd.setColor(gc.fgColor);
|
319
|
}
|
320
|
- gd.drawString(display, boxWidth, dim.height, xt, yt, 0, 0);
|
321
|
+ gd.drawString(display, xt, yt, w, h, orig.x, orig.y);
|
322
|
}
|
323
|
else
|
324
|
{
|
325
|
gd.setColor(lightShadow);
|
326
|
- gd.drawString(display, boxWidth, dim.height, xt + 1, yt + 1, 1, 1);
|
327
|
+ gd.drawString(display, xt + 1, yt + 1, w, h, orig.x, orig.y);
|
328
|
gd.setColor(darkShadow);
|
329
|
- gd.drawString(display, boxWidth, dim.height, xt, yt, 0, 0);
|
330
|
+ gd.drawString(display, xt, yt, w, h, orig.x, orig.y);
|
331
|
}
|
332
|
|
333
|
// draw dotted rectangle around focused item text
|
334
|
|
335
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/GuiWidgetFactory.java'
|
336
|
--- src/com/goldencode/p2j/ui/client/gui/GuiWidgetFactory.java 2016-03-15 22:50:52 +0000
|
337
|
+++ src/com/goldencode/p2j/ui/client/gui/GuiWidgetFactory.java 2016-05-13 01:08:24 +0000
|
338
|
@@ -44,6 +44,7 @@
|
339
|
** 024 EVL 20160127 Adding support for slider widget creation.
|
340
|
** 025 IAS 20160217 Added new flavor for the createScrollPane method.
|
341
|
** 026 IAS 20160315 Support for the DEBUG-ALERT attribute
|
342
|
+** 027 SBI 20160512 Changed the scrollable list type.
|
343
|
*/
|
344
|
|
345
|
package com.goldencode.p2j.ui.client.gui;
|
346
|
@@ -212,10 +213,12 @@
|
347
|
* @return instance of UI-specific implementation of {@link ScrollableList}.
|
348
|
*/
|
349
|
@Override
|
350
|
- public ScrollableSelectionListGuiImpl createScrollableList(ComboBox<GuiOutputManager> parent,
|
351
|
- ListModel<String> model)
|
352
|
+ public ScrollableList<GuiOutputManager,
|
353
|
+ ? extends ComboBox<GuiOutputManager>> createScrollableList(
|
354
|
+ ComboBox<GuiOutputManager> parent,
|
355
|
+ ListModel<String> model)
|
356
|
{
|
357
|
- return new ScrollableSelectionListGuiImpl(parent, model);
|
358
|
+ return parent.create(model);
|
359
|
}
|
360
|
|
361
|
/**
|
362
|
|
363
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/ScrollableSelectionListGuiImpl.java'
|
364
|
--- src/com/goldencode/p2j/ui/client/gui/ScrollableSelectionListGuiImpl.java 2016-05-02 13:37:02 +0000
|
365
|
+++ src/com/goldencode/p2j/ui/client/gui/ScrollableSelectionListGuiImpl.java 2016-05-13 01:13:42 +0000
|
366
|
@@ -46,8 +46,10 @@
|
367
|
** 016 HC 20160406 COMBO-BOX drop-down resources cleanup. Various drop-down related fixes.
|
368
|
** 017 HC 20160413 Fixed COMBO-BOX focus management, this also resolves ENTER not confirming
|
369
|
** selected item in the drop-down.
|
370
|
-** 018 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
|
371
|
-** their boxes, fixed GuiFontResolver to have a correct top level window.
|
372
|
+** 018 SBI 20160512 Fixed the web combobox entry and drop down list items to be aligned within
|
373
|
+** their boxes, fixed GuiFontResolver to have a correct top level window, changed
|
374
|
+** to provide the generic combobox parameter.
|
375
|
+.
|
376
|
*/
|
377
|
|
378
|
package com.goldencode.p2j.ui.client.gui;
|
379
|
@@ -72,7 +74,7 @@
|
380
|
*/
|
381
|
@SuppressWarnings("unchecked")
|
382
|
public class ScrollableSelectionListGuiImpl
|
383
|
-extends ScrollableList<GuiOutputManager>
|
384
|
+extends ScrollableList<GuiOutputManager, ComboBoxGuiImpl>
|
385
|
{
|
386
|
/** Screen driver */
|
387
|
private GuiDriver gd;
|
388
|
@@ -118,7 +120,7 @@
|
389
|
* @param model
|
390
|
* The data model that represents the contents of the list.
|
391
|
*/
|
392
|
- ScrollableSelectionListGuiImpl(ComboBox<GuiOutputManager> box, ListModel<String> model)
|
393
|
+ ScrollableSelectionListGuiImpl(ComboBoxGuiImpl box, ListModel<String> model)
|
394
|
{
|
395
|
super(box, model);
|
396
|
|
397
|
@@ -167,13 +169,13 @@
|
398
|
// get location and size
|
399
|
NativePoint p = physicalLocation();
|
400
|
final NativeDimension d = physicalDimension();
|
401
|
- final int rowHeight = ((ComboBoxGuiImpl)box).getRowHeight();
|
402
|
+ final int rowHeight = getBox().getRowHeight();
|
403
|
|
404
|
// TODO: remove this line and rely on the set size, modifying
|
405
|
// the size here is very confusing and may lead
|
406
|
// to unexpected results
|
407
|
d.height = box.config().mode == ComboBoxConfig.Mode.SIMPLE
|
408
|
- ? ((ComboBoxGuiImpl)box).getSimpleListVisibleHeight()
|
409
|
+ ? getBox().getSimpleListVisibleHeight()
|
410
|
: rowsVisible * rowHeight;
|
411
|
|
412
|
// set up clipping rectangle
|
413
|
@@ -254,7 +256,7 @@
|
414
|
return;
|
415
|
}
|
416
|
|
417
|
- int rowHeight = ((ComboBoxGuiImpl)box).getRowHeight();
|
418
|
+ int rowHeight = getBox().getRowHeight();
|
419
|
|
420
|
synchronized (this)
|
421
|
{
|
422
|
@@ -304,7 +306,7 @@
|
423
|
return;
|
424
|
}
|
425
|
|
426
|
- int rowHeight = ((ComboBoxGuiImpl)box).getRowHeight();
|
427
|
+ int rowHeight = getBox().getRowHeight();
|
428
|
|
429
|
synchronized (this)
|
430
|
{
|
431
|
@@ -349,7 +351,7 @@
|
432
|
@Override
|
433
|
public void processKeyEvent(KeyInput kvt)
|
434
|
{
|
435
|
- ComboBoxGuiImpl cbbRef = (ComboBoxGuiImpl) getBox();
|
436
|
+ ComboBoxGuiImpl cbbRef = getBox();
|
437
|
int key = kvt.actionCode();
|
438
|
|
439
|
// disable ENTER key itself as event generator to avoid value change duplication
|
440
|
@@ -699,11 +701,12 @@
|
441
|
}
|
442
|
|
443
|
// draw item text
|
444
|
- gd.drawString(getItemText(number), rw - ((ComboBoxGuiImpl)box).getDropDownScrollBarWidth(),
|
445
|
- rh,
|
446
|
+ gd.drawString(getItemText(number),
|
447
|
box != null && box.config().mode == ComboBoxConfig.Mode.SIMPLE
|
448
|
? x + ComboBoxGuiImpl.ENTRY_SHIFT : x + ComboBoxGuiImpl.TEXT_SHIFT,
|
449
|
- y + 1 + (rh + fontSize)/2, 0, 0);
|
450
|
+ y + 1 + (rh + fontSize)/2,
|
451
|
+ rw - getBox().getDropDownScrollBarWidth() - ComboBoxGuiImpl.ENTRY_SHIFT,
|
452
|
+ rh, x, y);
|
453
|
|
454
|
// draw the dotted line for selected item (not for SIMPLE mode of the combo-box)
|
455
|
if (enabled && number == currentRow() &&
|
456
|
@@ -712,7 +715,7 @@
|
457
|
gd.setLineStroke(LineStroke.DOTTED_SMALL);
|
458
|
gd.setColor(selectionDots);
|
459
|
// take into account possible vertical scrollbar width
|
460
|
- gd.drawRect(x, y, rw - 1 - ((ComboBoxGuiImpl)box).getDropDownScrollBarWidth(), rh - 1);
|
461
|
+ gd.drawRect(x, y, rw - 1 - getBox().getDropDownScrollBarWidth(), rh - 1);
|
462
|
// restore default line style
|
463
|
gd.setLineStroke(LineStroke.DEFAULT);
|
464
|
}
|
465
|
|
466
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/AbstractGuiDriver.java'
|
467
|
--- src/com/goldencode/p2j/ui/client/gui/driver/AbstractGuiDriver.java 2016-05-06 16:14:46 +0000
|
468
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/AbstractGuiDriver.java 2016-05-13 01:21:07 +0000
|
469
|
@@ -706,29 +706,26 @@
|
470
|
}
|
471
|
|
472
|
/**
|
473
|
- * Draw a string which can be centered within its box and can have an offset along horizontal
|
474
|
- * and/or vertical. If the box is provided width its nonzero width and height, then x and y
|
475
|
- * coordinates don't take into account and the given text is centered within the provided box
|
476
|
- * and shifted along horizontal and/or vertical.
|
477
|
+ * Draw a string using the provided text box and text offset position.
|
478
|
*
|
479
|
- * @param text
|
480
|
- * text string to draw.
|
481
|
- * @param boxWidth
|
482
|
- * The text box width, which needs to be matched when drawing.
|
483
|
- * @param boxHeight
|
484
|
- * The text box width, which needs to be matched when drawing.
|
485
|
- * @param x
|
486
|
- * The left position.
|
487
|
- * @param y
|
488
|
- * The top position.
|
489
|
- * @param xOffset
|
490
|
- * The horizontal text offset from its centered position.
|
491
|
- * @param yOffset
|
492
|
- * The vertical text offset from its centered position.
|
493
|
+ * @param text
|
494
|
+ * text string to draw.
|
495
|
+ * @param x
|
496
|
+ * The left text position.
|
497
|
+ * @param y
|
498
|
+ * The top text position.
|
499
|
+ * @param boxWidth
|
500
|
+ * The text box width, which needs to be matched when drawing.
|
501
|
+ * @param boxHeight
|
502
|
+ * The text box height, which needs to be matched when drawing.
|
503
|
+ * @param xBoxCoord
|
504
|
+ * The horizontal box position.
|
505
|
+ * @param yBoxCoord
|
506
|
+ * The vertical box position.
|
507
|
*/
|
508
|
@Override
|
509
|
- public void drawString(String text, int boxWidth, int boxHeight, int x, int y,
|
510
|
- int xOffset, int yOffset)
|
511
|
+ public void drawString(String text, int x, int y, int boxWidth, int boxHeight,
|
512
|
+ int xBoxCoord, int yBoxCoord)
|
513
|
{
|
514
|
if (isEmptyText(text))
|
515
|
{
|
516
|
@@ -741,8 +738,8 @@
|
517
|
ps.y = y;
|
518
|
ps.width = boxWidth;
|
519
|
ps.height = boxHeight;
|
520
|
- ps.xOffset = xOffset;
|
521
|
- ps.yOffset = yOffset;
|
522
|
+ ps.xOffset = xBoxCoord;
|
523
|
+ ps.yOffset = yBoxCoord;
|
524
|
|
525
|
ews.offer(ps);
|
526
|
}
|
527
|
|
528
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java'
|
529
|
--- src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java 2016-05-02 13:05:43 +0000
|
530
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java 2016-05-13 01:20:09 +0000
|
531
|
@@ -178,28 +178,25 @@
|
532
|
public void drawStringCentered(String text, int legacyWidth, int legacyHeight, int x, int height);
|
533
|
|
534
|
/**
|
535
|
- * Draw a string which can be centered within its box and can have an offset along horizontal
|
536
|
- * and/or vertical. If the box is provided width its nonzero width and height, then x and y
|
537
|
- * coordinates don't take into account and the given text is centered within the provided box
|
538
|
- * and shifted along horizontal and/or vertical.
|
539
|
+ * Draw a string using the provided text box and text offset position.
|
540
|
*
|
541
|
* @param text
|
542
|
* text string to draw.
|
543
|
+ * @param x
|
544
|
+ * The left text position.
|
545
|
+ * @param y
|
546
|
+ * The top text position.
|
547
|
* @param boxWidth
|
548
|
* The text box width, which needs to be matched when drawing.
|
549
|
* @param boxHeight
|
550
|
- * The text box width, which needs to be matched when drawing.
|
551
|
- * @param x
|
552
|
- * The left position.
|
553
|
- * @param y
|
554
|
- * The top position.
|
555
|
- * @param xOffset
|
556
|
- * The horizontal text offset from its centered position.
|
557
|
- * @param yOffset
|
558
|
- * The vertical text offset from its centered position.
|
559
|
+ * The text box height, which needs to be matched when drawing.
|
560
|
+ * @param xBoxCoord
|
561
|
+ * The horizontal box position.
|
562
|
+ * @param yBoxCoord
|
563
|
+ * The vertical box position.
|
564
|
*/
|
565
|
- public void drawString(String text, int boxWidth, int boxHeight, int x, int y,
|
566
|
- int xOffset, int yOffset);
|
567
|
+ public void drawString(String text, int x, int y, int boxWidth, int boxHeight,
|
568
|
+ int xBoxCoord, int yBoxCoord);
|
569
|
|
570
|
/**
|
571
|
* The method performs a layout operation on the supplied text and
|
572
|
|
573
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java'
|
574
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java 2016-05-02 13:05:43 +0000
|
575
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java 2016-05-13 01:21:50 +0000
|
576
|
@@ -2540,30 +2540,27 @@
|
577
|
}
|
578
|
|
579
|
/**
|
580
|
- * Draw a string which can be centered within its box and can have an offset along horizontal
|
581
|
- * and/or vertical. If the box is provided width its nonzero width and height, then x and y
|
582
|
- * coordinates don't take into account and the given text is centered within the provided box
|
583
|
- * and shifted along horizontal and/or vertical.
|
584
|
+ * Draw a string using the provided text box and text offset position.
|
585
|
*
|
586
|
* @param text
|
587
|
* text string to draw.
|
588
|
* @param centered
|
589
|
* Flag indicating if the text is centered vertically.
|
590
|
* @param x
|
591
|
- * The left position.
|
592
|
+ * The left text position.
|
593
|
* @param y
|
594
|
- * The top position.
|
595
|
+ * The top text position.
|
596
|
* @param boxWidth
|
597
|
* The text box width, which needs to be matched when drawing.
|
598
|
* @param boxHeight
|
599
|
- * The text box width, which needs to be matched when drawing.
|
600
|
- * @param xOffset
|
601
|
- * The horizontal text offset from its centered position.
|
602
|
- * @param yOffset
|
603
|
- * The vertical text offset from its centered position.
|
604
|
+ * The text box height, which needs to be matched when drawing.
|
605
|
+ * @param xBoxCoord
|
606
|
+ * The horizontal box position.
|
607
|
+ * @param yBoxCoord
|
608
|
+ * The vertical box position.
|
609
|
*/
|
610
|
public void drawString(String text, boolean centered, int x, int y, int boxWidth, int boxHeight,
|
611
|
- int xOffset, int yOffset)
|
612
|
+ int xBoxCoord, int yBoxCoord)
|
613
|
{
|
614
|
int length = text.length() * 2 + 33;
|
615
|
byte[] message = allocateDrawingOp(PaintPrimitives.DRAW_STRING, length);
|
616
|
@@ -2590,10 +2587,10 @@
|
617
|
writeMessageInt32(message, offset, boxHeight);
|
618
|
offset += 4;
|
619
|
|
620
|
- writeMessageInt32(message, offset, xOffset);
|
621
|
+ writeMessageInt32(message, offset, xBoxCoord);
|
622
|
offset += 4;
|
623
|
|
624
|
- writeMessageInt32(message, offset, yOffset);
|
625
|
+ writeMessageInt32(message, offset, yBoxCoord);
|
626
|
offset += 4;
|
627
|
}
|
628
|
|
629
|
|
630
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.canvas_renderer.js'
|
631
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.canvas_renderer.js 2016-05-05 16:12:00 +0000
|
632
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.canvas_renderer.js 2016-05-13 00:50:26 +0000
|
633
|
@@ -27,8 +27,8 @@
|
634
|
** SBI 20160213 Reduced putImageData invocations for horizontal and vertical lines.
|
635
|
** SBI 20160322 Changed to work around if the window canvas has a zero width or height.
|
636
|
** 006 SBI 20160415 Replaced logFormatted(...) by log(...).
|
637
|
-** 007 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
|
638
|
-** their boxes, added drawTextBoxAlligned.
|
639
|
+** 007 SBI 20160512 Fixed the web combobox entry and drop down list items to be aligned within
|
640
|
+** their boxes, added drawTextWithinBox.
|
641
|
*/
|
642
|
|
643
|
"use strict";
|
644
|
@@ -1778,63 +1778,47 @@
|
645
|
}
|
646
|
|
647
|
/**
|
648
|
- * Draw a string that can be centered within its box and can have an offset along horizontal
|
649
|
- * and/or vertical. If the box is provided width its nonzero width and height, then x and y
|
650
|
- * coordinates don't take into account and the given text is centered within the provided box
|
651
|
- * and shifted along horizontal and/or vertical.
|
652
|
+ * Draw a string within its box.
|
653
|
*
|
654
|
* @param {String} text
|
655
|
* The text to draw.
|
656
|
* @param {Number} x
|
657
|
- * The left position.
|
658
|
+ * The left text position.
|
659
|
* @param {Number} y
|
660
|
- * The top position.
|
661
|
+ * The top text position.
|
662
|
* @param {Number} boxWidth
|
663
|
- * The text box width, which needs to be matched when drawing.
|
664
|
+ * The text box width.
|
665
|
* @param {Number} boxHeight
|
666
|
- * The text box width, which needs to be matched when drawing.
|
667
|
- * @param {Number} xOffset
|
668
|
- * The horizontal text offset from its centered position.
|
669
|
- * @param {Number} yOffset
|
670
|
- * The vertical text offset from its centered position.
|
671
|
+ * The text box height.
|
672
|
+ * @param {Number} xBoxCoord
|
673
|
+ * The horizontal box position.
|
674
|
+ * @param {Number} yBoxCoord
|
675
|
+ * The vertical box position.
|
676
|
*/
|
677
|
-CanvasRenderer.prototype.drawTextBoxAlligned = function(text, x, y, boxWidth, boxHeight,
|
678
|
- xOffset, yOffset)
|
679
|
+CanvasRenderer.prototype.drawTextWithinBox = function(text, x, y, boxWidth, boxHeight,
|
680
|
+ xBoxCoord, yBoxCoord)
|
681
|
{
|
682
|
- var origY = y;
|
683
|
-
|
684
|
- var textWidth;
|
685
|
- var cfont = p2j.screen.getCurrentFont();
|
686
|
- if (cfont)
|
687
|
+ var currentFont = p2j.screen.getCurrentFont();
|
688
|
+ if (currentFont)
|
689
|
{
|
690
|
- textWidth = p2j.fonts.getTextWidth(cfont, text);
|
691
|
- if (boxWidth > 0 && textWidth > 0 && boxWidth - x - textWidth <= 1)
|
692
|
- { // ignore x padding and draw text centered.
|
693
|
- x = (boxWidth - textWidth) / 2 + xOffset;
|
694
|
- }
|
695
|
- }
|
696
|
+ var lwidth = boxWidth - x + xBoxCoord;
|
697
|
+ var textHeight = this.fontsManager.getTextHeight(currentFont, text);
|
698
|
+ var textWidth = this.fontsManager.getTextWidth(currentFont, text);
|
699
|
+
|
700
|
+ var widthScale = lwidth / textWidth;
|
701
|
+
|
702
|
+ // scale drawing context to computed width
|
703
|
+ // this scales the desired structure.x as well so it needs adjusting
|
704
|
+ this.ctx.save();
|
705
|
+ this.ctx.scale(widthScale, 1);
|
706
|
+
|
707
|
+ this.ctx.textBaseline = 'bottom';
|
708
|
|
709
|
- this.ctx.textBaseline = 'bottom';
|
710
|
-
|
711
|
- this.ctx.fillText(text, x, y);
|
712
|
-
|
713
|
- if (p2j.fonts.isUnderlined(cfont))
|
714
|
- {
|
715
|
- // if the style is underline, draw a line under the text
|
716
|
- var txtHeight = p2j.fonts.getTextHeight(cfont, text);
|
717
|
- if (textWidth === undefined)
|
718
|
- {
|
719
|
- textWidth = p2j.fonts.getTextWidth(cfont, text);
|
720
|
- }
|
721
|
-
|
722
|
- var x1 = x;
|
723
|
- var x2 = x + textWidth;
|
724
|
- var y1 = origY;
|
725
|
- var y2 = y1;
|
726
|
-
|
727
|
- this.strokeLineSegment(x1, y1, x2, y2, this.rawColor);
|
728
|
+ this.ctx.fillText(text, x / widthScale, y);
|
729
|
+ this.ctx.restore();
|
730
|
}
|
731
|
}
|
732
|
+
|
733
|
/**
|
734
|
* Draws a given text at the given (x,y) position fitted to the given text rectangle.
|
735
|
*
|
736
|
|
737
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
|
738
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2016-05-06 16:14:46 +0000
|
739
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2016-05-13 00:51:36 +0000
|
740
|
@@ -48,11 +48,11 @@
|
741
|
** 012 SBI 20160414 Fixed doWindowActivationChange(...) and activateTopVisibleWindow(...).
|
742
|
** SBI 20160422 The resize drawing operations must not be cached.
|
743
|
** 013 SBI 20160427 Added graphicsCached parameter to turn off the graphics cache for testing.
|
744
|
-** 014 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
|
745
|
-** their boxes, added drawTextBoxAlligned.
|
746
|
-** SBI 20160505 Fixed canProcessWidget to return false if the event has been prevented by
|
747
|
+** 014 SBI 20160505 Fixed canProcessWidget to return false if the event has been prevented by
|
748
|
** some mouse handler.
|
749
|
** SBI 20160506 Fixed to send the current window changes its minimized state.
|
750
|
+** SBI 20160512 Fixed the web combobox entry and drop down list items to be aligned within
|
751
|
+** their boxes, added drawTextWithinBox.
|
752
|
*/
|
753
|
|
754
|
"use strict";
|
755
|
@@ -1381,10 +1381,10 @@
|
756
|
var boxHeight = p2j.socket.readInt32BinaryMessage(message, idx + offset);
|
757
|
offset = offset + 4;
|
758
|
|
759
|
- var xOffset = p2j.socket.readInt32BinaryMessage(message, idx + offset);
|
760
|
+ var xBoxCoord = p2j.socket.readInt32BinaryMessage(message, idx + offset);
|
761
|
offset = offset + 4;
|
762
|
|
763
|
- var yOffset = p2j.socket.readInt32BinaryMessage(message, idx + offset);
|
764
|
+ var yBoxCoord = p2j.socket.readInt32BinaryMessage(message, idx + offset);
|
765
|
offset = offset + 4;
|
766
|
|
767
|
if (boxWidth === 0 || boxHeight === 0)
|
768
|
@@ -1393,8 +1393,8 @@
|
769
|
}
|
770
|
else
|
771
|
{
|
772
|
- this.canvasRenderer.drawTextBoxAlligned(text, x, y, boxWidth, boxHeight,
|
773
|
- xOffset, yOffset);
|
774
|
+ this.canvasRenderer.drawTextWithinBox(text, x, y, boxWidth, boxHeight,
|
775
|
+ xBoxCoord, yBoxCoord);
|
776
|
}
|
777
|
|
778
|
extra = " text = " + text + "; x = " + x + "; y = " + y +
|
779
|
|