Caplin Trader 4.7.1

Class: module:caplin/element/buffer/DisplayBuffer

module:caplin/element/buffer/DisplayBuffer

Constructor

new module:caplin/element/buffer/DisplayBuffer()

The DisplayBuffer class manages a 'throttle thread' that wakes up at regular intervals and refreshes buffered controls that have registered a request to refresh and/or flash. In this way, DisplayBuffer is used to restrict the update of a buffered control (one that implements module:caplin/element/buffer/Buffered) to at most one update in the interval at it operates. The DisplayBuffer manages a scheduled thread that manages buffered controls.

Methods

cancel(renderer)

Cancels any pending refreshes or flashes to the renderer and its control.
Parameters:
Name Type Description
renderer module:caplin/element/renderer/StreamRenderer The control to be cancelled.

finalize()

Releases all resources by clearing all queues and stopping the throttle thread.

isLive() → {Boolean}

Returns true if the DisplayBuffer has a currently active update scheduler thread.
Returns:
TRUE if update thread is currently running.
Type
Boolean

isQueueEmpty() → {boolean}

Returns true if there are no renderers waiting for notification to write their updates.
Returns:
TRUE if no renderers are queued waiting for update write notification.
Type
boolean

refresh()

Refreshes all pending controls in the queue and removes any stale flashes.

removeAllFlashes()

Resets the flash effect from all controls immediately, rather than waiting for them to go stale.

requestRefresh(renderer)

Registers a request to update the specified control.
Parameters:
Name Type Description
renderer module:caplin/element/Renderer The control to be refreshed.

requestRemoveFlash(control)

Registers a request to remove the flash of the specified control. The flash will be reset upon the next DisplayBuffer refresh.
Parameters:
Name Type Description
control module:caplin/element/Control The control that is to have its flash removed.

start()

Starts the throttle thread to run at the specified interval.

stop()

Stops the throttle thread.

toString() → {String}

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