Project

General

Profile

3136a_2.txt

Sergey Ivanovskiy, 08/18/2016 07:37 AM

Download (2.88 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java'
2
--- src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java	2016-07-13 01:08:05 +0000
3
+++ src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java	2016-08-18 11:23:02 +0000
4
@@ -75,6 +75,7 @@
5
 ** 038 HC  20160628 Prevented unhandled exceptions when window/frame closed/destroyed.
6
 ** 039 EVL 20160622 Adding refresh dialog title after config update.
7
 ** 040 SBI 20160713 Fixed the cursor if the mouse pointer over labels.
8
+** 041 SBI 20160818 Fixed the look and feel for empty frames according to the Progress 4GL GUI.
9
 */
10
 
11
 package com.goldencode.p2j.ui.client.gui;
12
@@ -102,6 +103,9 @@
13
 public class FrameGuiImpl
14
 extends Frame<GuiOutputManager>
15
 {
16
+   /** The frame's default size given in pixels */
17
+   private static final int DEFAULT_SIZE_IN_PIXELS = 16;
18
+   
19
    /** Screen driver */
20
    private GuiDriver gd;
21
 
22
@@ -132,6 +136,12 @@
23
    /** Keeping track on explicit virtual height setting. */
24
    private boolean explicitVirtualHeight = false;
25
    
26
+   /** The default width of the empty frame. */
27
+   private final double defaultWidth;
28
+   
29
+   /** The default height of the empty frame. */
30
+   private final double defaultHeight;
31
+   
32
    /**
33
     * Special constructor used to restore component using given configuration.
34
     * <p>
35
@@ -161,6 +171,10 @@
36
       // output manager
37
       screen = screen();
38
       cc = screen.coordinates();
39
+      
40
+      // calculates the frame's default size from its pixels size
41
+      defaultHeight = cc.heightFromNative(DEFAULT_SIZE_IN_PIXELS);
42
+      defaultWidth  = cc.widthFromNative(DEFAULT_SIZE_IN_PIXELS);
43
    }
44
    
45
    /**
46
@@ -467,7 +481,34 @@
47
       
48
       new StackLayout<GuiOutputManager>(Direction.VERTICAL).doLayout(this);
49
    }
50
-
51
+   
52
+   /**
53
+    * This method is invoked when frame is constructed and configuration of all widgets is set,
54
+    * but no other actions are performed. It has been overridden in order to set the default size
55
+    * for an empty frame according to the Progress 4GL GUI look and feel.
56
+    * 
57
+    * @param   newFrame
58
+    *          <code>true</code> value indicates that doLayout must be processed for this frame.
59
+    * @param   suppressRedraw
60
+    *          <code>true</code> means suppress redrawing of frame.
61
+    */
62
+   @Override
63
+   public void postprocess(boolean newFrame, boolean suppressRedraw)
64
+   {
65
+      AbstractContainer<GuiOutputManager> container = getContentPane();
66
+      if (container != null)
67
+      {
68
+         // if this frame has no widgets, then set its default dimension.
69
+         if (container.widgets().length == 0)
70
+         {
71
+            setWidth(defaultWidth);
72
+            setHeight(defaultHeight);
73
+         }
74
+      }
75
+      
76
+      super.postprocess(newFrame, suppressRedraw);
77
+   }
78
+   
79
    /**
80
     * Draw the peer container. The methods calls the draw() method for
81
     * ScrollPane instance for the peer container. In addition the required
82