You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.data.selection.

Interface SelectionModel.Single<C extends Component,​T>

    • Method Detail

      • select

        void select​(T item)

        Selects the given item. If another item was already selected, that item is deselected.

        Specified by:

        select in interface SelectionModel<C extends Component,​T>

        Parameters:

        item - the item to select

      • getSelectedItem

        Optional<T> getSelectedItem()

        Returns the currently selected item, or an empty optional if no item is selected.

        Returns:

        an optional of the selected item if any, an empty optional otherwise

      • setSelectedItem

        default void setSelectedItem​(T item)

        Sets the current selection to the given item, or clears selection if given null.

        Parameters:

        item - the item to select or null to clear selection

      • getSelectedItems

        default Set<T> getSelectedItems()

        Returns a singleton set of the currently selected item or an empty set if no item is selected.

        Specified by:

        getSelectedItems in interface SelectionModel<C extends Component,​T>

        Returns:

        a singleton set of the selected item if any, an empty set otherwise

        See Also:

        getSelectedItem()

      • setDeselectAllowed

        void setDeselectAllowed​(boolean deselectAllowed)

        Sets whether it's allowed to deselect the selected row through the UI. Deselection is allowed by default.

        Parameters:

        deselectAllowed - true if the selected row can be deselected without selecting another row instead; otherwise false.

      • isDeselectAllowed

        boolean isDeselectAllowed()

        Gets whether it's allowed to deselect the selected row through the UI.

        Returns:

        true if deselection is allowed; otherwise false