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.Columnto 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 voidgenerateData(T item, elemental.json.JsonObject jsonObject)Adds custom data for the given item to its serializedJsonObjectrepresentation.voidrefreshData(T item)Informs theDataGeneratorthat 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.voidsetComponentFunction(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:DataGeneratorAdds custom data for the given item to its serializedJsonObjectrepresentation. This JSON object will be sent to client-side DataProvider.- Specified by:
generateDatain 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:DataGeneratorInforms theDataGeneratorthat a data object has been updated. This method should update any unneeded information stored for given item.- Specified by:
refreshDatain interfaceDataGenerator<T>- Parameters:
item- the updated item
-
render
public Rendering<T> render(Element container, DataKeyMapper<T> keyMapper, Element contentTemplate)
Description copied from class:RendererHandles 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:
renderin classRenderer<T>- Parameters:
container- the element in which the template will be attached to, notnullkeyMapper- mapper used internally to fetch items by key and to provide keys for given items. It is required when either event handlers orDataGeneratorare 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
-
-