[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] RFC: javax/swing/JTree.java (getExpandedDescendants): i
From: |
Roman Kennke |
Subject: |
Re: [cp-patches] RFC: javax/swing/JTree.java (getExpandedDescendants): implemented |
Date: |
Tue, 17 May 2005 16:07:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204 |
Hi all,
The patch looks good. I committed this
2005-05-13 Jan Roehrich <address@hidden>
* javax/swing/JTree.java
(getExpandedDescendants): Added method.
/Roman
I attached the same patch but now with an indentation of 2. I hope
that's right because the GNU Styleguide said 8 when I was looking for it
a few month ago.
Jan
Index: javax/swing/JTree.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JTree.java,v
retrieving revision 1.20
diff -u -r1.20 JTree.java
--- javax/swing/JTree.java 17 May 2005 14:01:36 -0000 1.20
+++ javax/swing/JTree.java 17 May 2005 14:03:28 -0000
@@ -1679,5 +1679,29 @@
return "";
}
-
+ /**
+ * Returns all TreePath objects which are a descendants of
+ * the given path and are exapanded at the moment of the
+ * execution of this method. If the state of any node
+ * is beeing toggled while this method is executing this
+ * change may be left unaccounted.
+ *
+ * @param path The parent of this request
+ * @return An Enumeration containing TreePath objects
+ */
+ public Enumeration getExpandedDescendants(TreePath path)
+ {
+ Enumeration paths = nodeStates.keys();
+ Vector relevantPaths = new Vector();
+ while(paths.hasMoreElements())
+ {
+ TreePath nextPath = (TreePath) paths.nextElement();
+ if(nodeStates.get(nextPath) == EXPANDED &&
+ path.isDescendant(nextPath))
+ {
+ relevantPaths.add(nextPath);
+ }
+ }
+ return relevantPaths.elements();
+ }
}