[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: Implemented new method in JTree
From: |
Roman Kennke |
Subject: |
[cp-patches] FYI: Implemented new method in JTree |
Date: |
Mon, 06 Jun 2005 14:37:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204 |
2005-06-06 Roman Kennke <address@hidden>
* javax/swing/JTree.java
(removeDescendantSelectedPaths): Implemented new method.
/Roman
Index: javax/swing/JTree.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JTree.java,v
retrieving revision 1.22
diff -u -r1.22 JTree.java
--- javax/swing/JTree.java 30 May 2005 14:40:23 -0000 1.22
+++ javax/swing/JTree.java 6 Jun 2005 12:35:10 -0000
@@ -1780,4 +1780,37 @@
}
return foundPath;
}
+
+ /**
+ * Removes any paths in the current set of selected paths that are
+ * descendants of <code>path</code>. If <code>includePath</code> is
+ * set to <code>true</code> and <code>path</code> itself is selected,
+ * then it will be removed too.
+ *
+ * @param path the path from which selected descendants are to be
+ * removed
+ * @param includePath if <code>true</code> then <code>path</code>
+ * itself will also be remove if it's selected
+ *
+ * @return <code>true</code> if something has been removed,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ protected boolean removeDescendantSelectedPaths(TreePath path,
+ boolean includeSelected)
+ {
+ boolean removedSomething = false;
+ TreePath[] selected = getSelectionPaths();
+ for (int index = 0; index < selected.length; index++)
+ {
+ if ((selected[index] == path && includeSelected)
+ || (selected[index].isDescendant(path)))
+ {
+ removeSelectionPath(selected[index]);
+ removedSomething = true;
+ }
+ }
+ return removedSomething;
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: Implemented new method in JTree,
Roman Kennke <=