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>
A
DataGenerator 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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDataGenerator(DataGenerator<T> generator) Adds the given data generator.voidInforms 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, tools.jackson.databind.node.ObjectNode jsonObject) Adds custom data for the given item to its serializedObjectNoderepresentation.voidrefreshData(T item) Informs theDataGeneratorthat a data object has been updated.
-
Constructor Details
-
CompositeDataGenerator
public CompositeDataGenerator()
-
-
Method Details
-
generateData
Description copied from interface:DataGeneratorAdds custom data for the given item to its serializedObjectNoderepresentation. 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
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
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
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
-