Caplin Trader 5.1.0

Class: module:ct-control/complex/SpreadControl

module:ct-control/complex/SpreadControl(controlType)

The custom SpreadControl is a composite control for displaying a bid and ask price together using one Renderer.

As with all controls, instances are created by the RendererFactory (which uses XML RendererTypes) therefore this constructor should never be invoked.

Constructor

new module:ct-control/complex/SpreadControl(controlType)

Constructs a new SpreadControl with the specified arguments.

Extends:
Parameters:
Name Type Description
controlType module:ct-control/factory/ControlType

The control type.

Extends

Methods

addClass(className)

Adds the specified CSS class name to the control. This has no effect if it is already on the element.

Parameters:
Name Type Description
className String

The CSS class name to add to the DOM.

Inherited From:
Implements:

clear()

Clear the control and returns it to its original state.

Inherited From:
Implements:

clearState()

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

Inherited From:
Implements:

disable()

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

Inherited From:
Implements:

enable()

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

Inherited From:
Implements:

flash(value, duration)

Flashes the control based on the new control value. Does nothing if the control has no concept of flash. Note that this does not write the new value to the control itself, it merely styles the control according to the value.

Parameters:
Name Type Description
value Variant

The new control value.

duration int

The flash duration in milliseconds.

Inherited From:
Implements:

focus()

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

Inherited From:
Implements:

getAttributes() → {Map}

Gets the controls attributes

Inherited From:
Implements:
Returns:

A map of attributes.

Type
Map

getHeight() → {number}

Gets the height of the control.

Inherited From:
Returns:

The height of the DOM element in pixels.

Type
number

getId() → {integer}

Gets the numeric id of this control.

Inherited From:
Implements:
Returns:

The numeric id of this control.

Type
integer

getValue() → {Variant}

Gets the control value from the control.

Inherited From:
Implements:
Returns:

The control value.

Type
Variant

getWidth() → {number}

Gets the width of the control.

Inherited From:
Returns:

The width of the DOM element in pixels.

Type
number

isBound()

Returns true if the control is bound to the DOM.

Inherited From:

isEnabled() → {Boolean}

Determines whether the control is enabled.

Inherited From:
Implements:
Returns:

true if the control is enabled.

Type
Boolean

refresh()

Refresh the screen.

Inherited From:
Implements:

removeClass(className)

Removes the specified CSS class name from the control. This has no effect if it is not already on the element.

Parameters:
Name Type Description
className String

The CSS class name to add to the DOM.

Inherited From:
Implements:

removeFlash()

Removes the flash state from the control.

Inherited From:
Implements:

replaceClass(oldClassName, newClassName)

Replaces the specified CSS class on the control with a new class.

Parameters:
Name Type Description
oldClassName String

The old CSS class to remove.

newClassName String

The new CSS class to add.

Inherited From:
Implements:

select()

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

Inherited From:
Implements:

setDomValue(sValue)

Sets the value in the DOM.

Parameters:
Name Type Description
sValue string

The value to set in the DOM.

Inherited From:

setId(id)

Sets the id of this control.

Parameters:
Name Type Description
id integer

the value of the id to set.

Inherited From:
Implements:

setStyle(styleName, styleValue)

Sets the specified style the control's DOM element.

Parameters:
Name Type Description
styleName String

The style name to add to the DOM.

styleValue String

The style value.

Inherited From:
Implements:

setValue(value)

Sets the control value, which will update the screen. Depending on the renderer type, this will either be a simple string (if the renderer has no streams) or a map with stream names as its keys.

Parameters:
Name Type Description
value Variant

The new control value.

Inherited From:
Implements:

toString() → {String}

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

Overrides:
Implements:
Returns:

The string representation

Type
String