changeset 1263:d09cc9910784

RT-22079: No change event on selection when selected row is removed from TableView
author jgiles
date Fri, 08 Jun 2012 13:56:28 +1200
parents f848576e5df0
children 634e4bbb4cf5
files javafx-ui-controls/src/javafx/scene/control/ListView.java javafx-ui-controls/src/javafx/scene/control/TableView.java
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/javafx/scene/control/ListView.java	Thu Jun 07 15:15:05 2012 +1200
+++ b/javafx-ui-controls/src/javafx/scene/control/ListView.java	Fri Jun 08 13:56:28 2012 +1200
@@ -1014,6 +1014,9 @@
                             clearSelection(index);
                             makeAtomic = false;
                             select(index);
+                        } else {
+                            // Fix for RT-22079
+                            clearSelection();
                         }
                     }
                 } else if (c.wasAdded() || c.wasRemoved()) {
--- a/javafx-ui-controls/src/javafx/scene/control/TableView.java	Thu Jun 07 15:15:05 2012 +1200
+++ b/javafx-ui-controls/src/javafx/scene/control/TableView.java	Fri Jun 08 13:56:28 2012 +1200
@@ -1874,10 +1874,12 @@
                     }
                     
                     quietClearSelection();
-                    selectedCells.setAll(newIndices);
-                    selectedCellsSeq.callObservers(
-                            new NonIterableChange.SimpleAddChange<TablePosition>(0, 
-                            newIndices.size(), selectedCellsSeq));
+                    
+                    // Fix for RT-22079
+                    for (int i = 0; i < newIndices.size(); i++) {
+                        TablePosition tp = newIndices.get(i);
+                        select(tp.getRow(), tp.getTableColumn());
+                    }
                 } else if (c.wasPermutated()) {
                     // General approach:
                     //   -- detected a sort has happened