Package com.vaadin.flow.data.provider
Class CompositeDataGenerator<T>
- java.lang.Object
-
- com.vaadin.flow.data.provider.CompositeDataGenerator<T>
-
- Type Parameters:
T
- the data type of the underlying DataGenerators
- All Implemented Interfaces:
DataGenerator<T>
,HasDataGenerators<T>
,Serializable
public class CompositeDataGenerator<T> extends Object implements DataGenerator<T>, HasDataGenerators<T>
ADataGenerator
that aggregates multiple DataGenerators and delegates the data generation to them. It doesn't generate or destroy any data by its own.It is used by components that need to add and remove DataGenerators dynamically, or that support multiple layers of data generation.
- Since:
- 1.0.
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CompositeDataGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Registration
addDataGenerator(DataGenerator<T> generator)
Adds the given data generator.void
destroyAllData()
Informs theDataGenerator
that all data has been dropped.void
destroyData(T item)
Informs theDataGenerator
that the given data item has been dropped and is no longer needed.void
generateData(T item, elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serializedJsonObject
representation.void
refreshData(T item)
Informs theDataGenerator
that a data object has been updated.
-
-
-
Method Detail
-
generateData
public void generateData(T item, elemental.json.JsonObject jsonObject)
Description copied from interface:DataGenerator
Adds custom data for the given item to its serializedJsonObject
representation. This JSON object will be sent to client-side DataProvider.- Specified by:
generateData
in interfaceDataGenerator<T>
- Parameters:
item
- the data item being serializedjsonObject
- the JSON object being sent to the client
-
destroyData
public void destroyData(T item)
Description copied from interface:DataGenerator
Informs theDataGenerator
that the given data item has been dropped and is no longer needed. This method should clean up any unneeded information stored for this item.- Specified by:
destroyData
in interfaceDataGenerator<T>
- Parameters:
item
- the dropped data item
-
destroyAllData
public void destroyAllData()
Description copied from interface:DataGenerator
Informs theDataGenerator
that all data has been dropped. This method should clean up any unneeded information stored for items.- Specified by:
destroyAllData
in interfaceDataGenerator<T>
-
refreshData
public void refreshData(T item)
Description copied from interface:DataGenerator
Informs theDataGenerator
that a data object has been updated. This method should update any unneeded information stored for given item.- Specified by:
refreshData
in interfaceDataGenerator<T>
- Parameters:
item
- the updated item
-
addDataGenerator
public Registration addDataGenerator(DataGenerator<T> generator)
Description copied from interface:HasDataGenerators
Adds the given data generator. If the generator was already added, does nothing.- Specified by:
addDataGenerator
in interfaceHasDataGenerators<T>
- Parameters:
generator
- the data generator to add- Returns:
- a registration that can be used to remove the data generator
-
-