Caplin Trader 4.0.3

Class: module:caplin/presenter/component/PresenterComponent

module:caplin/presenter/component/PresenterComponent

Summary

The PresenterComponent class allows Caplin components (widgets that can be embedded within a layout or opened within a dialog) to be constructed using a module:caplin/presenter/PresentationModel and an HTML template.

When component life cycle events are triggered on the PresenterComponent these are proxied through to the PresentationModel if they are defined in the PresentationModel.

Constructor

new module:caplin/presenter/component/PresenterComponent(sTemplateId, vPresentationModel)

Constructs a new instance of PresenterComponent.

Instances of PresenterComponent can also be created from an XML snippet using the following methods:

Parameters:
Name Type Description
sTemplateId String The id of a template to render the presentation model with.
vPresentationModel Object A presentation model instance, or the name of a presentation model class that can be constructed.
Implements:

Methods

addComponentLifecycleListener(oListener)

Add a component life-cycle event listener.
Parameters:
Name Type Description
oListener module:caplin/component/ComponentLifecycleEvents The listener being registered.

deserialize(sPresenterData)

Extracts the data inside the presenter tag and gives it to the PresentationModel for deserialization. Only has affect if the Presentation Model implements module:caplin/presenter/SerializablePresentationModel.
Parameters:
Name Type Description
sPresenterData String The presenter xml node in string format

getPresentationModel()

Retrieve the presentation model being displayed by this component.

isViewAttached()

Returns true once module:caplin/component/ComponentLifecycleEvents#onOpen has fired, and the element returned from module:caplin/presenter/component/PresenterComponent#getElement has been attached to the page.

removeComponentLifecycleListener(oListener)

Remove a previously registered component life-cycle event listener.
Parameters:
Name Type Description
oListener module:caplin/component/ComponentLifecycleEvents The listener being removed.