Interface
caplin.presenter.control

ControlAdaptor

Interface implemented by control adaptor classes, that allow external controls to be used within presenter.

Constructor Summary

Attributes Name and Description
caplin.presenter.control.ControlAdaptor()

Method Summary

Attributes Name and Description
void destroy()

Called when the view is being disposed of to allow cleaning up of listeners and controls.

DOMElement getElement()

void onViewReady()

Called after the view is rendered to screen.

void setElement(Element eElement)

Sets the element in which the control will be rendered in.

void setOptions(Object mOptions)

Sets the configuration options of the control.

void setPresentationNode(caplin.presenter.node.PresentationNode oPresentationNode)

Sets the presentation node the control is being bound to.

Constructor Detail

caplin.presenter.control.ControlAdaptor()

Method Detail

void destroy()

Called when the view is being disposed of to allow cleaning up of listeners and controls.

DOMElement getElement()

Deprecated
use setElement instead Returns the element inside which the control is rendered.

It is the control adaptor's responsibility to either create an element for the control to reside within, or to return the control element itself — providing this is sufficient to hook up the various properties (e.g. 'enabled', 'visible', etc) that the presentation node may have.

void onViewReady()

Called after the view is rendered to screen.

Controls that need to perform some additional work once the element they are contained within has been added to the document (via #getElement), can do so within this call-back.

void setElement(Element eElement)

Sets the element in which the control will be rendered in.

Parameters
Element eElement DOM element to use as the container for the control. Some controls will use this element as the actual control (progressive enhancement).

void setOptions(Object mOptions)

Sets the configuration options of the control.

Control configuration options passed within the HTML template are made available using this method. Control options can be passed within the HTML template like this:

<div id="dropDownSelectBox"
 data-bind="controlNode:selectionField, control:'ext-select-box', controlOptions:{width:95}">
</div>

Parameters
Object mOptions A map of options

void setPresentationNode(caplin.presenter.node.PresentationNode oPresentationNode)

Sets the presentation node the control is being bound to.

It is the control adaptors responsibility to synchronize the presentation node with the control being adapted; any changes to the presentation node properties must be reflected in the control, and any user interactions with the control must be reflected in the presentation node.

Each control adaptor will typically be designed to work with a single type of presentation node, for example:

Authors are encouraged specify the presentation node type the control adaptor accepts within the package name (e.g. caplin.presenter.control.selectionfield.ExtJsComboBoxControlAdaptor), and to fail fast by throwing a caplin.presenter.control.InvalidControlModelError if they are bound to the wrong type of presentation node.

Parameters
caplin.presenter.node.PresentationNode oPresentationNode The presentation node the control is being bound to.
Throws
caplin.presenter.control.InvalidControlModelError
if the wrong type of presentation node is used.