}
/**
- * 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
*/
}
/**
- * 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.
}
/**
- * 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
return Collections.unmodifiableCollection(removed);
}
+ /**
+ * 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.
*
import java.io.Serializable;
import java.util.Collection;
+import java.util.Collections;
import java.util.EventObject;
import java.util.LinkedHashSet;
import java.util.Set;
return Sets.difference(oldSelection, newSelection);
}
+ /**
+ * 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}.