changeset 127:682bde65e6d3

RT-18388: TableView.getSelectionModel().getSelectedItems() duplicates items select with Shift-Click
author jgiles
date Thu, 08 Dec 2011 17:46:10 +1000
parents a2aa78525c76
children 39b77f7b2433
files javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TableCellBehavior.java javafx-ui-controls/src/javafx/scene/control/TableView.java
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TableCellBehavior.java	Thu Dec 08 15:27:17 2011 +1000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TableCellBehavior.java	Thu Dec 08 17:46:10 2011 +1000
@@ -151,10 +151,14 @@
                 sm.clearSelection();
 
                 // and then perform the selection
-                for (int _row = minRow; _row <= maxRow; _row++) {
-                    for (int _col = minColumn; _col <= maxColumn; _col++) {
-                        sm.select(_row, tableView.getVisibleLeafColumn(_col));
+                if (sm.isCellSelectionEnabled()) {
+                    for (int _row = minRow; _row <= maxRow; _row++) {
+                        for (int _col = minColumn; _col <= maxColumn; _col++) {
+                            sm.select(_row, tableView.getVisibleLeafColumn(_col));
+                        }
                     }
+                } else {
+                    sm.selectRange(minRow, maxRow + 1);
                 }
 
                 // return selection back to the focus owner
--- a/javafx-ui-controls/src/javafx/scene/control/TableView.java	Thu Dec 08 15:27:17 2011 +1000
+++ b/javafx-ui-controls/src/javafx/scene/control/TableView.java	Thu Dec 08 17:46:10 2011 +1000
@@ -1933,9 +1933,7 @@
 //            // if a column is given, I return
 //            if (! isCellSelectionEnabled() && column != null) return;
 
-            TablePosition pos = isCellSelectionEnabled() ? 
-                    new TablePosition(getTableView(), row, column) :
-                    new TablePosition(getTableView(), row, null);
+            TablePosition pos = new TablePosition(getTableView(), row, column);
             
             if (getSelectionMode() == SelectionMode.SINGLE) {
                 quietClearSelection();