Interface
caplin.element

RendererFramework

The ControlFramework interface specifies those lifecycle functions that are necessary for a control implementation to be managed by the Control Framework.

Constructor Summary

Attributes Name and Description
caplin.element.RendererFramework()

Method Summary

Attributes Name and Description
void bind(HtmlElement eControlElement)

Binds the renderer to the DOM and attaches any event listeners to the control.

String createHtml(Map mFieldValues, String sClassName)

Returns a string containing the HTML that defines this element.

String createXhtml(String sClassName)

Creates an XHTML fragment using the current field value obtained from the FieldModel.

void finalize()

Releases any renderer resources and resets its state.

Array getAllFieldNames()

Returns a complete list of all field names that the renderer depends on.

Element getElement()

Returns the element that this renderer is associated with.

Array getPrimaryFieldNames()

Returns a list of primary fields.

String getSerialId()

Returns the serial id of the renderer instance.

void initialize(Map mInitialFieldValues)

Initializes the renderer and sets its state according to the supplied field values.

boolean isBound()

Returns true if the renderer has been bound to the DOM.

void setName(String sName)

Sets the renderer's name.

void setNamespace(String sNamespace)

Sets the renderer's namespace.

void unbind()

Unbinds the renderer from the DOM and detaches any event listeners to the control.

Constructor Detail

caplin.element.RendererFramework()

Method Detail

void bind(HtmlElement eControlElement)

Binds the renderer to the DOM and attaches any event listeners to the control.

Parameters
HtmlElement eControlElement The DOM element representing the renderer
See
#createHtml
#unbind

String createHtml(Map mFieldValues, String sClassName)

Returns a string containing the HTML that defines this element.

This is the first of two steps required to bind a renderer to its corresponding HTML element. In fact, there are two ways of binding a renderer:

  1. The simplest way is to use the #getElement helper method — this invokes createHtml() and #bind on your behalf.
  2. A more performant mechanism for components that contain large numbers of renderers is to use invoke #createHtml and #bind yourself, so that the entire concatenated string containing the HTML for all renderers can be created using a single use call to innerHTML, allowing significant performance gains to be achieved.

This method must be called after the FieldModel has been set using FieldModel.setFieldModel(). If the FieldModel is populated with some initial data for this renderer, then the HTML fragment returned will also contain that value, obviating the need for an call to caplin.element.Renderer#setValue afterwards.

Parameters
Map mFieldValues The field values
String sClassName The HTML class attribute (a space separated list)
Returns
The HTML fragment.
See
#bind
#getElement

String createXhtml(String sClassName)

Creates an XHTML fragment using the current field value obtained from the FieldModel. The caller must write the XHTML to the DOM in some efficient way.

This method must be called after the FieldModel has been set using setFieldModel().

Parameters
String sClassName The HTML class attribute (a space separated list)
Returns
The HTML fragment.

void finalize()

Releases any renderer resources and resets its state.

Array getAllFieldNames()

Returns a complete list of all field names that the renderer depends on.

Returns
The field names.

Element getElement()

Returns the element that this renderer is associated with.

If the renderer binding was not performed manually using #createHtml and #bind, then this helper method will do this automatically on your behalf.

Returns
{Element} The element associated with this renderer.
See
#createHTML
#bind
#unbind

Array getPrimaryFieldNames()

Returns a list of primary fields.

Returns
The field names.

String getSerialId()

Returns the serial id of the renderer instance.

Returns
The renderer serial id.

void initialize(Map mInitialFieldValues)

Initializes the renderer and sets its state according to the supplied field values.

Parameters
Map mInitialFieldValues The initial field values

boolean isBound()

Returns true if the renderer has been bound to the DOM.

Returns
True if the renderer has been bound to the DOM, or false otherwise.
See
#bind
#unbind

void setName(String sName)

Sets the renderer's name.

Parameters
String sName The renderer's name.

void setNamespace(String sNamespace)

Sets the renderer's namespace.

Parameters
String sNamespace The renderer's namespace.

void unbind()

Unbinds the renderer from the DOM and detaches any event listeners to the control.

See
#bind
#isBound