harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r507071 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JTree.java test/api/java/common/javax/swing/JTreeTest.java
Date Tue, 13 Feb 2007 15:57:38 GMT
Author: apetrenko
Date: Tue Feb 13 07:57:37 2007
New Revision: 507071

URL: http://svn.apache.org/viewvc?view=rev&rev=507071
Log:
Patch for HARMONY-2618 "[classlib][swing] javax.swing.JTree.getExpandedDescendants() returns
Enumeration while RI returns null"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTreeTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java?view=diff&rev=507071&r1=507070&r2=507071
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
Tue Feb 13 07:57:37 2007
@@ -997,9 +997,11 @@
 
     public Enumeration<TreePath> getExpandedDescendants(TreePath parent) {
         final Enumeration<TreePath> toggled = getDescendantToggledPaths(parent);
-        if (toggled == null) {
-            return null;
-        }
+        
+        if (toggled == null || !isExpanded(parent)) {
+             return null;
+        } 
+
         return new Enumeration<TreePath>() {
             private TreePath nextElement = getNextExpandedPath();
 
@@ -1018,7 +1020,8 @@
 
             private TreePath getNextExpandedPath() {
                 while (toggled.hasMoreElements()) {
-                    TreePath nextPath = toggled.nextElement();
+                    TreePath nextPath = toggled.nextElement();                    
+
                     if (isExpanded(nextPath)) {
                         return nextPath;
                     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTreeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTreeTest.java?view=diff&rev=507071&r1=507070&r2=507071
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTreeTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTreeTest.java
Tue Feb 13 07:57:37 2007
@@ -1184,16 +1184,8 @@
         TreePath path11 = path1.pathByAddingChild(child11);
         assertNull(tree.getExpandedDescendants(null));
         checkInEnumeration(tree.getExpandedDescendants(rootPath), new Object[] { rootPath
});
-        if (isHarmony()) {
-            assertFalse(tree.getExpandedDescendants(path1).hasMoreElements());
-        } else {
-            assertNull(tree.getExpandedDescendants(path1));
-        }
-        if (isHarmony()) {
-            assertFalse(tree.getExpandedDescendants(path11).hasMoreElements());
-        } else {
-            assertNull(tree.getExpandedDescendants(path11));
-        }
+        assertNull(tree.getExpandedDescendants(path1));
+        assertNull(tree.getExpandedDescendants(path11));        
         tree.expandPath(path11);
         checkInEnumeration(tree.getExpandedDescendants(rootPath), new Object[] { path1,
                 rootPath, path11 });
@@ -1201,11 +1193,7 @@
         checkInEnumeration(tree.getExpandedDescendants(rootPath), new Object[] { path1,
                 rootPath });
         tree.collapsePath(rootPath);
-        if (isHarmony()) {
-            assertFalse(tree.getExpandedDescendants(rootPath).hasMoreElements());
-        } else {
-            assertNull(tree.getExpandedDescendants(rootPath));
-        }
+        assertNull(tree.getExpandedDescendants(rootPath));
     }
 
     public void testGetSetExpandsSelectedPaths() {



Mime
View raw message