T - the date typepublic class ComponentDataGenerator<T> extends AbstractComponentDataGenerator<T>
DataGenerator that manages the creation and passivation of
components generated by ComponentRenderers. It also manages the
generation of the nodeId property needed by the
flow-component-renderer webcomponent.
This class is used internally by listing components that support ComponentRenderers.
| Constructor and Description |
|---|
ComponentDataGenerator(ComponentRenderer<? extends Component,T> componentRenderer,
ValueProvider<T,String> keyMapper)
Creates a new generator.
|
| Modifier and Type | Method and Description |
|---|---|
protected Component |
createComponent(T item)
Creates a new component based on the provided item.
|
void |
generateData(T item,
elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serialized
JsonObject
representation. |
ComponentRenderer<? extends Component,T> |
getComponentRenderer() |
protected Element |
getContainer()
Gets the element where the generated components will be attached to.
|
protected String |
getItemKey(T item)
Gets a unique key for a given item.
|
String |
getNodeIdPropertyName() |
void |
setContainer(Element container) |
void |
setNodeIdPropertyName(String nodeIdPropertyName) |
protected Component |
updateComponent(Component currentComponent,
T item)
Updates an existing component after the item has been updated.
|
destroyAllData, destroyData, getRenderedComponent, refreshData, registerRenderedComponentpublic ComponentDataGenerator(ComponentRenderer<? extends Component,T> componentRenderer, ValueProvider<T,String> keyMapper)
componentRenderer - the renderer used to produce components based on data itemskeyMapper - the DataKeyMapper used to fetch keys for itemspublic void generateData(T item, elemental.json.JsonObject jsonObject)
DataGeneratorJsonObject
representation. This JSON object will be sent to client-side
DataProvider.item - the data item being serializedjsonObject - the JSON object being sent to the clientprotected Component createComponent(T item)
AbstractComponentDataGeneratorcreateComponent in class AbstractComponentDataGenerator<T>item - the data item, possibly nullComponent which represents the provided itemprotected Component updateComponent(Component currentComponent, T item)
AbstractComponentDataGeneratorAbstractComponentDataGenerator.createComponent(Object).updateComponent in class AbstractComponentDataGenerator<T>currentComponent - the current component used to represent the item, not
nullitem - the updated itemnullprotected String getItemKey(T item)
AbstractComponentDataGeneratorgetItemKey in class AbstractComponentDataGenerator<T>item - the model itemprotected Element getContainer()
AbstractComponentDataGeneratorgetContainer in class AbstractComponentDataGenerator<T>public void setContainer(Element container)
public ComponentRenderer<? extends Component,T> getComponentRenderer()
public String getNodeIdPropertyName()
public void setNodeIdPropertyName(String nodeIdPropertyName)
Copyright © 2025. All rights reserved.