com.vaadin.ui.components.grid.

Class MultiSelectionModelImpl<T>

    • Constructor Detail

      • MultiSelectionModelImpl

        public MultiSelectionModelImpl()
    • Method Detail

      • getState

        protected MultiSelectionModelState getState()

        Description copied from class: AbstractClientConnector

        Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.

        As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use getState(false) to avoid marking the connector as dirty.

        Overrides:

        getState in class AbstractSelectionModel<T>

        Returns:

        The shared state for this connector. Never null.

      • isAllSelected

        public boolean isAllSelected()

        Description copied from interface: MultiSelectionModel

        Returns whether all items are selected or not.

        This is only true if user has selected all rows with the select all checkbox on client side, or if SelectionModel.Multi.selectAll() has been used from server side.

        Specified by:

        isAllSelected in interface MultiSelectionModel<T>

        Returns:

        true if all selected, false if not

      • isSelected

        public boolean isSelected​(T item)

        Description copied from interface: SelectionModel

        Returns whether the given item is currently selected.

        Specified by:

        isSelected in interface SelectionModel<T>

        Parameters:

        item - the item to check, not null

        Returns:

        true if the item is selected, false otherwise

      • selectionContainsId

        protected boolean selectionContainsId​(Object id)

        Returns if the given id belongs to one of the selected items.

        Parameters:

        id - the id to check for

        Returns:

        true if id is selected, false if not

      • beforeClientResponse

        public void beforeClientResponse​(boolean initial)

        Description copied from interface: ClientConnector

        Called before the shared state and RPC invocations are sent to the client. Gives the connector an opportunity to set computed/dynamic state values or to invoke last minute RPC methods depending on other component features.

        Specified by:

        beforeClientResponse in interface ClientConnector

        Overrides:

        beforeClientResponse in class AbstractClientConnector

        Parameters:

        initial - true if the client-side connector will be created and initialized after this method has been invoked. false if there is already an initialized client-side connector.

      • getSelectedItems

        public Set<T> getSelectedItems()

        Description copied from interface: SelectionModel

        Returns an immutable set of the currently selected items. It is safe to invoke other SelectionModel methods while iterating over the set.

        Implementation note: the iteration order of the items in the returned set should be well-defined and documented by the implementing class.

        Specified by:

        getSelectedItems in interface SelectionModel<T>

        Returns:

        the items in the current selection, not null

      • updateSelection

        public void updateSelection​(Set<T> addedItems,
                                    Set<T> removedItems)

        Description copied from interface: SelectionModel.Multi

        Updates the selection by adding and removing the given items from it.

        If all the added items were already selected and the removed items were not selected, this is a NO-OP.

        Duplicate items (in both add & remove sets) are ignored.

        Specified by:

        updateSelection in interface SelectionModel.Multi<T>

        Parameters:

        addedItems - the items to add, not null

        removedItems - the items to remove, not null

      • asMultiSelect

        public MultiSelect<T> asMultiSelect()

        Gets a wrapper for using this grid as a multiselect in a binder.

        Specified by:

        asMultiSelect in interface MultiSelectionModel<T>

        Returns:

        a multiselect wrapper for grid

      • onSelectAll

        protected void onSelectAll​(boolean userOriginated)

        Triggered when the user checks the select all checkbox.

        Parameters:

        userOriginated - true if originated from client side by user

      • onDeselectAll

        protected void onDeselectAll​(boolean userOriginated)

        Triggered when the user unchecks the select all checkbox.

        Parameters:

        userOriginated - true if originated from client side by user

      • updateSelection

        protected void updateSelection​(Set<T> addedItems,
                                       Set<T> removedItems,
                                       boolean userOriginated)

        Updates the selection by adding and removing the given items.

        All selection updates should go through this method, since it handles incorrect parameters, removing duplicates, notifying data communicator and and firing events.

        Parameters:

        addedItems - the items added to selection, not null

        removedItems - the items removed from selection, not null

        userOriginated - true if this was used originated, false if not

      • refreshData

        public void refreshData​(T item)

        Description copied from interface: DataGenerator

        Informs the DataGenerator that a data object has been updated. This method should update any unneeded information stored for given item.

        Specified by:

        refreshData in interface DataGenerator<T>

        Parameters:

        item - the updated item