diff options
author | Artur Signell <artur@vaadin.com> | 2016-10-15 22:44:27 +0300 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-09 09:39:00 +0200 |
commit | 22c372b7a5cc6540d45b9add88d447ff52eab62d (patch) | |
tree | 0bf137e948d906d28167dc87e353ce3d4016c0b9 /compatibility-server/src/main/java | |
parent | a48e26b9b897a721527d5731a44a587294cdb4ea (diff) | |
download | vaadin-framework-22c372b7a5cc6540d45b9add88d447ff52eab62d.tar.gz vaadin-framework-22c372b7a5cc6540d45b9add88d447ff52eab62d.zip |
Send selection change events when changing selection mode (#20391)
Change-Id: Iaeb772981f3ac039bf0fe3cde595cfdb3691cddf
Diffstat (limited to 'compatibility-server/src/main/java')
-rw-r--r-- | compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java index ce78fa33cf..ef35808f99 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java @@ -5621,7 +5621,8 @@ public class Grid extends AbstractComponent * Takes a new {@link SelectionModel} into use. * <p> * The SelectionModel that is previously in use will have all its items - * deselected. + * deselected. If any items were selected, this will fire a + * {@link SelectionEvent}. * <p> * If the given SelectionModel is already in use, this method does nothing. * @@ -5638,13 +5639,23 @@ public class Grid extends AbstractComponent } if (this.selectionModel != selectionModel) { + Collection<Object> oldSelection; // this.selectionModel is null on init if (this.selectionModel != null) { + oldSelection = this.selectionModel.getSelectedRows(); this.selectionModel.remove(); + } else { + oldSelection = Collections.emptyList(); } this.selectionModel = selectionModel; selectionModel.setGrid(this); + Collection<Object> newSelection = this.selectionModel + .getSelectedRows(); + + if (!SharedUtil.equals(oldSelection, newSelection)) { + fireSelectionEvent(oldSelection, newSelection); + } } } |