Project

General

Profile

1811q_diff_20150901_4.txt

Sergey Ivanovskiy, 09/01/2015 04:58 PM

Download (3.32 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/gui/WindowTitleBar.java'
2
--- src/com/goldencode/p2j/ui/client/gui/WindowTitleBar.java	2015-09-01 20:15:57 +0000
3
+++ src/com/goldencode/p2j/ui/client/gui/WindowTitleBar.java	2015-09-01 20:51:33 +0000
4
@@ -288,24 +288,6 @@
5
                       title.location().x         - 
6
                       c.widthFromNative(nativeInsets.right);
7
       title.setWidth(twidth);
8
-      if (icon != null && icon.img != null)
9
-      {
10
-         Object[] drawingParameters = icon.calculateDrawingParameters();
11
-         int iw = (Integer) drawingParameters[0];
12
-         int ih = (Integer) drawingParameters[1];
13
-         int offsetX = (Integer) drawingParameters[2];
14
-         int offsetY = (Integer) drawingParameters[3];
15
-         boolean transparent  = (Boolean) drawingParameters[4];
16
-         boolean stretchToFit = (Boolean) drawingParameters[5];
17
-         boolean retainShape  = (Boolean) drawingParameters[6];
18
-         boolean convert3D    = (Boolean) drawingParameters[7];
19
-         /**
20
-          * Sets the window icon. The drawing parameters are due to the drawing operations are
21
-          * performed on the server side for the web rendering engine implementation.
22
-          */
23
-         gd.setIcon(icon.img, 0, 0, iw, ih, offsetX, offsetY, transparent,
24
-                   stretchToFit, retainShape, convert3D);
25
-      }
26
    }
27
    
28
    /**
29
@@ -430,6 +412,12 @@
30
    {
31
       /** Flag indicating the icon was loaded by LOAD-SMALL-ICON(). */
32
       private boolean useSmallIconSize = false;
33
+      
34
+      /**
35
+       * The boolean value indicates that the icon is changed. The flag is used
36
+       * to track setIconData usages.
37
+       */
38
+      private boolean isIconChanged;
39
 
40
       /**
41
        * Create the window icon.
42
@@ -494,7 +482,7 @@
43
          if (imgNew != null)
44
          {
45
             img = imgNew;
46
-            
47
+            isIconChanged = true;
48
             // repaint changed icon
49
             ThinClient.getInstance().eventDrawingBracket(this, false, true, new Runnable()
50
             {
51
@@ -555,6 +543,37 @@
52
             return false;
53
          }
54
       }
55
+
56
+      /**
57
+       * Sets the window icon, if the icon is changed and then draws it on the graphic device.
58
+       */
59
+      @Override
60
+      public void draw()
61
+      {
62
+         if (isIconChanged && img != null)
63
+         {
64
+            isIconChanged = false;
65
+            Object[] drawingParameters = calculateDrawingParameters();
66
+            int iw = (Integer) drawingParameters[0];
67
+            int ih = (Integer) drawingParameters[1];
68
+            int offsetX = (Integer) drawingParameters[2];
69
+            int offsetY = (Integer) drawingParameters[3];
70
+            boolean transparent  = (Boolean) drawingParameters[4];
71
+            boolean stretchToFit = (Boolean) drawingParameters[5];
72
+            boolean retainShape  = (Boolean) drawingParameters[6];
73
+            boolean convert3D    = (Boolean) drawingParameters[7];
74
+            /**
75
+             * Sets the window icon. The drawing parameters are due to the drawing operations are
76
+             * performed on the server side for the web rendering engine implementation.
77
+             */
78
+            gd.setIcon(img, 0, 0, iw, ih, offsetX, offsetY, transparent,
79
+                      stretchToFit, retainShape, convert3D);
80
+         }
81
+
82
+         super.draw();
83
+      }
84
+      
85
+      
86
    }
87
    
88
    /**
89