harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r478491 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/ main/java/common/javax/swing/plaf/basic/ test/api/java/common/javax/swing/
Date Thu, 23 Nov 2006 06:55:32 GMT
Author: mloenko
Date: Wed Nov 22 22:55:32 2006
New Revision: 478491

URL: http://svn.apache.org/viewvc?view=rev&rev=478491
Log:
applied patch for HARMONY-1801
[classlib][swing] JComponent.setBounds() should not cause revalidation

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java?view=diff&rev=478491&r1=478490&r2=478491
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java
Wed Nov 22 22:55:32 2006
@@ -1237,15 +1237,6 @@
         return false;
     }
 
-    public void setBounds(final int x, final int y, final int w, final int h) {
-        int oldH = getHeight();
-        int oldW = getWidth();
-        super.setBounds(x, y, w, h);
-        if (oldH != h || oldW != w) {
-            revalidate();
-        }
-    }
-
     public boolean isOptimizedDrawingEnabled() {
         return true;
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java?view=diff&rev=478491&r1=478490&r2=478491
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
Wed Nov 22 22:55:32 2006
@@ -1501,6 +1501,7 @@
         Dimension oldSize = getSize();
         super.setBounds(x, y, w, h);
         if (oldSize.width != w || oldSize.height != h) {
+            validate();
             return;
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java?view=diff&rev=478491&r1=478490&r2=478491
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java
Wed Nov 22 22:55:32 2006
@@ -638,6 +638,7 @@
             tabPane.doLayout();
 
             scrollToShowTab(tabPane.getSelectedIndex());
+            tabPane.revalidate();
             tabPane.repaint();
         }
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java?view=diff&rev=478491&r1=478490&r2=478491
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java
Wed Nov 22 22:55:32 2006
@@ -22,7 +22,7 @@
 
 import java.awt.event.ActionListener;
 
-public class JComponentRTest extends BasicSwingTestCase {
+public class JComponentRTest extends SwingTestCase {
     public void testComponentInstantiation() throws Exception {
         Object result = (ActionListener)new JComboBox();
         result = JPanel.class;
@@ -36,5 +36,20 @@
     public void testResetKeyboardActions() throws Exception {
         JComponent c = new JComponent() {};
         c.resetKeyboardActions();
+    }
+
+    public void testSetBounds() throws Throwable {
+        final Marker marker = new Marker();
+        final JComponent button = new JButton("JButton") {
+            @Override
+            public void revalidate() {
+                marker.setOccurred();
+                super.revalidate();
+            }
+        };
+        marker.reset();
+
+        button.setSize(50, 500);
+        assertFalse(marker.isOccurred());
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java?view=diff&rev=478491&r1=478490&r2=478491
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java
Wed Nov 22 22:55:32 2006
@@ -47,6 +47,7 @@
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicInternalFrameUI;
 
+@SuppressWarnings("serial")
 public class JInternalFrameTest extends SwingTestCase {
     /*
      * This class is used to test that some methods were called.
@@ -56,11 +57,13 @@
         public static boolean setRootPaneCalled = false;
         public static boolean disposeCalled = false;
 
+        @Override
         public JRootPane createRootPane() {
             createRootPaneCalled = true;
             return super.createRootPane();
         }
 
+        @Override
         public void setRootPane(final JRootPane root) {
             setRootPaneCalled = true;
             super.setRootPane(root);
@@ -72,6 +75,7 @@
             disposeCalled = false;
         }
 
+        @Override
         public void dispose() {
             disposeCalled = true;
             super.dispose();
@@ -177,6 +181,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         frame = new JInternalFrame();
@@ -186,6 +191,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         if (rootFrame != null) {
             rootFrame.dispose();
@@ -1690,5 +1696,30 @@
             assertFalse("INTERNAL_FRAME_CLOSED was not fired",
                         l.closedFired());
         }
+    }
+
+    public void testSetBounds() throws Exception {
+        // Regression for HARMONY-1801
+        final Marker validateMarker = new Marker();
+        final Marker revalidateMarker = new Marker();
+        final JComponent frame = new JInternalFrame() {
+            @Override
+            public void validate() {
+                validateMarker.setOccurred();
+                super.validate();
+            }
+            
+            @Override
+            public void revalidate() {
+                revalidateMarker.setOccurred();
+                super.revalidate();
+            }
+        };
+        validateMarker.reset();
+        revalidateMarker.reset();
+
+        frame.setBounds(0, 0, 50, 500);
+        assertFalse(revalidateMarker.isOccurred());
+        assertTrue(validateMarker.isOccurred());
     }
 }



Mime
View raw message