Caplin Trader 4.8.0

Class: module:caplin/presenter/PresenterRenderer

module:caplin/presenter/PresenterRenderer

This class is used to bind a PresentationModel to a template. This is an alternative way of building presenter components. Typically you would create a regular component that uses this class in it's getElement method.

Constructor

new module:caplin/presenter/PresenterRenderer(viewModel, templateId)

Constructs a new instance of PresenterRenderer.
Parameters:
Name Type Description
viewModel Object A module:br/presenter/PresentationModel or an other valid presenter node.
templateId String ID of the template that the presentationModel will bound to.

Methods

addComponentLifecycleListener(listener)

Add a listener that will be informed of component life-cycle events. Note that this will only trigger `onOpen` and `onClose` events. This is for compatability with the rest of the Presenter framework that is expecting presenter components.
Parameters:
Name Type Description
listener Object
See:

bindView()

Binds the view to the model if it hasn't already been bound

destroy()

Destroys the bound element.

getElement() → {DOMElement}

On first call it will bind the view model to the template and return a DOM node, that can then be used to insert into the DOM. On subsequent calls it will returned the previously created DOM node.
Returns:
Type
DOMElement

getPresentationModel() → {Object}

Return the view model used in this renderer.
Returns:
Type
Object

getTemplateId() → {String}

Return the template ID used in this renderer.
Returns:
Type
String

isViewAttached() → {Boolean}

Returns true if the view has been attached.
Returns:
Type
Boolean

isViewBound() → {Boolean}

Returns true if the view has been bound.
Returns:
Type
Boolean

removeComponentLifecycleListener(listener)

Removes a component life-cycle event listener.
Parameters:
Name Type Description
listener Object
See:

viewIsOpened()

Components must call this method from their `onOpen` callback. This signals all interested parties that the view has been attached to the DOM and is now visible.