You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/03/02 13:37:49 UTC

svn commit: r513735 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java

Author: apetrenko
Date: Fri Mar  2 04:37:48 2007
New Revision: 513735

URL: http://svn.apache.org/viewvc?view=rev&rev=513735
Log:
Patch for HARMONY-2311 "[classlib][awt] DefaultFocusTraversalPolicy.accept(Component aComponent) returns incorrect value"

Added:
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java   (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java?view=diff&rev=513735&r1=513734&r2=513735
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java Fri Mar  2 04:37:48 2007
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Dmitry A. Durnev
- * @version $Revision$
- */
+
 package java.awt;
 
 import java.io.Serializable;
@@ -38,8 +35,8 @@
         try {
             // By default, this method will accept a Component if and only if it is
             // visible[together with parent !!!], displayable, enabled, and focusable.
-            return (aComp.isShowing() && aComp.isDisplayable() &&
-                    aComp.isKeyEnabled() && aComp.isFocusable());
+            return (aComp.isVisible() && aComp.isDisplayable() &&
+                    aComp.isEnabled() && aComp.isFocusable());
         } finally {
             toolkit.unlockAWT();
         }

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java?view=auto&rev=513735
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java Fri Mar  2 04:37:48 2007
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.awt;
+
+import javax.swing.JButton;
+
+import junit.framework.TestCase;
+
+public class DefaultFocusTraversalPolicyTest extends TestCase {
+
+    public void testAccept() {
+        final Component c = new JButton();
+
+        c.setVisible(true);
+        c.setEnabled(true);
+        c.setFocusable(true);
+        c.addNotify();
+
+        assertTrue(new DefaultFocusTraversalPolicy().accept(c));
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DefaultFocusTraversalPolicyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native