Caplin Trader 5.1.0

Interface: module:ct-element/Renderer

module:ct-element/Renderer

A Renderer transforms machine readable data to a screen module:ct-control/Control, and captures user gestures which are then communicated back to one or more module:ct-element/RendererEventListeners.

This interface allows module:ct-element/Handlers to interact with the Renderer.

Methods

addRendererEventListener(rendererEventListener)

Adds a module:ct-element/RendererEventListener to which the Renderer will communicates user-gestures.

Parameters:
Name Type Description
rendererEventListener module:ct-element/RendererEventListener

The renderer event listener.

clear()

Clears the renderer value and all associated state, including the displayed value. The renderer will remain bound to the DOM.

clearState()

Clears the renderer state without clearing the displayed value. This is a performant version of clear for when you are going to update the displayed value immediately after clearing.

disable()

Disables the renderer control. Does nothing if the control has no concept of enabled/disabled.

enable()

Enables the renderer control. Does nothing if the control has no concept of enabled/disabled.

focus()

Moves the focus to this renderer. Does nothing if the control has no concept of focus.

getFieldValues() → {Map}

Returns the fields relating to the currently displayed value.

Returns:

The field values.

Type
Map

getFormattedValue() → {Variant}

Returns the formatted downstream value.

Returns:

The formatted downstream value.

Type
Variant

getName() → {string}

Returns the renderer name.

This is set by the framework that instantiates the Renderer (e.g. the grid) and represents the field context (e.g. "Bid Price").

Returns:

The renderer's name.

Type
string

getNamespace() → {string}

Returns the renderer namespace.

This is set by the framework that instantiates the Renderer (e.g. the grid) and represents the record context (e.g. "/FX/GBPUSD").

Returns:

The renderer's namespace.

Type
string

getParsedValue() → {Variant}

Returns the parsed upstream value.

Returns:

The parsed upstream value.

Type
Variant

getUnformattedValue() → {Variant}

Returns the unformatted downstream value.

Returns:

The unformatted downstream value.

Type
Variant

getUnparsedValue() → {Variant}

Returns the unparsed upstream value.

Returns:

The unparsed upstream value.

Type
Variant

getValue()

Gets the renderer value.

Returns:

vRendererValue The renderer value.

isEnabled() → {boolean}

Determines whether the control is enabled.

Returns:

if the control is enabled.

Type
boolean

raiseEvent(sType, mRendererEvent)

Raises a renderer event.

Parameters:
Name Type Description
sType string

The renderer event type.

mRendererEvent Map

The renderer event to raise.

removeRendererEventListener(rendererEventListener)

Removes a module:ct-element/RendererEventListener to which the Renderer will communicate user-gestures.

Parameters:
Name Type Description
rendererEventListener module:ct-element/RendererEventListener

The renderer event listener.

select()

Moves the focus and highlights this renderer. Does nothing if the control has no concept of focus.

setValue(vRendererValue)

Sets the renderer value.

Parameters:
Name Type Description
vRendererValue Variant

The renderer value.

toString() → {string}

Returns a human-readable string representation of the renderer, which is useful for debugging.

Returns:

The string representation

Type
string

updateFields(fieldValues)

Updates the renderer with the supplied fields. The field values will be reflected in the control on the next call to {module:ct-element/Renderer#refresh}.

The Renderer might depend on these fields either because it has been bound to them in the constructor, or if the XML renderer definition refers to these fields using the ${} notation.

Additional field values can be supplied and they will have no effect on the displayed value, but they will be returned by {module:ct-element/Renderer#getFieldValues}. This can exploited to hold additional information about the value (such as price ID or timestamp).

Parameters:
Name Type Description
fieldValues Map

the new field values.

updateFieldValues(fieldValues)

Updates the field values.

Parameters:
Name Type Description
fieldValues Map

The field values.