Class AbstractJavaScriptRenderer<T>
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- com.vaadin.v7.ui.Grid.AbstractGridExtension
-
- com.vaadin.v7.ui.Grid.AbstractRenderer<T>
-
- com.vaadin.v7.ui.renderers.AbstractJavaScriptRenderer<T>
-
- All Implemented Interfaces:
MethodEventSource,ClientConnector,Extension,com.vaadin.shared.Connector,Renderer<T>,Serializable
@Deprecated public abstract class AbstractJavaScriptRenderer<T> extends Grid.AbstractRenderer<T>
Deprecated.Base class for Renderers with all client-side logic implemented using JavaScript.When a new JavaScript renderer is initialized in the browser, the framework will look for a globally defined JavaScript function that will initialize the renderer. The name of the initialization function is formed by replacing . with _ in the name of the server-side class. If no such function is defined, each super class is used in turn until a match is found. The framework will thus first attempt with
com_example_MyRendererfor the server-sidecom.example.MyRenderer extends AbstractJavaScriptRendererclass. If MyRenderer instead extendscom.example.SuperRenderer, thencom_example_SuperRendererwill also be attempted ifcom_example_MyRendererhas not been defined.In addition to the general JavaScript extension functionality explained in
AbstractJavaScriptExtension, this class also provides some functionality specific for renderers.The initialization function will be called with
thispointing to a connector wrapper object providing integration to Vaadin. Please note that in JavaScript,thisis not necessarily defined inside callback functions and it might therefore be necessary to assign the reference to a separate variable, e.g.var self = this;. In addition to the extension functions described forAbstractJavaScriptExtension, the connector wrapper object also provides this function:getRowKey(rowIndex)- Gets a unique identifier for the row at the given index. This identifier can be used on the server to retrieve the corresponding ItemId usingGrid.AbstractGridExtension.getItemId(String).
render(cell, data)- Callback for rendering the given data into the given cell. The structure of cell and data are described in separate sections below. The renderer is required to implement this function. Corresponds tocom.vaadin.client.renderers.Renderer.render(com.vaadin.client.widget.grid.RendererCellReference, Object).init(cell)- Prepares a cell for rendering. Corresponds tocom.vaadin.client.renderers.ComplexRenderer.init(com.vaadin.client.widget.grid.RendererCellReference).destroy(cell)- Allows the renderer to release resources allocate for a cell that will no longer be used. Corresponds tocom.vaadin.client.renderers.ComplexRenderer.destroy(com.vaadin.client.widget.grid.RendererCellReference).onActivate(cell)- Called when the cell is activated by the user e.g. by double clicking on the cell or pressing enter with the cell focused. Corresponds tocom.vaadin.client.renderers.ComplexRenderer.onActivate(com.vaadin.client.widget.grid.CellReference).getConsumedEvents()- Returns a JavaScript array of event names that should cause onBrowserEvent to be invoked whenever an event is fired for a cell managed by this renderer. Corresponds tocom.vaadin.client.renderers.ComplexRenderer#getConsumedEvents().onBrowserEvent(cell, event)- Called by Grid when an event of a type returned by getConsumedEvents is fired for a cell managed by this renderer. Corresponds tocom.vaadin.client.renderers.ComplexRenderer.onBrowserEvent(com.vaadin.client.widget.grid.CellReference, com.google.gwt.dom.client.NativeEvent).
The cell object passed to functions defined by the renderer has these properties:
element- The DOM element corresponding to this cell. Readonly.rowIndex- The current index of the row of this cell. Readonly.columnIndex- The current index of the column of this cell. Readonly.colSpan- The number of columns spanned by this cell. Only supported in the object passed to therenderfunction - other functions should not use the property. Readable and writable.
- Since:
- 7.4
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractJavaScriptRenderer(Class<T> presentationType)Deprecated.protectedAbstractJavaScriptRenderer(Class<T> presentationType, String nullRepresentation)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddFunction(String functionName, JavaScriptFunction function)Deprecated.Register aJavaScriptFunctionthat can be called from the JavaScript using the provided name.protected voidcallFunction(String name, Object... arguments)Deprecated.Invoke a named function that the connector JavaScript has added to the JavaScript connector wrapper object.protected com.vaadin.shared.JavaScriptExtensionStategetState()Deprecated.protected <R extends com.vaadin.shared.communication.ServerRpc>
voidregisterRpc(R implementation, Class<R> rpcInterfaceType)Deprecated.-
Methods inherited from class com.vaadin.v7.ui.Grid.AbstractRenderer
encode, encode, encodeValue, extend, getNullRepresentation, getPresentationType, getSupportedParentType
-
Methods inherited from class com.vaadin.v7.ui.Grid.AbstractGridExtension
addComponentToGrid, getColumn, getItemId, getParentGrid, refreshRow, remove, removeComponentFromGrid
-
Methods inherited from class com.vaadin.server.AbstractExtension
getParent, setParent
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getState, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getParent, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
-
-
-
Method Detail
-
registerRpc
protected <R extends com.vaadin.shared.communication.ServerRpc> void registerRpc(R implementation, Class<R> rpcInterfaceType)Deprecated.- Overrides:
registerRpcin classAbstractClientConnector
-
addFunction
protected void addFunction(String functionName, JavaScriptFunction function)
Deprecated.Register aJavaScriptFunctionthat can be called from the JavaScript using the provided name. A JavaScript function with the provided name will be added to the connector wrapper object (initially available asthis). Calling that JavaScript function will cause the call method in the registeredJavaScriptFunctionto be invoked with the same arguments.- Parameters:
functionName- the name that should be used for client-side callbackfunction- theJavaScriptFunctionobject that will be invoked when the JavaScript function is called
-
callFunction
protected void callFunction(String name, Object... arguments)
Deprecated.Invoke a named function that the connector JavaScript has added to the JavaScript connector wrapper object. The arguments can be any boxed primitive type, String,JsonValueor arrays of any other supported type. Complex types (e.g. List, Set, Map, Connector or any JavaBean type) must be explicitly serialized to aJsonValuebefore sending. This can be done either withJsonCodec.encode(Object, JsonValue, java.lang.reflect.Type, com.vaadin.ui.ConnectorTracker)or using the factory methods inJson.- Parameters:
name- the name of the functionarguments- function arguments
-
getState
protected com.vaadin.shared.JavaScriptExtensionState getState()
Deprecated.- Overrides:
getStatein classAbstractClientConnector
-
-