Den 11.07.2011 15:06, skrev Greg Brown:
IMO getSelectedPath() should return the first selected path, ie. det first in
the selectedPaths sequence.
That seems reasonable.
That means just forwarding to getFirstSelectedPath() then, like the
supplied patch. Should I create a ticket?
-- Edvin
Index: wtk/src/org/apache/pivot/wtk/TreeView.java
===================================================================
--- wtk/src/org/apache/pivot/wtk/TreeView.java (revision 1101054)
+++ wtk/src/org/apache/pivot/wtk/TreeView.java (revision )
@@ -1206,17 +1206,11 @@
* @return
* The selected path, or <tt>null</tt> if nothing is selected.
*
- * @throws IllegalStateException
- * If the tree view is not in single-select mode.
*/
public Path getSelectedPath() {
- if (selectMode != SelectMode.SINGLE) {
- throw new IllegalStateException("Tree view is not in single-select
mode.");
+ return getFirstSelectedPath();
- }
+ }
- return (selectedPaths.getLength() > 0 ? selectedPaths.get(0) : null);
- }
-
/**
*/
public void setSelectedPath(Path path) {