T
- the type of the object being processedpublic class EditorRenderer<T> extends Renderer<T> implements DataGenerator<T>
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.
Grid.Column.setEditorComponent(Component)
,
Grid.Column.setEditorComponent(SerializableFunction)
,
Serialized FormConstructor and Description |
---|
EditorRenderer(Editor<T> editor,
String columnInternalId)
Creates a new renderer for a specific column.
|
Modifier and Type | Method and Description |
---|---|
void |
generateData(T item,
elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serialized
JsonObject
representation. |
void |
refreshData(T item)
Informs the
DataGenerator 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.
|
getEventHandlers, getValueProviders, render, setEventHandler, setProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroyAllData, destroyData
public void setComponentFunction(SerializableFunction<T,? extends Component> componentFunction)
null
, an empty component is used
instead.componentFunction
- the function that generates editor componentspublic void generateData(T item, elemental.json.JsonObject jsonObject)
DataGenerator
JsonObject
representation. This JSON object will be sent to client-side
DataProvider.generateData
in interface DataGenerator<T>
item
- the data item being serializedjsonObject
- the JSON object being sent to the clientpublic void refreshData(T item)
DataGenerator
DataGenerator
that a data object has been updated.
This method should update any unneeded information stored for given item.refreshData
in interface DataGenerator<T>
item
- the updated itempublic Rendering<T> render(Element container, DataKeyMapper<T> keyMapper, Element contentTemplate)
Renderer
<template>
element in the given container.
Subclasses of Renderer usually override this method to provide additional features.
render
in class Renderer<T>
container
- the element in which the template will be attached to, not
null
keyMapper
- mapper used internally to fetch items by key and to provide
keys for given items. It is required when either event
handlers or DataGenerator
are supportedcontentTemplate
- the <template>
element to be used for rendering in the
container, not null
Copyright © 2019. All rights reserved.