Caplin Trader 4.8.0

Interface: module:caplin/element/RendererFramework

module:caplin/element/RendererFramework

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

Methods

bind(controlElement)

Binds the renderer to the DOM and attaches any event listeners to the control.
Parameters:
Name Type Description
controlElement HTMLElement The DOM element representing the renderer
Implementations:
  • module:caplin/element/renderer/BlankRenderer#bind
  • module:caplin/element/renderer/CompositeRenderer#bind
  • module:caplin/element/renderer/StreamRenderer#bind
See:

createHtml(fieldValues, className) → {HtmlElement|DocumentFragment}

Returns an HTMLElement (or DocumentFragment) 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 module:caplin/element/RendererFramework#getElement helper method — this invokes createHtml() and module:caplin/element/RendererFramework#bind on your behalf.
  2. A more performant mechanism for components that contain large numbers of renderers is to use invoke module:caplin/element/RendererFramework#createHtml and module:caplin/element/RendererFramework#bind yourself, so that the entire DOM strucutre for all renderers can be created using a single use call to appendChild, 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 module:caplin/element/Renderer#setValue afterwards.

Parameters:
Name Type Description
fieldValues Map The field values
className string The HTML class attribute (a space separated list)
Implementations:
  • module:caplin/element/renderer/BlankRenderer#createHtml
  • module:caplin/element/renderer/CompositeRenderer#createHtml
  • module:caplin/element/renderer/StreamRenderer#createHtml
See:
Returns:
The HTML fragment.
Type
HtmlElement | DocumentFragment

finalize()

Releases any renderer resources and resets its state.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#finalize
  • module:caplin/element/renderer/CompositeRenderer#finalize
  • module:caplin/element/renderer/StreamRenderer#finalize

getAllFieldNames() → {Array}

Returns a complete list of all field names that the renderer depends on.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#getAllFieldNames
  • module:caplin/element/renderer/CompositeRenderer#getAllFieldNames
  • module:caplin/element/renderer/StreamRenderer#getAllFieldNames
Returns:
The field names.
Type
Array

getElement() → {Element}

Returns the element that this renderer is associated with.

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

Implementations:
  • module:caplin/element/renderer/BlankRenderer~getElement
  • module:caplin/element/renderer/CompositeRenderer#getElement
  • module:caplin/element/renderer/StreamRenderer#getElement
See:
Returns:
The element associated with this renderer.
Type
Element

getPrimaryFieldNames() → {Array.<string>}

Returns a list of primary fields.
Implementations:
  • module:caplin/element/renderer/StreamRenderer#getPrimaryFieldNames
Returns:
The field names.
Type
Array.<string>

getSerialId() → {string}

Returns the serial id of the renderer instance.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getSerialId
  • module:caplin/element/renderer/StreamRenderer#getSerialId
Returns:
The renderer serial id.
Type
string

initialize(initialFieldValues)

Initializes the renderer and sets its state according to the supplied field values.
Parameters:
Name Type Description
initialFieldValues Map The initial field values
Implementations:
  • module:caplin/element/renderer/BlankRenderer#initialize
  • module:caplin/element/renderer/CompositeRenderer#initialize
  • module:caplin/element/renderer/StreamRenderer#initialize

isBound() → {boolean}

Returns true if the renderer has been bound to the DOM.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#isBound
  • module:caplin/element/renderer/CompositeRenderer#isBound
  • module:caplin/element/renderer/StreamRenderer#isBound
See:
Returns:
True if the renderer has been bound to the DOM, or false otherwise.
Type
boolean

setName(name)

Sets the renderer's name.
Parameters:
Name Type Description
name string The renderer's name.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#setName
  • module:caplin/element/renderer/StreamRenderer#setName

setNamespace(namespace)

Sets the renderer's namespace.
Parameters:
Name Type Description
namespace string The renderer's namespace.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#setNamespace
  • module:caplin/element/renderer/CompositeRenderer#setNamespace
  • module:caplin/element/renderer/StreamRenderer#setNamespace

unbind()

Unbinds the renderer from the DOM and detaches any event listeners to the control.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#unbind
  • module:caplin/element/renderer/CompositeRenderer#unbind
  • module:caplin/element/renderer/StreamRenderer#unbind
See: