Caplin Trader 4.8.0

Interface: module:caplin/element/Renderer

module:caplin/element/Renderer

A Renderer transforms machine readable data to a screen module:caplin/control/Control, and captures user gestures which are then communicated back to one or more module:caplin/element/RendererEventListeners. This interface allows module:caplin/element/Handlers to interact with the Renderer.
Implementations:

Methods

addRendererEventListener(rendererEventListener)

Adds a module:caplin/element/RendererEventListener to which the Renderer will communicates user-gestures.
Parameters:
Name Type Description
rendererEventListener module:caplin/element/RendererEventListener The renderer event listener.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#addRendererEventListener
  • module:caplin/element/renderer/CompositeRenderer#addRendererEventListener
  • module:caplin/element/renderer/StreamRenderer#addRendererEventListener

clear()

Clears the renderer value and all associated state, including the displayed value. The renderer will remain bound to the DOM.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#clear
  • module:caplin/element/renderer/CompositeRenderer#clear
  • module:caplin/element/renderer/StreamRenderer#clear

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.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#clearState
  • module:caplin/element/renderer/CompositeRenderer#clearState
  • module:caplin/element/renderer/StreamRenderer#clearState

disable()

Disables the renderer control. Does nothing if the control has no concept of enabled/disabled.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#disable
  • module:caplin/element/renderer/CompositeRenderer#disable
  • module:caplin/element/renderer/StreamRenderer#disable

enable()

Enables the renderer control. Does nothing if the control has no concept of enabled/disabled.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#enable
  • module:caplin/element/renderer/CompositeRenderer#enable
  • module:caplin/element/renderer/StreamRenderer#enable

focus()

Moves the focus to this renderer. Does nothing if the control has no concept of focus.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#focus
  • module:caplin/element/renderer/StreamRenderer#focus

getFieldValues() → {Map}

Returns the fields relating to the currently displayed value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getFieldValues
  • module:caplin/element/renderer/StreamRenderer#getFieldValues
Returns:
The field values.
Type
Map

getFormattedValue() → {Variant}

Returns the formatted downstream value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getFormattedValue
  • module:caplin/element/renderer/StreamRenderer#getFormattedValue
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").
Implementations:
  • module:caplin/element/renderer/StreamRenderer#getName
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").
Implementations:
  • module:caplin/element/renderer/BlankRenderer#getNamespace
  • module:caplin/element/renderer/CompositeRenderer#getNamespace
  • module:caplin/element/renderer/StreamRenderer#getNamespace
Returns:
The renderer's namespace.
Type
string

getParsedValue() → {Variant}

Returns the parsed upstream value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getParsedValue
  • module:caplin/element/renderer/StreamRenderer#getParsedValue
Returns:
The parsed upstream value.
Type
Variant

getUnformattedValue() → {Variant}

Returns the unformatted downstream value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getUnformattedValue
  • module:caplin/element/renderer/StreamRenderer#getUnformattedValue
Returns:
The unformatted downstream value.
Type
Variant

getUnparsedValue() → {Variant}

Returns the unparsed upstream value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getUnparsedValue
  • module:caplin/element/renderer/StreamRenderer#getUnparsedValue
Returns:
The unparsed upstream value.
Type
Variant

getValue()

Gets the renderer value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#getValue
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.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#raiseEvent
  • module:caplin/element/renderer/CompositeRenderer#raiseEvent
  • module:caplin/element/renderer/StreamRenderer#raiseEvent

removeRendererEventListener(rendererEventListener)

Removes a module:caplin/element/RendererEventListener to which the Renderer will communicate user-gestures.
Parameters:
Name Type Description
rendererEventListener module:caplin/element/RendererEventListener The renderer event listener.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#removeRendererEventListener
  • module:caplin/element/renderer/CompositeRenderer#removeRendererEventListener
  • module:caplin/element/renderer/StreamRenderer#removeRendererEventListener

select()

Moves the focus and highlights this renderer. Does nothing if the control has no concept of focus.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#select
  • module:caplin/element/renderer/StreamRenderer#select

setValue(vRendererValue)

Sets the renderer value.
Parameters:
Name Type Description
vRendererValue Variant The renderer value.
Implementations:
  • module:caplin/element/renderer/CompositeRenderer#setValue

toString() → {string}

Returns a human-readable string representation of the renderer, which is useful for debugging.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#toString
  • module:caplin/element/renderer/CompositeRenderer#toString
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:caplin/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:caplin/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.
Implementations:
  • module:caplin/element/renderer/BlankRenderer#updateFields
  • module:caplin/element/renderer/CompositeRenderer#updateFields
  • module:caplin/element/renderer/StreamRenderer#updateFields

updateFieldValues(fieldValues)

Updates the field values.
Parameters:
Name Type Description
fieldValues Map The field values.