Class 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:
    Serialized Form
    • Constructor Detail

      • CompositeDataGenerator

        public CompositeDataGenerator()
    • 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 serialized JsonObject representation. This JSON object will be sent to client-side DataProvider.
        Specified by:
        generateData in interface DataGenerator<T>
        Parameters:
        item - the data item being serialized
        jsonObject - the JSON object being sent to the client
      • destroyData

        public void destroyData​(T item)
        Description copied from interface: DataGenerator
        Informs the DataGenerator 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 interface DataGenerator<T>
        Parameters:
        item - the dropped data item
      • destroyAllData

        public void destroyAllData()
        Description copied from interface: DataGenerator
        Informs the DataGenerator that all data has been dropped. This method should clean up any unneeded information stored for items.
        Specified by:
        destroyAllData in interface DataGenerator<T>
      • refreshData

        public void refreshData​(T item)
        Description copied from interface: DataGenerator
        Informs the DataGenerator that a data object has been updated. This method should update any unneeded information stored for given item.
        Specified by:
        refreshData in interface DataGenerator<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 interface HasDataGenerators<T>
        Parameters:
        generator - the data generator to add
        Returns:
        a registration that can be used to remove the data generator