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 byGrid.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:
Grid.Column.setEditorComponent(Component)
,Grid.Column.setEditorComponent(SerializableFunction)
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EditorRenderer(Editor<T> editor, String columnInternalId)
Creates a new renderer for a specific column.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generateData(T item, elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serializedJsonObject
representation.void
refreshData(T item)
Informs theDataGenerator
that a data object has been updated.Rendering<T>
render(Element container, DataKeyMapper<T> keyMapper, Element contentTemplate)
Handles the rendering of the model objects by using the given<template>
element in the given container.void
setComponentFunction(SerializableFunction<T,? extends Component> componentFunction)
Sets the function that creates components to be used as editors for the column.-
Methods inherited from class com.vaadin.flow.data.renderer.Renderer
getEventHandlers, getValueProviders, render, setEventHandler, setProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.data.provider.DataGenerator
destroyAllData, destroyData
-
-
-
-
Method Detail
-
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 tonull
, 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 serializedJsonObject
representation. This JSON object will be sent to client-side DataProvider.- Specified by:
generateData
in interfaceDataGenerator<T>
- Parameters:
item
- the data item being serializedjsonObject
- the JSON object being sent to the client
-
refreshData
public void refreshData(T item)
Description copied from interface:DataGenerator
Informs theDataGenerator
that a data object has been updated. This method should update any unneeded information stored for given item.- Specified by:
refreshData
in interfaceDataGenerator<T>
- Parameters:
item
- the updated item
-
render
public Rendering<T> render(Element container, DataKeyMapper<T> keyMapper, Element contentTemplate)
Description copied from class:Renderer
Handles the rendering of the model objects by using the given<template>
element in the given container.Subclasses of Renderer usually override this method to provide additional features.
- Overrides:
render
in classRenderer<T>
- Parameters:
container
- the element in which the template will be attached to, notnull
keyMapper
- mapper used internally to fetch items by key and to provide keys for given items. It is required when either event handlers orDataGenerator
are supportedcontentTemplate
- the<template>
element to be used for rendering in the container, notnull
- Returns:
- the context of the rendering, that can be used by the components to provide extra customization
-
-