com.vaadin.event.selection.

Class MultiSelectionEvent<T>

    • Constructor Detail

      • MultiSelectionEvent

        public MultiSelectionEvent​(AbstractMultiSelect<T> source,
                                   Set<T> oldSelection,
                                   boolean userOriginated)

        Creates a new event.

        Parameters:

        source - the listing component in which the selection changed

        oldSelection - the old set of selected items

        userOriginated - true if this event originates from the client, false otherwise.

      • MultiSelectionEvent

        public MultiSelectionEvent​(Component component,
                                   MultiSelect<T> source,
                                   Set<T> oldSelection,
                                   boolean userOriginated)

        Creates a new selection change event in a multiselect component.

        Parameters:

        component - the component

        source - the multiselect source

        oldSelection - the old set of selected items

        userOriginated - true if this event originates from the client, false otherwise.

    • Method Detail

      • getOldSelection

        public Set<T> getOldSelection()

        Gets the old selection.

        Returns:

        a set of items selected before the selection was changed

      • getRemovedSelection

        public Set<T> getRemovedSelection()

        Gets the items that were removed from selection.

        This is just a convenience method for checking what was previously selected in getOldSelection() but not selected anymore in getNewSelection().

        Returns:

        the items that were removed from selection

      • getAddedSelection

        public Set<T> getAddedSelection()

        Gets the items that were added to selection.

        This is just a convenience method for checking what is new selected in getNewSelection() and wasn't selected in getOldSelection().

        Returns:

        the items that were removed from selection

      • getAllSelectedItems

        public Set<T> getAllSelectedItems()

        Gets all the currently selected items.

        This method applies more to multiselection - for single select it returns either an empty set or a set containing the only selected item.

        This is the same as HasValue.ValueChangeEvent.getValue().

        Specified by:

        getAllSelectedItems in interface SelectionEvent<T>

        Returns:

        return all the selected items, if any, never null