Class AbstractGridMultiSelectionModel<T>

    • Constructor Detail

      • AbstractGridMultiSelectionModel

        public AbstractGridMultiSelectionModel​(Grid<T> grid)
        Constructor for passing a reference of the grid to this implementation.
        Parameters:
        grid - reference to the grid for which this selection model is created
    • Method Detail

      • selectFromClient

        public void selectFromClient​(T item)
        Description copied from interface: GridSelectionModel
        Handles the selection of an item that originates from the client.
        Specified by:
        selectFromClient in interface GridSelectionModel<T>
        Parameters:
        item - the item being selected
      • deselectFromClient

        public void deselectFromClient​(T item)
        Description copied from interface: GridSelectionModel
        Handles the deselection of an item that originates from the client.
        Specified by:
        deselectFromClient in interface GridSelectionModel<T>
        Parameters:
        item - the item being deselected
      • getSelectedItems

        public Set<T> getSelectedItems()
        Specified by:
        getSelectedItems in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
      • getSelectedItemIds

        protected Set<Object> getSelectedItemIds()
        Returns an unmodifiable view of the selected item ids.

        Exposed to be overridden within subclasses.

        The returned Set may be a direct view of the internal data structures of this class. A defensive copy should be made by callers when iterating over this Set and modifying the selection during iteration to avoid ConcurrentModificationExceptions.

        Returns:
        An unmodifiable view of the selected item ids. Updates in the selection may or may not be directly reflected in the Set.
      • getFirstSelectedItem

        public Optional<T> getFirstSelectedItem()
        Specified by:
        getFirstSelectedItem in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
        Specified by:
        getFirstSelectedItem in interface com.vaadin.flow.data.selection.SelectionModel.Multi<Grid<T>,​T>
      • select

        public void select​(T item)
        Specified by:
        select in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
        Specified by:
        select in interface com.vaadin.flow.data.selection.SelectionModel.Multi<Grid<T>,​T>
      • deselect

        public void deselect​(T item)
        Specified by:
        deselect in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
        Specified by:
        deselect in interface com.vaadin.flow.data.selection.SelectionModel.Multi<Grid<T>,​T>
      • selectAll

        public void selectAll()
        Specified by:
        selectAll in interface com.vaadin.flow.data.selection.SelectionModel.Multi<Grid<T>,​T>
      • deselectAll

        public void deselectAll()
        Specified by:
        deselectAll in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
      • updateSelection

        public void updateSelection​(Set<T> addedItems,
                                    Set<T> removedItems)
        Specified by:
        updateSelection in interface com.vaadin.flow.data.selection.SelectionModel.Multi<Grid<T>,​T>
      • isSelected

        public boolean isSelected​(T item)
        Specified by:
        isSelected in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
      • asMultiSelect

        public com.vaadin.flow.data.selection.MultiSelect<Grid<T>,​T> asMultiSelect()
        Description copied from interface: GridMultiSelectionModel
        Gets a wrapper to use this multiselection model as a multiselect in Binder.
        Specified by:
        asMultiSelect in interface GridMultiSelectionModel<T>
        Returns:
        the multiselect wrapper
      • addSelectionListener

        public com.vaadin.flow.shared.Registration addSelectionListener​(com.vaadin.flow.data.selection.SelectionListener<Grid<T>,​T> listener)
        Specified by:
        addSelectionListener in interface com.vaadin.flow.data.selection.SelectionModel<Grid<T>,​T>
      • addMultiSelectionListener

        public com.vaadin.flow.shared.Registration addMultiSelectionListener​(com.vaadin.flow.data.selection.MultiSelectionListener<Grid<T>,​T> listener)
        Description copied from interface: GridMultiSelectionModel
        Adds a selection listener that will be called when the selection is changed either by the user or programmatically.
        Specified by:
        addMultiSelectionListener in interface GridMultiSelectionModel<T>
        Parameters:
        listener - the multi selection listener, not null
        Returns:
        a registration for the listener
      • generateData

        public void generateData​(T item,
                                 elemental.json.JsonObject jsonObject)
        Specified by:
        generateData in interface com.vaadin.flow.data.provider.DataGenerator<T>
      • setDragSelect

        public void setDragSelect​(boolean dragSelect)
        Description copied from interface: GridMultiSelectionModel
        If true, grid rows can be selected or deselected by dragging the mouse cursor over grid's selection column.
        Specified by:
        setDragSelect in interface GridMultiSelectionModel<T>
        Parameters:
        dragSelect - true to enable drag select feature, false for disabling it
      • fireSelectionEvent

        protected abstract void fireSelectionEvent​(com.vaadin.flow.data.selection.SelectionEvent<Grid<T>,​T> event)
        Method for handling the firing of selection events.
        Parameters:
        event - the selection event to fire