Class EditorRenderer<T>

java.lang.Object
com.vaadin.flow.data.renderer.Renderer<T>
com.vaadin.flow.component.grid.editor.EditorRenderer<T>
Type Parameters:
T - the type of the object being processed
All Implemented Interfaces:
DataGenerator<T>, Serializable

public class EditorRenderer<T> extends Renderer<T> implements DataGenerator<T>
Renderer and DataGenerator used by Grid.Column to control the state of the editor components.

Components are created during the generateData(Object, JsonObject) calls, and the proper data is sent to the client-side to be rendered.

Author:
Vaadin Ltd.
See Also:
  • Constructor Details

    • EditorRenderer

      public EditorRenderer(Editor<T> editor, String columnInternalId)
      Creates a new renderer for a specific column.
      Parameters:
      editor - the Grid's editor
      columnInternalId - the internal Id of the column that uses this data generator
  • Method Details

    • setComponentFunction

      public void setComponentFunction(SerializableFunction<T,? extends Component> componentFunction)
      Sets the function that creates components to be used as editors for the column. When set to null, an empty component is used instead.
      Parameters:
      componentFunction - the function that generates editor components
    • 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
    • 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
    • render

      public Rendering<T> render(Element container, DataKeyMapper<T> keyMapper, String rendererName)
      Description copied from class: Renderer
      Registers a renderer function with the given name to the given container element. Creates the setup to handle rendering of individual data items as requested by the renderer function invocation.
      Specified by:
      render in class Renderer<T>
      Parameters:
      container - the element which accepts the renderer function on the client.
      keyMapper - mapper used internally to fetch items by key and to provide keys for given items.
      rendererName - name of the renderer function the container element accepts
      Returns:
      the context of the rendering, that can be used by the components to provide extra customization