The
ControlFramework
interface specifies those lifecycle functions that are necessary
for a control implementation to be managed by the Control Framework.Methods
-
bind(eControlElement)
-
Binds the renderer to the DOM and attaches any event listeners to the control.
Parameters:
Name Type Description eControlElement
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(mFieldValues, sClassName) → {String}
-
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:
- The simplest way is to use the
module:caplin/element/RendererFramework#getElement
helper method — this invokescreateHtml()
andmodule:caplin/element/RendererFramework#bind
on your behalf. - A more performant mechanism for components that contain large numbers of renderers is to use
invoke
module:caplin/element/RendererFramework#createHtml
andmodule:caplin/element/RendererFramework#bind
yourself, so that the entire concatenated string containing the HTML for all renderers can be created using a single use call toinnerHTML
, allowing significant performance gains to be achieved.
This method must be called after the
FieldModel
has been set usingFieldModel.setFieldModel()
. If theFieldModel
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 tomodule:caplin/element/Renderer#setValue
afterwards.Parameters:
Name Type Description mFieldValues
Map The field values sClassName
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
- String
- The simplest way is to use the
-
createXhtml(sClassName) → {String}
-
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:
Name Type Description sClassName
String The HTML class attribute (a space separated list) - Implementations:
- module:caplin/element/renderer/BlankRenderer#createXhtml
- module:caplin/element/renderer/CompositeRenderer#createXhtml
- module:caplin/element/renderer/StreamRenderer#createXhtml
Returns:
The HTML fragment.- Type
- String
-
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
andmodule:caplin/element/RendererFramework#bind
, then this helper method will do this automatically on your behalf.- Implementations:
- module:caplin/element/renderer/CompositeRenderer#getElement
- module:caplin/element/renderer/StreamRenderer#getElement
- See:
-
- module:caplin/element/RendererFramework#createHTML
- module:caplin/element/RendererFramework#bind
- module:caplin/element/RendererFramework#unbind
Returns:
The element associated with this renderer.- Type
- Element
-
getPrimaryFieldNames() → {Array}
-
Returns a list of primary fields.
- Implementations:
- module:caplin/element/renderer/StreamRenderer#getPrimaryFieldNames
Returns:
The field names.- Type
- Array
-
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(mInitialFieldValues)
-
Initializes the renderer and sets its state according to the supplied field values.
Parameters:
Name Type Description mInitialFieldValues
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/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(sName)
-
Sets the renderer's name.
Parameters:
Name Type Description sName
String The renderer's name. - Implementations:
- module:caplin/element/renderer/CompositeRenderer#setName
- module:caplin/element/renderer/StreamRenderer#setName
-
setNamespace(sNamespace)
-
Sets the renderer's namespace.
Parameters:
Name Type Description sNamespace
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: