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>
ADataGeneratorthat 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 RegistrationaddDataGenerator(DataGenerator<T> generator)Adds the given data generator.voiddestroyAllData()Informs theDataGeneratorthat all data has been dropped.voiddestroyData(T item)Informs theDataGeneratorthat the given data item has been dropped and is no longer needed.voidgenerateData(T item, elemental.json.JsonObject jsonObject)Adds custom data for the given item to its serializedJsonObjectrepresentation.voidrefreshData(T item)Informs theDataGeneratorthat a data object has been updated.
-
-
-
Method Detail
-
generateData
public void generateData(T item, elemental.json.JsonObject jsonObject)
Description copied from interface:DataGeneratorAdds custom data for the given item to its serializedJsonObjectrepresentation. This JSON object will be sent to client-side DataProvider.- Specified by:
generateDatain 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:DataGeneratorInforms theDataGeneratorthat 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:
destroyDatain interfaceDataGenerator<T>- Parameters:
item- the dropped data item
-
destroyAllData
public void destroyAllData()
Description copied from interface:DataGeneratorInforms theDataGeneratorthat all data has been dropped. This method should clean up any unneeded information stored for items.- Specified by:
destroyAllDatain interfaceDataGenerator<T>
-
refreshData
public void refreshData(T item)
Description copied from interface:DataGeneratorInforms theDataGeneratorthat a data object has been updated. This method should update any unneeded information stored for given item.- Specified by:
refreshDatain interfaceDataGenerator<T>- Parameters:
item- the updated item
-
addDataGenerator
public Registration addDataGenerator(DataGenerator<T> generator)
Description copied from interface:HasDataGeneratorsAdds the given data generator. If the generator was already added, does nothing.- Specified by:
addDataGeneratorin interfaceHasDataGenerators<T>- Parameters:
generator- the data generator to add- Returns:
- a registration that can be used to remove the data generator
-
-