harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r555691 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/BorderLayout.java test/api/java/common/java/awt/BorderLayoutRTest.java
Date Thu, 12 Jul 2007 16:44:44 GMT
Author: ayza
Date: Thu Jul 12 09:44:43 2007
New Revision: 555691

URL: http://svn.apache.org/viewvc?view=rev&rev=555691
Log:
Applying patch from HARMONY-4085 ([classlib][awt][compatibility] BorderLayout does not invoke
Component.setSize(int, int) of its components)

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java?view=diff&rev=555691&r1=555690&r2=555691
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java
Thu Jul 12 09:44:43 2007
@@ -32,6 +32,7 @@
 
 import org.apache.harmony.awt.FieldsAccessor;
 import org.apache.harmony.awt.internal.nls.Messages;
+import org.apache.harmony.awt.wtk.NativeWindow;
 
 
 public class BorderLayout implements LayoutManager2, Serializable {
@@ -481,16 +482,21 @@
         int middleY = clientRect.y;
 
         if (visibleComponents[N] != null) {
+            visibleComponents[N].setSize(clientRect.width, 
+                    prefCompSizes[N].height);
             visibleComponents[N].setBounds(clientRect.x, clientRect.y,
-                    clientRect.width, prefCompSizes[N].height);
+                    clientRect.width, prefCompSizes[N].height, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
             middleY += prefCompSizes[N].height + vGap;
         }
         int middleHeight = clientRect.height - prefCompSizes[N].height
                 - prefCompSizes[S].height - vGapOverhead;
         middleHeight = Math.max(middleHeight, 0);
         if (visibleComponents[W] != null) {
+            visibleComponents[W].setSize(prefCompSizes[W].width, middleHeight);
             visibleComponents[W].setBounds(clientRect.x, middleY,
-                    prefCompSizes[W].width, middleHeight);
+                    prefCompSizes[W].width, middleHeight, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
             centerX += prefCompSizes[W].width + hGap;
         }
         int middleWidth = clientRect.width - prefCompSizes[W].width -
@@ -500,14 +506,19 @@
             visibleComponents[C].setBounds(centerX, middleY, middleWidth, middleHeight);
         }
         if (visibleComponents[S] != null) {
+            visibleComponents[S].setSize(clientRect.width, 
+                    prefCompSizes[S].height);
             visibleComponents[S].setBounds(clientRect.x,
                     clientRect.y + clientRect.height - prefCompSizes[S].height,
-                    clientRect.width, prefCompSizes[S].height);
+                    clientRect.width, prefCompSizes[S].height, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
         }
         if (visibleComponents[E] != null) {
+            visibleComponents[E].setSize(prefCompSizes[E].width, middleHeight);
             visibleComponents[E].setBounds(
                     clientRect.x + clientRect.width - prefCompSizes[E].width,
-                    middleY, prefCompSizes[E].width, middleHeight);
+                    middleY, prefCompSizes[E].width, middleHeight, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
         }
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java?view=diff&rev=555691&r1=555690&r2=555691
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
Thu Jul 12 09:44:43 2007
@@ -110,5 +110,49 @@
         assertEquals(defSize, layout.preferredLayoutSize(emptyContainer));
     }   
     
-    
+    /**
+     * Regression for HARMONY-4085
+     */
+    public final void testHarmony4085() {
+        final Frame f = new Frame();
+        final boolean[] isInvoked = new boolean[4];
+
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[0] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.EAST);
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[1] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.WEST);
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[2] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.NORTH);
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[3] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.SOUTH);
+
+        f.setSize(100, 100);
+        f.setVisible(true);
+        f.dispose();
+
+        assertTrue(isInvoked[0]);
+        assertTrue(isInvoked[1]);
+        assertTrue(isInvoked[2]);
+        assertTrue(isInvoked[3]);
+    }
 }



Mime
View raw message