Class FComponentRenderer<T>

Type Parameters:
T - the type presented by the renderer
All Implemented Interfaces:
ClientConnector, FAbstractClientConnector, Renderer<T>, Serializable

public class FComponentRenderer<T> extends FGrid.AbstractRenderer<T>
This Renderer creates components for the value in a column. It should be used instead of the Vaadin Flow ComponentRenderer to avoid placing the same component in the UI multiple times, since the Context cache is made Item based instead of value-based.
Author:
Vaadin Ltd
See Also:
  • Field Details

  • Constructor Details

    • FComponentRenderer

      public FComponentRenderer(Class<T> presentationType, com.vaadin.flow.function.ValueProvider<T,com.vaadin.flow.component.Component> componentProvider)
      Constructor using value type and component provider. Null representation will be defaulted to null.
      Parameters:
      presentationType - type of the column value
      componentProvider - component provider function
    • FComponentRenderer

      public FComponentRenderer(Class<T> presentationType, String nullRepresentation, com.vaadin.flow.function.ValueProvider<T,com.vaadin.flow.component.Component> componentProvider)
      Constructor using value type and component provider.
      Parameters:
      presentationType - type of the column value
      nullRepresentation - value of null representation
      componentProvider - component provider function
  • Method Details

    • getRenderer

      public com.vaadin.flow.data.renderer.Renderer<T> getRenderer()
      Creates a Vaadin Flow renderer using GridRendererAdapter and ComponentRenderer in the context of Item
      Returns:
      Flow column renderer
    • createComponentRenderer

      protected com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.Component,Item> createComponentRenderer(Object propertyId)
      Creates the component renderer using the component provider function. In case the item or the value or converted value is null, it Will create a span with null representation text.
      Returns:
      Component renderer which uses the component provider function or a span with null representation if the value is null.