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 voidhandleDataChange(com.vaadin.flow.data.provider.DataChangeEvent<T> dataChangeEvent) Handles data change based on the current selection preservation mode.abstract voidClears selection whenDataProvider.refreshAll()is called.abstract voidonPreserveAll(com.vaadin.flow.data.provider.DataChangeEvent<T> dataChangeEvent) Preserves all selected items whenDataProvider.refreshAll()is called.abstract voidonPreserveExisting(com.vaadin.flow.data.provider.DataChangeEvent<T> dataChangeEvent) Preserves the selected items that still exist afterDataProvider.refreshAll()is called.final voidsetSelectionPreservationMode(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
public final void handleDataChange(com.vaadin.flow.data.provider.DataChangeEvent<T> dataChangeEvent) Handles data change based on the current selection preservation mode.- Parameters:
dataChangeEvent- the data change event- See Also:
-
onPreserveAll
public abstract void onPreserveAll(com.vaadin.flow.data.provider.DataChangeEvent<T> dataChangeEvent) Preserves all selected items whenDataProvider.refreshAll()is called.- Parameters:
dataChangeEvent- the data change event
-
onPreserveExisting
public abstract void onPreserveExisting(com.vaadin.flow.data.provider.DataChangeEvent<T> dataChangeEvent) 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