summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-01-07 16:32:36 +0200
committerVaadin Code Review <review@vaadin.com>2015-01-08 09:12:20 +0000
commit864c5c70dc96a4d79985eb3b4fadb952d320f928 (patch)
tree78f7cf94fdff6655ced943187163c1e0966a8330
parent50dac79cb624931a661ce4d4b59458f9f5e0c524 (diff)
downloadvaadin-framework-864c5c70dc96a4d79985eb3b4fadb952d320f928.tar.gz
vaadin-framework-864c5c70dc96a4d79985eb3b4fadb952d320f928.zip
Add getSelected functionality to SelectionEvents (#15513)
Change-Id: If88af88b55063f7178b32579963303ee0d621492
-rw-r--r--client/src/com/vaadin/client/widget/grid/selection/SelectionEvent.java17
-rw-r--r--server/src/com/vaadin/event/SelectionEvent.java10
2 files changed, 23 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/widget/grid/selection/SelectionEvent.java b/client/src/com/vaadin/client/widget/grid/selection/SelectionEvent.java
index 7796425612..528beb5809 100644
--- a/client/src/com/vaadin/client/widget/grid/selection/SelectionEvent.java
+++ b/client/src/com/vaadin/client/widget/grid/selection/SelectionEvent.java
@@ -105,7 +105,7 @@ public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
}
/**
- * Get a reference to the Grid object that fired this event.
+ * Gets a reference to the Grid object that fired this event.
*
* @return a grid reference
*/
@@ -115,8 +115,8 @@ public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
}
/**
- * Get all rows added to the selection since the last {@link SelectionEvent}
- * .
+ * Gets all rows added to the selection since the last
+ * {@link SelectionEvent} .
*
* @return a collection of added rows. Empty collection if no rows were
* added.
@@ -126,7 +126,7 @@ public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
}
/**
- * Get all rows removed from the selection since the last
+ * Gets all rows removed from the selection since the last
* {@link SelectionEvent}.
*
* @return a collection of removed rows. Empty collection if no rows were
@@ -137,6 +137,15 @@ public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
}
/**
+ * Gets currently selected rows.
+ *
+ * @return a non-null collection containing all currently selected rows.
+ */
+ public Collection<T> getSelected() {
+ return grid.getSelectedRows();
+ }
+
+ /**
* Gets a type identifier for this event.
*
* @return a {@link Type} identifier.
diff --git a/server/src/com/vaadin/event/SelectionEvent.java b/server/src/com/vaadin/event/SelectionEvent.java
index b6ade2aa9c..e75369e6da 100644
--- a/server/src/com/vaadin/event/SelectionEvent.java
+++ b/server/src/com/vaadin/event/SelectionEvent.java
@@ -17,6 +17,7 @@ package com.vaadin.event;
import java.io.Serializable;
import java.util.Collection;
+import java.util.Collections;
import java.util.EventObject;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -67,6 +68,15 @@ public class SelectionEvent extends EventObject {
}
/**
+ * A {@link Collection} of all the itemIds that are currently selected.
+ *
+ * @return a Collection of the itemIds that are currently selected
+ */
+ public Set<Object> getSelected() {
+ return Collections.unmodifiableSet(newSelection);
+ }
+
+ /**
* The listener interface for receiving {@link SelectionEvent
* SelectionEvents}.
*/