harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r496163 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
Date Sun, 14 Jan 2007 21:54:07 GMT
Author: hindessm
Date: Sun Jan 14 13:54:06 2007
New Revision: 496163

URL: http://svn.apache.org/viewvc?view=rev&rev=496163
Log:
Applying patches from "[#HARMONY-2771] [classlib][swing]
javax.swing.plaf.basic.BasicSplitPaneUI.getLastDragLocation() returns -1
while RI returns 0".

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java?view=diff&rev=496163&r1=496162&r2=496163
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
Sun Jan 14 13:54:06 2007
@@ -14,12 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Sergey Burlak
- * @version $Revision$
- */
-
 package javax.swing.plaf.basic;
 
 import java.awt.Canvas;
@@ -48,7 +42,6 @@
 
 import org.apache.harmony.x.swing.Utilities;
 
-
 public class BasicSplitPaneUI extends SplitPaneUI {
 
     public class BasicHorizontalLayoutManager implements LayoutManager2 {
@@ -391,10 +384,12 @@
     }
 
     public class FocusHandler extends FocusAdapter {
+        @Override
         public void focusGained(final FocusEvent ev) {
             divider.repaint();
         }
 
+        @Override
         public void focusLost(final FocusEvent ev) {
             divider.repaint();
         }
@@ -502,7 +497,7 @@
 
     private boolean isContinuousLayout;
     private int orientation;
-    private int lastDragLocation = -1;
+    private int lastDragLocation;
     private int dividerLocation;
     private boolean isDisplayed;
 
@@ -510,6 +505,7 @@
         return new BasicSplitPaneUI();
     }
 
+    @Override
     public void installUI(final JComponent c) {
         splitPane = (JSplitPane)c;
 
@@ -524,6 +520,8 @@
 
         divider.oneTouchExpandableChanged();
         resetToPreferredSizes(getSplitPane());
+
+        setLastDragLocation(-1);
     }
 
     protected void installDefaults() {
@@ -564,6 +562,7 @@
         BasicSplitPaneKeyboardActions.installKeyboardActions(splitPane);
     }
 
+    @Override
     public void uninstallUI(final JComponent c) {
         splitPane = (JSplitPane)c;
 
@@ -657,6 +656,11 @@
 
     protected Component createDefaultNonContinuousLayoutDivider() {
         return new Canvas() {
+            // Note: this is not a guaratee for correct serialization/deserialization
+            // but rather a performace optimization
+            private static final long serialVersionUID = 1L;
+
+            @Override
             public void paint(final Graphics g) {
                 Color oldColor = g.getColor();
                 g.setColor(Color.DARK_GRAY);
@@ -704,15 +708,18 @@
         return new BasicSplitPaneDivider(this);
     }
 
+    @Override
     public void resetToPreferredSizes(final JSplitPane jc) {
         layoutManager.resetToPreferredSizes();
         splitPane.repaint();
     }
 
+    @Override
     public void setDividerLocation(final JSplitPane jc, final int location) {
         splitPane.revalidate();
     }
 
+    @Override
     public int getDividerLocation(final JSplitPane jc) {
         if (jc == null) { // Fix for HARMONY-2661, for compatibility with RI
             throw new NullPointerException("jc is null");
@@ -720,6 +727,7 @@
         return dividerLocation;
     }
 
+    @Override
     public int getMinimumDividerLocation(final JSplitPane jc) {
         if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
             return jc.getLeftComponent() == null ? 0 : jc.getLeftComponent().getMinimumSize().width
+ jc.getInsets().left;
@@ -728,6 +736,7 @@
         }
     }
 
+    @Override
     public int getMaximumDividerLocation(final JSplitPane jc) {
         Insets insets = jc.getInsets();
         if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
@@ -741,6 +750,7 @@
         }
     }
 
+    @Override
     public void finishedPaintingChildren(final JSplitPane jc, final Graphics g) {
         g.setClip(0, 0, jc.getWidth(), jc.getHeight());
         if (!isContinuousLayout() && lastDragLocation != -1) {
@@ -748,22 +758,26 @@
         }
     }
 
+    @Override
     public void paint(final Graphics g, final JComponent jc) {
         isDisplayed = true;
     }
 
+    @Override
     public Dimension getPreferredSize(final JComponent jc) {
         return ((layoutManager != null)
                 ? layoutManager.preferredLayoutSize(jc)
                 : new Dimension(0, 0));
     }
 
+    @Override
     public Dimension getMinimumSize(final JComponent jc) {
         return ((layoutManager != null)
                 ? layoutManager.minimumLayoutSize(jc)
                 : new Dimension(0, 0));
     }
 
+    @Override
     public Dimension getMaximumSize(final JComponent jc) {
         return ((layoutManager != null)
                 ? layoutManager.maximumLayoutSize(jc)

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java?view=diff&rev=496163&r1=496162&r2=496163
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
Sun Jan 14 13:54:06 2007
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Sergey Burlak
- * @version $Revision$
- */
 package javax.swing.plaf.basic;
 
 import java.awt.Canvas;
@@ -154,6 +150,11 @@
         assertEquals(-1, ui.getLastDragLocation());
         ui.setLastDragLocation(40);
         assertEquals(40, ui.getLastDragLocation());
+    }
+
+    // Regression for HARMONY-2771
+    public void testGetLastDragLocation() throws Exception {
+        assertEquals(0, new BasicSplitPaneUI().getLastDragLocation());
     }
 
     public void testGetDivider() throws Exception {



Mime
View raw message