Package com.vaadin.flow.component.shared
Class SelectionPreservationHandler<T>
java.lang.Object
com.vaadin.flow.component.shared.SelectionPreservationHandler<T>
- All Implemented Interfaces:
Serializable
Abstract class that handles selection when
DataProvider.refreshAll()
is
called.
Uses SelectionPreservationMode
to switch between the selection
preservation modes.
- Author:
- Vaadin Ltd.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSelectionPreservationHandler
(SelectionPreservationMode selectionPreservationMode) Constructor taking in the initial selection preservation mode. -
Method Summary
Modifier and TypeMethodDescriptionGets the selection preservation mode.final void
handleDataChange
(DataChangeEvent<T> dataChangeEvent) Handles data change based on the current selection preservation mode.abstract void
onDiscard
(DataChangeEvent<T> dataChangeEvent) Clears selection whenDataProvider.refreshAll()
is called.abstract void
onPreserveAll
(DataChangeEvent<T> dataChangeEvent) Preserves all selected items whenDataProvider.refreshAll()
is called.abstract void
onPreserveExisting
(DataChangeEvent<T> dataChangeEvent) Preserves the selected items that still exist afterDataProvider.refreshAll()
is called.final void
setSelectionPreservationMode
(SelectionPreservationMode selectionPreservationMode) Sets the selection preservation mode.
-
Constructor Details
-
Method Details
-
getSelectionPreservationMode
Gets the selection preservation mode.- Returns:
- the selection preservation mode
- See Also:
-
handleDataChange
Handles data change based on the current selection preservation mode.- Parameters:
dataChangeEvent
- the data change event- See Also:
-
onPreserveAll
Preserves all selected items whenDataProvider.refreshAll()
is called.- Parameters:
dataChangeEvent
- the data change event
-
onPreserveExisting
Preserves the selected items that still exist afterDataProvider.refreshAll()
is called.- Parameters:
dataChangeEvent
- the data change event
-
onDiscard
Clears selection whenDataProvider.refreshAll()
is called.- Parameters:
dataChangeEvent
- the data change event