protected class DataCommunicator.ActiveDataHandler extends Object implements DataGenerator<T>
DataKeyMapper.
When the DataCommunicator is pushing new data to the client-side
via DataCommunicator.pushData(int, List),
addActiveData(Stream) and cleanUp(Stream) are called
with the same parameter. In the clean up method any dropped data objects
that are not in the given collection will be cleaned up and
DataGenerator.destroyData(Object) will be called for them.
| Modifier | Constructor and Description |
|---|---|
protected |
ActiveDataHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
addActiveData(Stream<T> dataObjects)
Adds given objects as currently active objects.
|
void |
cleanUp(Stream<T> dataObjects)
Executes the data destruction for dropped data that is not sent to
the client.
|
void |
destroyAllData()
Informs the
DataGenerator that all data has been dropped. |
void |
destroyData(T data)
Informs the
DataGenerator that the given data item has been
dropped and is no longer needed. |
void |
dropActiveData(String key)
Marks a data object identified by given key string to be dropped.
|
void |
dropAllActiveData()
Marks all currently active data objects to be dropped.
|
void |
generateData(T data,
elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serialized
JsonObject
representation. |
Map<Object,T> |
getActiveData()
Returns all currently active data mapped by their id from
DataProvider.
|
protected Map<Object,T> |
getDroppedData()
Returns all dropped data mapped by their id from DataProvider.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrefreshDatapublic void addActiveData(Stream<T> dataObjects)
dataObjects - collection of new active data objectspublic void cleanUp(Stream<T> dataObjects)
DataCommunicator.ActiveDataHandler from creating new keys for rows that were
dropped but got re-requested by the client-side. In the case of
having all data at the client, the collection should be all the data
in the back end.dataObjects - collection of most recently sent data to the clientpublic void dropAllActiveData()
public void dropActiveData(String key)
key - key stringprotected Map<Object,T> getDroppedData()
public Map<Object,T> getActiveData()
public void generateData(T data, elemental.json.JsonObject jsonObject)
DataGeneratorJsonObject
representation. This JSON object will be sent to client-side
DataProvider.generateData in interface DataGenerator<T>data - the data item being serializedjsonObject - the JSON object being sent to the clientpublic void destroyData(T data)
DataGeneratorDataGenerator 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.destroyData in interface DataGenerator<T>data - the dropped data itempublic void destroyAllData()
DataGeneratorDataGenerator that all data has been dropped. This
method should clean up any unneeded information stored for items.destroyAllData in interface DataGenerator<T>Copyright © 2022 Vaadin Ltd. All rights reserved.