Project

General

Profile

1123.diff

Vadim Gindin, 11/23/2015 03:09 AM

Download (14.1 KB)

View differences:

src/com/goldencode/p2j/ui/MenuWidget.java 2015-11-23 07:48:49 +0000
14 14
**                  added initialization code.
15 15
** 003 VIG 20150501 Implemented CommonHandleTree interface.
16 16
** 004 VIG 20150823 Fixed firstChild and lastChild methods.
17
** 005 VIG 20151123 Added setVisible methods showing the "not setable" error.
17 18
*/
18 19

  
19 20
package com.goldencode.p2j.ui;
......
130 131
   }
131 132
   
132 133
   /**
134
    * Set the VISIBLE writable attribute.
135
    *
136
    * @param    visible
137
    *           The new value for the VISIBLE attribute.
138
    */
139
   @Override
140
   public void setVisible(logical visible)
141
   {
142
      String name = dynamic().getValue() ? "widget" : name().getValue();
143
      ErrorManager.recordOrShowError(4052, 
144
               "VISIBLE is not a setable attribute for MENU " + name, false);
145
   }
146

  
147
   /**
148
    * Set the VISIBLE writable attribute.
149
    *
150
    * @param    visible
151
    *           The new value for the VISIBLE attribute.
152
    */
153
   @Override
154
   public void setVisible(boolean visible)
155
   {
156
      String name = dynamic().getValue() ? "widget" : name().getValue();
157
      ErrorManager.recordOrShowError(4052, 
158
               "VISIBLE is not a setable attribute for MENU " + name, false);
159
   }
160

  
161
   /**
133 162
    * Finds menu-item in this menu tree. It can appear on different levels.
134 163
    * Menu-item is searched using some sort of depth-first algorithm.
135 164
    * See {@link #findMenuItemInt(String)}
src/com/goldencode/p2j/ui/chui/StatusLineImpl.java 2015-11-23 07:50:21 +0000
21 21
**                  the widget or at the caller. Refs #2254
22 22
** 007 CA  20141119 Refactored drawing code to enable multiple OS windows, for GUI support.  Misc
23 23
**                  changes/fixes related to drawing on multiple windows.
24
** 008 VIG 20151123 Added assign fix to take menubar into consideration.
24 25
*/
25 26

  
26 27
package com.goldencode.p2j.ui.chui;
......
89 90
      window.getContentPane().add(this);
90 91
      
91 92
      Dimension screenSize = window.screenDimension();
93
      double height = screenSize.height - 1;
94
      if (window.getMenubar() != null)
95
         height -= 1;
92 96
      
93
      this.setLocation(0, screenSize.height - 1);
97
      this.setLocation(0, height);
94 98
      
95 99
      this.setLength((int) screenSize.width - Window.INSERT_TEXT.length());
96 100
      this.setColor(Color.NORMAL);
src/com/goldencode/p2j/ui/chui/ThinClient.java 2015-11-22 16:25:02 +0000
2184 2184
**                           marked as HIDDEN, do not show the window.
2185 2185
**                           More fixes related to working with HIDDEN frame/widgets and resolving  
2186 2186
**                           the window when nested frames are viewed directly.
2187
**     VIG 20151118          Prevent ENTRY raising and focus request for click of the button other 
2188
**                           than left button for all widgets.
2187 2189
*/
2188 2190

  
2189 2191
package com.goldencode.p2j.ui.chui;
2190 2192

  
2193
import java.awt.event.MouseEvent;
2191 2194
import java.io.*;
2192 2195
import java.lang.reflect.*;
2193 2196
import java.util.*;
......
10661 10664
         }
10662 10665

  
10663 10666
         wnd.getMenubar().setVisible(true);
10667
         wnd.doLayout();
10664 10668
         
10665 10669
         eventDrawingBracket(wnd, new Runnable()
10666 10670
         {
10667 10671
            @Override
10668 10672
            public void run()
10669 10673
            {
10670
               wnd.getMenubar().repaint();               
10674
               wnd.repaint();               
10671 10675
            }
10672 10676
         });
10673 10677
      }
......
15255 15259
             evtID == MouseEvt.MOUSE_RELEASED ||
15256 15260
             evtID == MouseEvt.MOUSE_CLICKED)
15257 15261
         {
15258
            maySwitchFocus = (mouseSource != null && evtID == MouseEvt.MOUSE_PRESSED);
15262
            // ENTRY event and focus request are sent only for a press of the left mouse button 
15263
            // FILL-IN: ENTRY is sent later, after pop-up menu is closed.
15264
            maySwitchFocus = (mouseSource != null && 
15265
                              evtID == MouseEvt.MOUSE_PRESSED && 
15266
                              evt.getEvent().getButton() == MouseEvent.BUTTON1);
15267
            
15259 15268
            Widget<?> focus = UiUtils.getCurrentFocus();
15260 15269
            
15261 15270
            if (focus != null && focus.isLeaveEventRequired((Widget) mouseSource, evt))
src/com/goldencode/p2j/ui/client/Window.java 2015-11-23 07:57:06 +0000
243 243
**     CA  20151106          A fix for HIDDEN attribute: distinguish between HIDE statement and 
244 244
**                           setting the HIDDEN attribute to true.
245 245
**     HC  20151112          Implemented THREE-D runtime support.
246
**     VIG 20151123          Fixed afterConfigUpdate: added menu reset case and support of dynamic
247
**                           menu assigning: make menubar visible if window is already visible.
246 248
*/
247 249

  
248 250
package com.goldencode.p2j.ui.client;
......
2254 2256
      {
2255 2257
         menubar = (Menu<O>) this.screen().getRegistry().getComponent(config.menubarId);
2256 2258
         
2257
         if (menubar != null)
2259
         if (menubar != null && menubar.parent() == null)
2258 2260
         {
2259
            if (menubar.parent() == null)
2260
            {
2261
               getContentPane().add(menubar);
2262
            }
2261
            getContentPane().add(menubar);
2263 2262
         }
2264 2263
         
2265
         // We must set MENUBAR visible only after check if enabled frames are exist.
2266
         if (ThinClient.getInstance().isChui())
2264
         // We must set MENUBAR visible only after check if enabled frames are exist a start
2265
         // or if this window already realized to support dynamic MENUBAR assigning in trigger.
2266
         if (isVisible())
2267 2267
         {
2268 2268
            menubar.setVisible(true);
2269 2269
         }
......
2273 2273

  
2274 2274
      if (config.menubarId == 0 && beforeUpdate.menubarId != 0)
2275 2275
      {
2276
         if (menubar != null)
2277
         {
2278
            getContentPane().remove(menubar);
2279
         }
2280
         
2276 2281
         menubar = null;
2277 2282
         
2278 2283
         layout = true;
src/com/goldencode/p2j/ui/client/chui/MessageAreaImpl.java 2015-11-23 07:50:53 +0000
30 30
** 012 CA  20151006 Changes to allow multi-window frame placement in GUI.
31 31
** 013 HC  20151013 Changes to extend GUI multi-window focus management and ACTIVE-WINDOW system
32 32
**                  handle processing to modal windows.
33
** 014 VIG 20151123 Added assign fix to take menubar into consideration.
33 34
*/
34 35

  
35 36
package com.goldencode.p2j.ui.client.chui;
......
139 140
      Dimension screenSize = window.screenDimension();
140 141
      for (int i = 0; i < 2; i++)
141 142
      {
143
         double height = screenSize.height - 3 + i;
144
         if (window.getMenubar() != null)
145
            height -= 1;
142 146
         StatusLine<ChuiOutputManager> line = messageLines.get(i);
143 147
         window.getContentPane().add(line);
144
         line.setLocation(0, screenSize.height - 3 + i);
148
         line.setLocation(0, height);
145 149
         line.setLength(screenSize.width);
146 150
      }
147 151
      
src/com/goldencode/p2j/ui/client/chui/WindowChuiImpl.java 2015-11-23 07:58:04 +0000
38 38
** 015 HC  20150831 Scrolling support overhaul.
39 39
** 016 CA  20150921 Added drawCaret().
40 40
** 017 VIG 20151020 Added contentPane vertical shift when the window contains MENUBAR.
41
** 018 VIG 20151123 Fixed doLayout for dynamic attach/detach menubar.
41 42
*/
42 43

  
43 44
package com.goldencode.p2j.ui.client.chui;
......
102 103
   public void doLayout()
103 104
   {
104 105
      super.doLayout();
106
      
105 107
      if (menubar != null)
106 108
      {
107 109
         menubar.doLayout();
......
109 111
         // shift window content because the MENUBAR become visible.
110 112
         contentPane.setLocation(new Point(0, 1));
111 113
      }
114
      else
115
      {
116
         contentPane.setLocation(new Point(0, 0));
117
      }
118
      
119
      messageArea.attach(this);
120
      statusLine.attach(this);
112 121
   }
113 122
   
114 123
   /**                                     
src/com/goldencode/p2j/ui/client/gui/ButtonGuiImpl.java 2015-11-18 18:36:21 +0000
60 60
**                  Improve button paintings.  Fix for several image based buttons drawing, width
61 61
**                  and height mismatch.  Some logic reordered and comments cleanup.  The images
62 62
**                  used for buttons must have convert-3d-colors flag to be on.
63
**     VIG 20151118 Added processing only left mouse button in mousePressed(..).
63 64
*/
64 65

  
65 66
package com.goldencode.p2j.ui.client.gui;
......
1401 1402
   public void mousePressed(MouseEvent e)
1402 1403
   {
1403 1404
      // push button effect
1404
      if (isEnabled() && !pressed)
1405
      if (isEnabled() && !pressed && e.getButton() == MouseEvent.BUTTON1)
1405 1406
      {
1406 1407
         requestFocus();
1407 1408
         pressed = true;
src/com/goldencode/p2j/ui/client/gui/SubMenuGuiImpl.java 2015-11-20 07:32:26 +0000
21 21
**                  handle processing to modal windows.
22 22
** 006 CA  20151026 Enclose driver API calls in select/releaseWindow().
23 23
**     VIG 20151027 Added "pressed" state transferring to neighbor MENUBAR element.
24
**                  Added mouseEntered=false to hideBody(..) and fixed javadoc.
24 25
*/
25 26

  
26 27
package com.goldencode.p2j.ui.client.gui;
......
592 593
      parent().repaint();
593 594

  
594 595
      setSubmenusPressed(false, true);
596
      this.mouseEntered = false;
595 597
      
596 598
      super.hideBody(recursive);
597 599
      
......
1137 1139
    * 
1138 1140
    * @param   pressed
1139 1141
    *          <code>true</code> means pressed, <code>false</code - means not pressed.
1142
    * @param   recursive
1143
    *          <code>true</code> denotes recursive processing of nested sub-menus. 
1140 1144
    */
1141 1145
   protected void setSubmenusPressed(boolean pressed, boolean recursive)
1142 1146
   {
src/com/goldencode/p2j/ui/client/gui/ToggleBoxGuiImpl.java 2015-11-18 18:39:27 +0000
26 26
** 010 VIG 20151023 Fixed disposition of the label and highlight rectangle relative to check-box 
27 27
**                  and highlight rectangle coloring using XOR.
28 28
**     HC  20151112 Implemented THREE-D runtime support.
29
**     VIG 20151118 Added processing only left mouse button in mousePressed(..).
29 30
*/
30 31

  
31 32
package com.goldencode.p2j.ui.client.gui;
......
56 57
   /** Checkbox width or length */
57 58
   private static int CHKBOX_WIDTH = 11;
58 59
   
59
   /**
60
    * Color which is XORed with background to draw current row highlighting (dotted rectangle).
61
    */
62
   private final static ColorRgb CURRENT_ROW_XOR_COLOR = new ColorRgb(192, 192, 192);
63
   
64 60
   /** Color resolver */
65 61
   private GuiColorResolver gc;
66 62

  
......
356 352
   }
357 353
   
358 354
   /**
359
    * Notification of a mouse dragged event occurred for this widget.  No-op by default.
360
    * 
361
    * @param    e
362
    *           The mouse event.
363
    */
364
   @Override
365
   public void mouseDragged(MouseEvent e)
366
   {
367
      // TODO implement disabling during dragging
368
   }
369
   
370
   /**
371 355
    * Notification of a mouse pressed event occurred for this widget.
372 356
    * 
373 357
    * @param    e
......
376 360
   @Override
377 361
   public void mousePressed(MouseEvent e)
378 362
   {
379
      boolean oldVal = pressed; 
380
      pressed = true;
381
      
382
      if (!oldVal)
363
      if (e.getButton() == MouseEvent.BUTTON1)
383 364
      {
384
         repaint();
365
         boolean oldVal = pressed; 
366
         pressed = true;
367

  
368
         if (!oldVal)
369
         {
370
            repaint();
371
         }
385 372
      }
386 373
   }
387 374

  
......
394 381
   @Override
395 382
   public void mouseReleased(MouseEvent e)
396 383
   {
397
      boolean oldVal = pressed; 
398
      pressed = false;
399
      
400
      if (oldVal)
384
      if (e.getButton() == MouseEvent.BUTTON1)
401 385
      {
402
         repaint();
386
         boolean oldVal = pressed; 
387
         pressed = false;
388

  
389
         if (oldVal)
390
         {
391
            repaint();
392
         }
403 393
      }
404 394
   }
405 395

  
......
435 425
      return new int[]
436 426
      {
437 427
         MouseEvent.MOUSE_CLICKED, 
438
         MouseEvent.MOUSE_DRAGGED, 
439 428
         MouseEvent.MOUSE_PRESSED,
440 429
         MouseEvent.MOUSE_RELEASED
441 430
      };
src/com/goldencode/p2j/ui/client/gui/WindowLayout.java 2015-11-23 08:00:40 +0000
45 45
** 025 HC  20151027 Implemented WINDOW MESSAGE-AREA and STATUS-AREA attributes.
46 46
**     CA  20151029 If workspace is resized, ensure the new window dimension includes the 
47 47
**                  decorations and the border.
48
** 026 VIG 20151122 Added isVisible check for menubar layout.
48 49
*/
49 50

  
50 51
package com.goldencode.p2j.ui.client.gui;
......
232 233
         if (window instanceof Window)
233 234
         {
234 235
            Menu<?> menubar = ((Window<?>) window).getMenubar();
235
            if (menubar != null)
236
            if (menubar != null && menubar.isVisible())
236 237
            {
237 238
               menubar.doLayout();
238 239
               mbarHeight = c.heightToNative(menubar.height());
......
301 302
      if (window instanceof WindowGuiImpl)
302 303
      {
303 304
         Menu<GuiOutputManager> menubar = ((WindowGuiImpl)window).getMenubar();
304
         if (menubar != null)
305
         if (menubar != null && menubar.isVisible())
305 306
         {
306 307
            MenuConfig mc = menubar.config();
307 308
            menubar.setPhysicalLocation(x, y);