Class ComponentDataGenerator<T>

java.lang.Object
com.vaadin.flow.data.provider.AbstractComponentDataGenerator<T>
com.vaadin.flow.data.renderer.ComponentDataGenerator<T>
Type Parameters:
T - the date type
All Implemented Interfaces:
com.vaadin.flow.data.provider.DataGenerator<T>, Serializable

public class ComponentDataGenerator<T> extends com.vaadin.flow.data.provider.AbstractComponentDataGenerator<T>
A DataGenerator that manages the creation and passivation of components generated by ComponentRenderers. It also manages the generation of the nodeId property which is needed to get the element reference on the client side.

This class is used internally by listing components that support ComponentRenderers.

Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • ComponentDataGenerator

      public ComponentDataGenerator(ComponentRenderer<? extends com.vaadin.flow.component.Component,T> componentRenderer, com.vaadin.flow.function.ValueProvider<T,String> keyMapper)
      Creates a new generator.
      Parameters:
      componentRenderer - the renderer used to produce components based on data items
      keyMapper - the DataKeyMapper used to fetch keys for items
  • Method Details

    • generateData

      public void generateData(T item, elemental.json.JsonObject jsonObject)
    • createComponent

      protected com.vaadin.flow.component.Component createComponent(T item)
      Specified by:
      createComponent in class com.vaadin.flow.data.provider.AbstractComponentDataGenerator<T>
    • updateComponent

      protected com.vaadin.flow.component.Component updateComponent(com.vaadin.flow.component.Component currentComponent, T item)
      Overrides:
      updateComponent in class com.vaadin.flow.data.provider.AbstractComponentDataGenerator<T>
    • getItemKey

      protected String getItemKey(T item)
      Specified by:
      getItemKey in class com.vaadin.flow.data.provider.AbstractComponentDataGenerator<T>
    • getContainer

      protected com.vaadin.flow.dom.Element getContainer()
      Specified by:
      getContainer in class com.vaadin.flow.data.provider.AbstractComponentDataGenerator<T>
    • setContainer

      public void setContainer(com.vaadin.flow.dom.Element container)
    • getComponentRenderer

      public ComponentRenderer<? extends com.vaadin.flow.component.Component,T> getComponentRenderer()
    • getNodeIdPropertyName

      public String getNodeIdPropertyName()
    • setNodeIdPropertyName

      public void setNodeIdPropertyName(String nodeIdPropertyName)