public class ComponentRenderer extends AbstractRenderer<Object,Component>
Note: The use of ComponentRenderer causes the Grid to generate components for all items currently available in the client-side. This means that a number of components is always generated and sent to the client. Using complex structures of many nested components might be heavy to generate and store, which will lead to performance problems.
Note: Components will occasionally be generated again during runtime e.g. when selection changes. If your component has an internal state that is not stored into the object, you should reuse the same component instances.
Example of how to add a Label
component to Grid
:
Gridgrid; grid.addColumn(person -> new Label(person.getFullName()), new ComponentRenderer()).setCaption("Full Name");
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Constructor and Description |
---|
ComponentRenderer()
Constructor for ComponentRenderer.
|
Modifier and Type | Method and Description |
---|---|
JsonValue |
encode(Component value)
Encodes the given value into a
JsonValue . |
protected ComponentRendererState |
getState()
Returns the shared state for this connector.
|
protected ComponentRendererState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
encode, extend, getNullRepresentation, getParent, getParentGrid, getPresentationType, getSupportedParentType
remove, setParent
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
public JsonValue encode(Component value)
Renderer
JsonValue
.protected ComponentRendererState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractRenderer<Object,Component>
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
protected ComponentRendererState getState()
AbstractClientConnector
As a side effect, marks the connector dirty so any changes done to the
state will be sent to the client. Use getState(false)
to avoid
marking the connector as dirty.
getState
in class AbstractRenderer<Object,Component>
Copyright © 2020 Vaadin Ltd. All rights reserved.