Project

General

Profile

2923a_1.txt

Sergey Ivanovskiy, 06/02/2016 02:15 PM

Download (32.7 KB)

 
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-06-02 17:08:22 +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-06-02 17:08:22 +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-06-02 17:08:22 +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-05-13 18:02:49 +0000
112
+++ src/com/goldencode/p2j/ui/client/ComboBox.java	2016-06-02 17:08:22 +0000
113
@@ -202,6 +202,7 @@
114
 ** 103 HC  20160406          Fixed COMBO-BOX drop-down resource cleanup.
115
 ** 104 HC  20160413          Comment fix.
116
 ** 105 HC  20160511          Fixed COMBO-BOX focusing issues and related changes.
117
+** 106 SBI 20160512          Added the scrollable list factory method.
118
 */
119
 
120
 package com.goldencode.p2j.ui.client;
121
@@ -292,6 +293,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-06-02 17:08:22 +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/FontManager.java'
170
--- src/com/goldencode/p2j/ui/client/FontManager.java	2016-04-19 19:24:50 +0000
171
+++ src/com/goldencode/p2j/ui/client/FontManager.java	2016-06-02 16:57:20 +0000
172
@@ -40,6 +40,7 @@
173
 ** 020 SBI 20160110 Changed to install/upload binary fonts only if they are not detected.
174
 ** 021 EVL 20160415 Fix for system font index calculation.  Adding separate font for stack trace
175
 **                  window.
176
+** 022 SBI 20160502 Extended parameter type to create GuiFontResolver for top level windows.
177
 */
178
 
179
 package com.goldencode.p2j.ui.client;
180
@@ -279,7 +280,7 @@
181
     *
182
     * @return   See above.
183
     */
184
-   public static FontDetails<?> resolveFont(Window<?> window, int font, ScreenDriver<?> driver)
185
+   public static FontDetails<?> resolveFont(TopLevelWindow<?> window, int font, ScreenDriver<?> driver)
186
    {
187
       if (driver.isChui())
188
       {
189

    
190
=== modified file 'src/com/goldencode/p2j/ui/client/ScrollPane.java'
191
--- src/com/goldencode/p2j/ui/client/ScrollPane.java	2016-03-13 15:10:14 +0000
192
+++ src/com/goldencode/p2j/ui/client/ScrollPane.java	2016-06-02 17:08:22 +0000
193
@@ -97,6 +97,7 @@
194
 **                           duration of the drawing operation or other GUI API invocation which
195
 **                           requires access to the underlying physical window.
196
 ** 050 HC  20160313          Fixed frame scroll layout calculation.
197
+** 051 SBI 20160512          Changed the scrollable list type.
198
 */
199
 
200
 package com.goldencode.p2j.ui.client;
201
@@ -414,7 +415,7 @@
202
       }
203
       else if (viewport().getScrollWidget() instanceof ScrollableList)
204
       {
205
-         offset = ((ScrollableList<O>) viewport().getScrollWidget()).getCurrentRow() + 1;
206
+         offset = ((ScrollableList) viewport().getScrollWidget()).getCurrentRow() + 1;
207
       }
208
    
209
       if (offset <= 0)
210

    
211
=== modified file 'src/com/goldencode/p2j/ui/client/ScrollableList.java'
212
--- src/com/goldencode/p2j/ui/client/ScrollableList.java	2016-04-20 12:23:53 +0000
213
+++ src/com/goldencode/p2j/ui/client/ScrollableList.java	2016-06-02 17:08:22 +0000
214
@@ -66,6 +66,7 @@
215
 **                           smaller than the parent's width.
216
 **         20151110          GUI combo-box fixes.
217
 ** 032 VIG 20160420          Added isScrollPopupSupported implementation.
218
+** 033 SBI 20160512          Changed to have a generic combobox parameter.
219
 */
220
 
221
 package com.goldencode.p2j.ui.client;
222
@@ -87,11 +88,11 @@
223
  * "contents" inside the drop-down portion of a {@link ComboBox}. For the
224
  * general purpose selection list please use the {@link SelectionList} class.
225
  */
226
-public abstract class ScrollableList<O extends OutputManager<?>>
227
+public abstract class ScrollableList<O extends OutputManager<?>, C extends ComboBox<O>>
228
 extends DefaultList<String, O>
229
 {
230
    /** ComboBox instance which this instance services. */
231
-   protected ComboBox<O> box = null;
232
+   protected C box = null;
233
 
234
    /**
235
     * Create component using given configuration and data model.
236
@@ -101,7 +102,7 @@
237
     * @param    model
238
     *           The data model that represents the contents of the list.
239
     */
240
-   public ScrollableList(ComboBox<O> box, ListModel<String> model)
241
+   public ScrollableList(C box, ListModel<String> model)
242
    {
243
       super(model);
244
       allowDeselect(false);
245
@@ -281,7 +282,7 @@
246
     * @return   the {@link ComboBox} instance to which this drop-down 
247
     *           list is attached to.
248
     */
249
-   public ComboBox<O> getBox()
250
+   public C getBox()
251
    {
252
       return box;
253
    }
254

    
255
=== modified file 'src/com/goldencode/p2j/ui/client/driver/WidgetFactory.java'
256
--- src/com/goldencode/p2j/ui/client/driver/WidgetFactory.java	2016-03-15 22:50:52 +0000
257
+++ src/com/goldencode/p2j/ui/client/driver/WidgetFactory.java	2016-06-02 17:08:22 +0000
258
@@ -32,6 +32,7 @@
259
 ** 014 HC  20150831 Scrolling support overhaul.
260
 ** 015 IAS 20160217 Added new flavor for the createScrollPane method.
261
 ** 016 IAS 20160315 Support for the DEBUG-ALERT attribute
262
+** 017 SBI 20160512 Changed the scrollable list type.
263
 */
264
 
265
 package com.goldencode.p2j.ui.client.driver;
266
@@ -134,7 +135,8 @@
267
     *          
268
     * @return  instance of UI-specific implementation of {@link ScrollableList}.
269
     */
270
-   ScrollableList<O> createScrollableList(ComboBox<O> parent, ListModel<String> model);
271
+   ScrollableList<O, ? extends ComboBox<O>> createScrollableList(ComboBox<O>       parent,
272
+                                                                 ListModel<String> model);
273
 
274
    /**
275
     * Create UI-specific {@link DropDown} implementation.
276

    
277
=== modified file 'src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java'
278
--- src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java	2016-05-13 10:56:49 +0000
279
+++ src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java	2016-06-02 17:08:22 +0000
280
@@ -61,6 +61,8 @@
281
 ** 022 HC  20160413 Fixed COMBO-BOX focus management, this also resolves ENTER not confirming
282
 **                  selected item in the drop-down.
283
 ** 023 HC  20160511 Fixed COMBO-BOX focusing issues and related changes.
284
+** 024 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
285
+**                  their boxes.
286
 */
287
 
288
 package com.goldencode.p2j.ui.client.gui;
289
@@ -78,6 +80,7 @@
290
 import com.goldencode.p2j.ui.client.format.*;
291
 import com.goldencode.p2j.ui.client.gui.driver.*;
292
 import com.goldencode.p2j.ui.client.gui.GuiFontResolver.FontCache;
293
+import com.goldencode.p2j.ui.client.model.*;
294
 import com.goldencode.p2j.ui.client.widget.*;
295
 import com.goldencode.p2j.ui.client.ScrollBar.Bars;
296
 import com.goldencode.p2j.util.*;
297
@@ -1146,6 +1149,20 @@
298
    }
299
 
300
    /**
301
+    * Creates the scrollable list for this combobox based on the provided list model.
302
+    * 
303
+    * @param    model
304
+    *           The scrollable list model.
305
+    * 
306
+    * @return   The scrollable list.
307
+    */
308
+   @Override
309
+   public ScrollableList<GuiOutputManager, ? extends ComboBox<GuiOutputManager>> create(ListModel<String> model)
310
+   {
311
+      return new ScrollableSelectionListGuiImpl(this, model);
312
+   }
313
+
314
+   /**
315
     * Determine the mouse actions processed by this widget.
316
     * 
317
     * @return   See above.
318
@@ -1285,7 +1302,9 @@
319
    private void createSimpleList()
320
    {
321
       // create the drop-down box
322
-      simpleList = screen().getFactory().createScrollableList(this, this.model());
323
+      // The direct cast is save due to the create factory method returns instances of this type
324
+      simpleList = (ScrollableSelectionListGuiImpl) screen().getFactory().createScrollableList(
325
+               this, this.model());
326
 
327
       // register it as a new frame
328
       simpleListPane = screen().getFactory().createScrollPane(simpleList);
329
@@ -1503,14 +1522,14 @@
330
          {
331
             gd.setColor(gc.fgColor);
332
          }
333
-         gd.drawString(display, xt, yt);
334
+         gd.drawString(display, xt, yt, w, h, orig.x, orig.y);
335
       }
336
       else
337
       {
338
          gd.setColor(lightShadow);
339
-         gd.drawString(display, xt + 1, yt + 1);
340
+         gd.drawString(display, xt + 1, yt + 1, w, h, orig.x, orig.y);
341
          gd.setColor(darkShadow);
342
-         gd.drawString(display, xt, yt);
343
+         gd.drawString(display, xt, yt, w, h, orig.x, orig.y);
344
       }
345
 
346
       // draw dotted rectangle around focused item text
347

    
348
=== modified file 'src/com/goldencode/p2j/ui/client/gui/GuiFontResolver.java'
349
--- src/com/goldencode/p2j/ui/client/gui/GuiFontResolver.java	2015-05-18 20:48:28 +0000
350
+++ src/com/goldencode/p2j/ui/client/gui/GuiFontResolver.java	2016-06-02 16:57:20 +0000
351
@@ -18,6 +18,7 @@
352
 ** 005 CA  20150507 No need to re-scale the font, it gets scaled when it gets created - so all 
353
 **                  fonts are assumed to match the legacy metrics.
354
 ** 006 GES 20150425 Eliminated AWT dependencies.
355
+** 007 SBI 20160502 Extended parameter type to create GuiFontResolver for top level windows.
356
 */
357
 
358
 package com.goldencode.p2j.ui.client.gui;
359
@@ -41,7 +42,7 @@
360
    private Map<Integer, FontCache> fontCache = new HashMap<>();
361
 
362
    /** Window instance. */
363
-   private Window<?> window;
364
+   private TopLevelWindow<?> window;
365
       
366
    /** Screen driver. */
367
    private GuiDriver gd;
368
@@ -68,7 +69,7 @@
369
     * @param    config
370
     *           Widget configuration.
371
     */
372
-   public GuiFontResolver(Window<?>  window, GuiDriver gd, BaseConfig config)
373
+   public GuiFontResolver(TopLevelWindow<?>  window, GuiDriver gd, BaseConfig config)
374
    {
375
       this(window, gd, config, false);
376
    }
377
@@ -86,7 +87,7 @@
378
     *           Flag identifying that the referenced font must default to the default fixed font, 
379
     *           if is not specified.
380
     */
381
-   public GuiFontResolver(Window<?> window, GuiDriver gd, BaseConfig config, boolean fixedFont)
382
+   public GuiFontResolver(TopLevelWindow<?> window, GuiDriver gd, BaseConfig config, boolean fixedFont)
383
    {
384
       this.window = window;
385
       this.gd = gd;
386

    
387
=== modified file 'src/com/goldencode/p2j/ui/client/gui/GuiWidgetFactory.java'
388
--- src/com/goldencode/p2j/ui/client/gui/GuiWidgetFactory.java	2016-03-15 22:50:52 +0000
389
+++ src/com/goldencode/p2j/ui/client/gui/GuiWidgetFactory.java	2016-06-02 17:08:22 +0000
390
@@ -44,6 +44,7 @@
391
 ** 024 EVL 20160127 Adding support for slider widget creation.
392
 ** 025 IAS 20160217 Added new flavor for the createScrollPane method.
393
 ** 026 IAS 20160315 Support for the DEBUG-ALERT attribute
394
+** 027 SBI 20160512 Changed the scrollable list type.
395
 */
396
 
397
 package com.goldencode.p2j.ui.client.gui;
398
@@ -212,10 +213,12 @@
399
     * @return  instance of UI-specific implementation of {@link ScrollableList}.
400
     */
401
    @Override
402
-   public ScrollableSelectionListGuiImpl createScrollableList(ComboBox<GuiOutputManager> parent, 
403
-                                                              ListModel<String>           model)
404
+   public ScrollableList<GuiOutputManager,
405
+                        ? extends ComboBox<GuiOutputManager>> createScrollableList(
406
+                           ComboBox<GuiOutputManager> parent,
407
+                           ListModel<String>           model)
408
    {
409
-      return new ScrollableSelectionListGuiImpl(parent, model);
410
+      return parent.create(model);
411
    }
412
 
413
    /**
414

    
415
=== modified file 'src/com/goldencode/p2j/ui/client/gui/ScrollableSelectionListGuiImpl.java'
416
--- src/com/goldencode/p2j/ui/client/gui/ScrollableSelectionListGuiImpl.java	2016-05-11 12:40:05 +0000
417
+++ src/com/goldencode/p2j/ui/client/gui/ScrollableSelectionListGuiImpl.java	2016-06-02 17:08:22 +0000
418
@@ -47,6 +47,9 @@
419
 ** 017 HC  20160413 Fixed COMBO-BOX focus management, this also resolves ENTER not confirming
420
 **                  selected item in the drop-down.
421
 ** 018 HC  20160511 Fixed COMBO-BOX focusing issues and related changes.
422
+** 019 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
423
+**                  their boxes, fixed GuiFontResolver to have a correct top level window, changed
424
+**                  to provide the generic combobox parameter.
425
 */
426
 
427
 package com.goldencode.p2j.ui.client.gui;
428
@@ -60,7 +63,6 @@
429
 import com.goldencode.p2j.ui.chui.ThinClient;
430
 import com.goldencode.p2j.ui.client.*;
431
 import com.goldencode.p2j.ui.client.event.*;
432
-import com.goldencode.p2j.ui.client.event.listener.*;
433
 import com.goldencode.p2j.ui.client.gui.GuiFontResolver.FontCache;
434
 import com.goldencode.p2j.ui.client.gui.driver.*;
435
 import com.goldencode.p2j.ui.client.model.*;
436
@@ -72,7 +74,7 @@
437
  */
438
 @SuppressWarnings("unchecked")
439
 public class ScrollableSelectionListGuiImpl
440
-extends ScrollableList<GuiOutputManager>
441
+extends ScrollableList<GuiOutputManager, ComboBoxGuiImpl>
442
 {
443
    /** Screen driver */
444
    private GuiDriver gd;
445
@@ -118,14 +120,12 @@
446
     * @param    model
447
     *           The data model that represents the contents of the list.
448
     */
449
-   ScrollableSelectionListGuiImpl(ComboBox<GuiOutputManager> box, ListModel<String> model)
450
+   ScrollableSelectionListGuiImpl(ComboBoxGuiImpl box, ListModel<String> model)
451
    {
452
       super(box, model);
453
 
454
       // initialize screen driver
455
       gd = (GuiDriver) OutputManager.getDriver();
456
-      // and font resolver
457
-      gf = new GuiFontResolver(WindowManager.resolveWindow(this), gd, box.config(), false);
458
       // color initializing
459
       selectionBack = gd.getSysColor(SysColor.COLOR_HIGHLIGHT);
460
       selectionFore = gd.getSysColor(SysColor.COLOR_HIGHLIGHTTEXT);
461
@@ -156,20 +156,26 @@
462
 
463
       // get actual rows to view
464
       final int rowsVisible = visibleRows();
465
-      
466
+
467
+      if (gf == null)
468
+      {
469
+         // and font resolver
470
+         gf = new GuiFontResolver(topLevelWindow(), gd, box.config(), false);
471
+      }
472
+
473
       // resolve font
474
       final FontCache fntCache = gf.font();
475
 
476
       // get location and size
477
       NativePoint p = physicalLocation();
478
       final NativeDimension d = physicalDimension();
479
-      final int rowHeight = ((ComboBoxGuiImpl)box).getRowHeight();
480
+      final int rowHeight = getBox().getRowHeight();
481
       
482
       // TODO: remove this line and rely on the set size, modifying
483
       //       the size here is very confusing and may lead
484
       //       to unexpected results
485
       d.height = box.config().mode == ComboBoxConfig.Mode.SIMPLE
486
-                   ? ((ComboBoxGuiImpl)box).getSimpleListVisibleHeight()
487
+                   ? getBox().getSimpleListVisibleHeight()
488
                    : rowsVisible * rowHeight;
489
 
490
       // set up clipping rectangle
491
@@ -250,7 +256,7 @@
492
          return;
493
       }
494
       
495
-      int rowHeight = ((ComboBoxGuiImpl)box).getRowHeight();
496
+      int rowHeight = getBox().getRowHeight();
497
       
498
       if (model().size() > 0)
499
       {
500
@@ -286,7 +292,7 @@
501
          return;
502
       }
503
       
504
-      int rowHeight = ((ComboBoxGuiImpl)box).getRowHeight();
505
+      int rowHeight = getBox().getRowHeight();
506
       
507
       synchronized (this)
508
       {
509
@@ -331,7 +337,7 @@
510
    @Override
511
    public void processKeyEvent(KeyInput kvt)
512
    {
513
-      ComboBoxGuiImpl cbbRef = (ComboBoxGuiImpl) getBox();
514
+      ComboBoxGuiImpl cbbRef = getBox();
515
       int key = kvt.actionCode();
516
 
517
       // disable ENTER key itself as event generator to avoid value change duplication
518
@@ -618,10 +624,12 @@
519
       }
520
 
521
       // draw item text
522
-      gd.drawString(getItemText(number),
523
+      gd.drawString(getItemText(number), 
524
                     box != null && box.config().mode == ComboBoxConfig.Mode.SIMPLE
525
                        ? x + ComboBoxGuiImpl.ENTRY_SHIFT : x + ComboBoxGuiImpl.TEXT_SHIFT,
526
-                    y + 1 + (rh + fontSize)/2);
527
+                    y + 1 + (rh + fontSize)/2,
528
+                    rw - getBox().getDropDownScrollBarWidth() - ComboBoxGuiImpl.ENTRY_SHIFT,
529
+                    rh, x, y);
530
       
531
       // draw the dotted line for selected item (not for SIMPLE mode of the combo-box)
532
       if (enabled && number == currentRow() &&
533
@@ -630,7 +638,7 @@
534
          gd.setLineStroke(LineStroke.DOTTED_SMALL);
535
          gd.setColor(selectionDots);
536
          // take into account possible vertical scrollbar width 
537
-         gd.drawRect(x, y, rw - 1 - ((ComboBoxGuiImpl)box).getDropDownScrollBarWidth(), rh - 1);
538
+         gd.drawRect(x, y, rw - 1 - getBox().getDropDownScrollBarWidth(), rh - 1);
539
          // restore default line style
540
          gd.setLineStroke(LineStroke.DEFAULT);
541
       }
542

    
543
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/AbstractGuiDriver.java'
544
--- src/com/goldencode/p2j/ui/client/gui/driver/AbstractGuiDriver.java	2016-05-11 12:40:05 +0000
545
+++ src/com/goldencode/p2j/ui/client/gui/driver/AbstractGuiDriver.java	2016-06-02 17:08:22 +0000
546
@@ -53,6 +53,8 @@
547
 ** 018 HC  20160407 Overhaul of window-activation logic. Removed setOverlayWindowLocation(), the
548
 **                  method was unnecessary and was causing the COMBO-BOX drop-down location
549
 **                  incorrect.
550
+** 019 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
551
+**                  their boxes.
552
 */
553
 
554
 package com.goldencode.p2j.ui.client.gui.driver;
555
@@ -703,6 +705,45 @@
556
    }
557
    
558
    /**
559
+    * Draw a string using the provided text box and text offset position. 
560
+    * 
561
+    * @param    text
562
+    *           text string to draw.
563
+    * @param    x
564
+    *           The left text position.
565
+    * @param    y
566
+    *           The top text position.
567
+    * @param    boxWidth
568
+    *           The text box width, which needs to be matched when drawing.
569
+    * @param    boxHeight
570
+    *           The text box height, which needs to be matched when drawing.
571
+    * @param    xBoxCoord
572
+    *           The horizontal box position.
573
+    * @param    yBoxCoord
574
+    *           The vertical box position.
575
+    */
576
+   @Override
577
+   public void drawString(String text, int x, int y, int boxWidth, int boxHeight,
578
+                          int xBoxCoord, int yBoxCoord)
579
+   {
580
+      if (isEmptyText(text))
581
+      {
582
+         return;
583
+      }
584
+
585
+      PaintStructure ps = new PaintStructure(PaintPrimitives.DRAW_STRING);
586
+      ps.text = text;
587
+      ps.x = x;
588
+      ps.y = y;
589
+      ps.width = boxWidth;
590
+      ps.height = boxHeight;
591
+      ps.xOffset = xBoxCoord;
592
+      ps.yOffset = yBoxCoord;
593
+      
594
+      ews.offer(ps);
595
+   }
596
+
597
+   /**
598
     * The method performs a layout operation on the supplied text and 
599
     * returns the resulting paragraph height while maintaining the
600
     * supplied maximum width.
601

    
602
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java'
603
--- src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java	2016-04-21 08:31:31 +0000
604
+++ src/com/goldencode/p2j/ui/client/gui/driver/GuiDriver.java	2016-06-02 17:08:22 +0000
605
@@ -76,6 +76,8 @@
606
 **                  setDesktopBgColor(ColorRgb color).
607
 ** 042 HC  20160407 Removed setOverlayWindowLocation(), the method was unnecessary and was
608
 **                  causing the COMBO-BOX drop-down location incorrect.
609
+** 043 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
610
+**                  their boxes.
611
 */
612
 
613
 package com.goldencode.p2j.ui.client.gui.driver;
614
@@ -176,6 +178,27 @@
615
    public void drawStringCentered(String text, int legacyWidth, int legacyHeight, int x, int height);
616
    
617
    /**
618
+    * Draw a string using the provided text box and text offset position. 
619
+    * 
620
+    * @param    text
621
+    *           text string to draw.
622
+    * @param    x
623
+    *           The left text position.
624
+    * @param    y
625
+    *           The top text position.
626
+    * @param    boxWidth
627
+    *           The text box width, which needs to be matched when drawing.
628
+    * @param    boxHeight
629
+    *           The text box height, which needs to be matched when drawing.
630
+    * @param    xBoxCoord
631
+    *           The horizontal box position.
632
+    * @param    yBoxCoord
633
+    *           The vertical box position.
634
+    */
635
+   public void drawString(String text, int x, int y, int boxWidth, int boxHeight,
636
+                          int xBoxCoord, int yBoxCoord);
637
+   
638
+   /**
639
     * The method performs a layout operation on the supplied text and 
640
     * returns the resulting paragraph height while maintaining the
641
     * supplied maximum width.
642

    
643
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java'
644
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2016-03-25 01:36:48 +0000
645
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2016-06-02 16:57:20 +0000
646
@@ -34,6 +34,8 @@
647
 ** 012 CA  20160323 In getTextHeight(), return the font's height, as p2j.fonts.js computes the 
648
 **                  text's height in the same way.
649
 **     SBI 20160324 Implemented SET_DESKTOP_BGCOLOR.
650
+** 013 SBI 20160502 Fixed the web combo box entry and drop down list items to be aligned within
651
+**                  their boxes.
652
 */
653
 
654
 package com.goldencode.p2j.ui.client.gui.driver.web;
655
@@ -323,7 +325,8 @@
656
       switch (ps.id)
657
       {
658
          case DRAW_STRING:
659
-            websock.drawString(ps.text, ps.centered, ps.x, ps.y);
660
+            websock.drawString(ps.text, ps.centered, ps.x, ps.y, ps.width, ps.height,
661
+                     ps.xOffset, ps.yOffset);
662
             break;
663
          case DRAW_STRING_SCALED:
664
             websock.drawStringScaled(ps.text, ps.centered, ps.x, ps.y, ps.width, ps.height);
665

    
666
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java'
667
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2016-04-29 11:29:39 +0000
668
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2016-06-02 17:08:22 +0000
669
@@ -52,6 +52,8 @@
670
 **     SBI 20160422 The resize drawing operations must not be cached.
671
 ** 015 CA  20160429 Fix for H014/CA: do not consume QUIT, STOP or ERROR conditions, as the 
672
 **                  business logic might rely on them, if explicitly raised.
673
+** 016 SBI 20160502 Fixed the web combobox entry and drop down list items to be aligned within
674
+**                  their boxes.
675
 */
676
 
677
 package com.goldencode.p2j.ui.client.gui.driver.web;
678
@@ -2525,7 +2527,33 @@
679
     */
680
    public void drawString(String text, boolean centered, int x, int y)
681
    {
682
-      int length = 1 + 4 + text.length() * 2 + 4 + 4 + 4; 
683
+      drawString(text, centered, x, y, 0, 0, 0, 0);
684
+   }
685
+
686
+   /**
687
+    * Draw a string using the provided text box and text offset position. 
688
+    * 
689
+    * @param    text
690
+    *           text string to draw.
691
+    * @param    centered
692
+    *           Flag indicating if the text is centered vertically.
693
+    * @param    x
694
+    *           The left text position.
695
+    * @param    y
696
+    *           The top text position.
697
+    * @param    boxWidth
698
+    *           The text box width, which needs to be matched when drawing.
699
+    * @param    boxHeight
700
+    *           The text box height, which needs to be matched when drawing.
701
+    * @param    xBoxCoord
702
+    *           The horizontal box position.
703
+    * @param    yBoxCoord
704
+    *           The vertical box position.
705
+    */
706
+   public void drawString(String text, boolean centered, int x, int y, int boxWidth, int boxHeight,
707
+                          int xBoxCoord, int yBoxCoord)
708
+   {
709
+      int length = text.length() * 2 + 33; 
710
       byte[] message = allocateDrawingOp(PaintPrimitives.DRAW_STRING, length);
711
       
712
       int offset = 1;
713
@@ -2543,6 +2571,18 @@
714
       
715
       writeMessageInt32(message, offset, y);
716
       offset += 4;
717
+
718
+      writeMessageInt32(message, offset, boxWidth);
719
+      offset += 4;
720
+      
721
+      writeMessageInt32(message, offset, boxHeight);
722
+      offset += 4;
723
+      
724
+      writeMessageInt32(message, offset, xBoxCoord);
725
+      offset += 4;
726
+      
727
+      writeMessageInt32(message, offset, yBoxCoord);
728
+      offset += 4;
729
    }
730
 
731
    /**
732

    
733
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.canvas_renderer.js'
734
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.canvas_renderer.js	2016-04-15 07:35:01 +0000
735
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.canvas_renderer.js	2016-06-02 17:12:11 +0000
736
@@ -27,6 +27,8 @@
737
 **     SBI 20160213 Reduced putImageData invocations for horizontal and vertical lines.
738
 **     SBI 20160322 Changed to work around if the window canvas has a zero width or height.
739
 ** 006 SBI 20160415 Replaced logFormatted(...) by log(...).
740
+** 007 SBI 20160512 Fixed the web combobox entry and drop down list items to be aligned within
741
+**                  their boxes, added drawTextWithinBox.
742
 */
743
 
744
 "use strict";
745
@@ -1748,6 +1750,55 @@
746
 }
747
 
748
 /**
749
+ * Draw a string within its box. 
750
+ * 
751
+ * @param    {String} text
752
+ *           The text to draw.
753
+ * @param    {Number} x
754
+ *           The left text position.
755
+ * @param    {Number} y
756
+ *           The top text position.
757
+ * @param    {Number} boxWidth
758
+ *           The text box width.
759
+ * @param    {Number} boxHeight
760
+ *           The text box height.
761
+ * @param    {Number} xBoxCoord
762
+ *           The horizontal box position.
763
+ * @param    {Number} yBoxCoord
764
+ *           The vertical box position.
765
+ */
766
+CanvasRenderer.prototype.drawTextWithinBox = function(text, x, y, boxWidth, boxHeight,
767
+                                                        xBoxCoord, yBoxCoord)
768
+{
769
+   var currentFont = p2j.screen.getCurrentFont();
770
+   if (currentFont)
771
+   {
772
+      var lwidth = boxWidth - x + xBoxCoord;
773
+      var textHeight = this.fontsManager.getTextHeight(currentFont, text);
774
+      var textWidth  = this.fontsManager.getTextWidth(currentFont, text);
775
+      
776
+      var widthScale = lwidth / textWidth;
777
+      if (widthScale >= 1)
778
+      {
779
+         widthScale = 1;
780
+      }
781
+      // scale drawing context to computed width
782
+      // this scales the desired structure.x as well so it needs adjusting
783
+      this.ctx.save();
784
+      
785
+      if (widthScale < 1)
786
+      {
787
+         this.ctx.scale(widthScale, 1);
788
+      }
789
+      
790
+      this.ctx.textBaseline = 'bottom';
791
+
792
+      this.ctx.fillText(text, x / widthScale, y);
793
+      this.ctx.restore();
794
+   }
795
+}
796
+
797
+/**
798
  * Draws a given text at the given (x,y) position fitted to the given text rectangle.
799
  * 
800
  * @param    {Number} currentFont
801

    
802
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
803
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2016-04-25 19:35:35 +0000
804
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2016-06-02 17:16:30 +0000
805
@@ -47,6 +47,9 @@
806
 ** 011 HC  20160406 Overhaul of window-activation logic.
807
 ** 012 SBI 20160414 Fixed  doWindowActivationChange(...) and activateTopVisibleWindow(...).
808
 **     SBI 20160422 The resize drawing operations must not be cached.
809
+** 013 SBI 20160506 Fixed to send the current window changes its minimized state.
810
+**     SBI 20160512 Fixed the web combobox entry and drop down list items to be aligned within
811
+**                  their boxes, added drawTextWithinBox.
812
 */
813
 
814
 "use strict";
815
@@ -1365,7 +1368,29 @@
816
 
817
                y = p2j.socket.readInt32BinaryMessage(message, idx + offset);
818
                offset = offset + 4;
819
-               this.canvasRenderer.drawText(text, x, y, centered);
820
+
821
+               var boxWidth = p2j.socket.readInt32BinaryMessage(message, idx + offset);
822
+               offset = offset + 4;
823
+
824
+               var boxHeight = p2j.socket.readInt32BinaryMessage(message, idx + offset);
825
+               offset = offset + 4;
826
+
827
+               var xBoxCoord = p2j.socket.readInt32BinaryMessage(message, idx + offset);
828
+               offset = offset + 4;
829
+
830
+               var yBoxCoord = p2j.socket.readInt32BinaryMessage(message, idx + offset);
831
+               offset = offset + 4;
832
+
833
+               if (boxWidth === 0 || boxHeight === 0)
834
+               {
835
+                  this.canvasRenderer.drawText(text, x, y, centered);
836
+               }
837
+               else
838
+               {
839
+                  this.canvasRenderer.drawTextWithinBox(text, x, y, boxWidth, boxHeight,
840
+                                                          xBoxCoord, yBoxCoord);
841
+               }
842
+
843
                extra = " text = " + text + "; x = " + x + "; y = " + y +
844
                        "; centered = " + centered;
845
                break;
846