All Plotting Working
This commit is contained in:
1 parent
6796745980
commit
283fe59ec1
5 files changed
+128
-28
No files matched your search
@@ -271,6 +271,42 @@ function newPlottersManager () {
|
||||
}
|
||||
connector.nodesErrors.onRecordChangeEventsSubscriptionId = connector.plotter.container.eventHandler.listenToEvent('Current Record Changed', connector.nodesErrors.onRecordChange)
|
||||
}
|
||||
if (plotterModule.nodesRunning !== undefined) {
|
||||
connector.nodesRunning = newNodesRunning()
|
||||
switch (plotterModule.config.connectTo) {
|
||||
case 'Trading System':
|
||||
connector.nodesRunning.initialize(tradingSystem)
|
||||
break
|
||||
case 'Trading Engine':
|
||||
connector.nodesRunning.initialize(tradingEngine)
|
||||
break
|
||||
}
|
||||
connector.nodesRunning.onRecordChangeEventsSubscriptionId = connector.plotter.container.eventHandler.listenToEvent('Current Record Changed', connector.nodesRunning.onRecordChange)
|
||||
}
|
||||
if (plotterModule.nodesStatus !== undefined) {
|
||||
connector.nodesStatus = newNodesStatus()
|
||||
switch (plotterModule.config.connectTo) {
|
||||
case 'Trading System':
|
||||
connector.nodesStatus.initialize(tradingSystem)
|
||||
break
|
||||
case 'Trading Engine':
|
||||
connector.nodesStatus.initialize(tradingEngine)
|
||||
break
|
||||
}
|
||||
connector.nodesStatus.onRecordChangeEventsSubscriptionId = connector.plotter.container.eventHandler.listenToEvent('Current Record Changed', connector.nodesStatus.onRecordChange)
|
||||
}
|
||||
if (plotterModule.nodesProgress !== undefined) {
|
||||
connector.nodesProgress = newNodesProgress()
|
||||
switch (plotterModule.config.connectTo) {
|
||||
case 'Trading System':
|
||||
connector.nodesProgress.initialize(tradingSystem)
|
||||
break
|
||||
case 'Trading Engine':
|
||||
connector.nodesProgress.initialize(tradingEngine)
|
||||
break
|
||||
}
|
||||
connector.nodesProgress.onRecordChangeEventsSubscriptionId = connector.plotter.container.eventHandler.listenToEvent('Current Record Changed', connector.nodesProgress.onRecordChange)
|
||||
}
|
||||
}
|
||||
thisObject.connectors.push(connector)
|
||||
}
|
||||
@@ -335,6 +371,18 @@ function newPlottersManager () {
|
||||
connector.plotter.container.eventHandler.stopListening(connector.nodesErrors.onRecordChangeEventsSubscriptionId)
|
||||
connector.nodesErrors.finalize()
|
||||
}
|
||||
if (connector.nodesStatus !== undefined) {
|
||||
connector.plotter.container.eventHandler.stopListening(connector.nodesStatus.onRecordChangeEventsSubscriptionId)
|
||||
connector.nodesStatus.finalize()
|
||||
}
|
||||
if (connector.nodesProgress !== undefined) {
|
||||
connector.plotter.container.eventHandler.stopListening(connector.Progress.onRecordChangeEventsSubscriptionId)
|
||||
connector.Progress.finalize()
|
||||
}
|
||||
if (connector.nodesRunning !== undefined) {
|
||||
connector.plotter.container.eventHandler.stopListening(connector.nodesRunning.onRecordChangeEventsSubscriptionId)
|
||||
connector.nodesRunning.finalize()
|
||||
}
|
||||
}
|
||||
|
||||
function setTimeFrame (pTimeFrame) {
|
||||
|
||||
@@ -20,7 +20,6 @@ function newUiObject () {
|
||||
formulaEditor: undefined,
|
||||
uiObjectTitle: undefined,
|
||||
circularProgressBar: undefined,
|
||||
isRunningAtBackend: undefined,
|
||||
isRunning: undefined,
|
||||
shortcutKey: undefined,
|
||||
isShowing: undefined,
|
||||
@@ -32,6 +31,7 @@ function newUiObject () {
|
||||
getReadyToReferenceAttach: getReadyToReferenceAttach,
|
||||
showAvailabilityToReferenceAttach: showAvailabilityToReferenceAttach,
|
||||
highlight: highlight,
|
||||
runningAtBackend: runningAtBackend,
|
||||
setErrorMessage: setErrorMessage,
|
||||
resetErrorMessage: resetErrorMessage,
|
||||
setValue: setValue,
|
||||
@@ -71,6 +71,9 @@ function newUiObject () {
|
||||
let isHighlighted
|
||||
let highlightCounter = 0
|
||||
|
||||
let isRunningAtBackend
|
||||
let runningAtBackendCounter = 0
|
||||
|
||||
let hasError
|
||||
let errorMessageCounter = 0
|
||||
|
||||
@@ -321,6 +324,7 @@ function newUiObject () {
|
||||
|
||||
iconPhysics()
|
||||
highlightPhisycs()
|
||||
runningAtBackendPhisycs()
|
||||
errorMessagePhisycs()
|
||||
valuePhisycs()
|
||||
percentagePhisycs()
|
||||
@@ -672,6 +676,14 @@ function newUiObject () {
|
||||
}
|
||||
}
|
||||
|
||||
function runningAtBackendPhisycs () {
|
||||
runningAtBackendCounter--
|
||||
if (runningAtBackendCounter < 0) {
|
||||
runningAtBackendCounter = 0
|
||||
isRunningAtBackend = false
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessagePhisycs () {
|
||||
errorMessageCounter--
|
||||
if (errorMessageCounter < 0) {
|
||||
@@ -709,6 +721,11 @@ function newUiObject () {
|
||||
highlightCounter = 30
|
||||
}
|
||||
|
||||
function runningAtBackend () {
|
||||
isRunningAtBackend = true
|
||||
runningAtBackendCounter = 5
|
||||
}
|
||||
|
||||
function setErrorMessage (message, duration) {
|
||||
if (message !== undefined) {
|
||||
errorMessage = message
|
||||
@@ -1820,7 +1837,7 @@ function newUiObject () {
|
||||
if (icon !== undefined) {
|
||||
if (icon.canDrawIcon === true) {
|
||||
let additionalImageSize = 0
|
||||
if (thisObject.isRunningAtBackend === true || isReadyToReferenceAttach === true || isReadyToChainAttach === true) { additionalImageSize = 20 }
|
||||
if (isRunningAtBackend === true || isReadyToReferenceAttach === true || isReadyToChainAttach === true) { additionalImageSize = 20 }
|
||||
let totalImageSize = additionalImageSize + thisObject.payload.floatingObject.currentImageSize
|
||||
if (canvas.floatingSpace.inMapMode === true) {
|
||||
totalImageSize = canvas.floatingSpace.transformImagesizeToMap(totalImageSize)
|
||||
@@ -1846,7 +1863,7 @@ function newUiObject () {
|
||||
|
||||
if (executingIcon !== undefined) {
|
||||
if (executingIcon.canDrawIcon === true) {
|
||||
if (thisObject.isRunningAtBackend === true) {
|
||||
if (isRunningAtBackend === true) {
|
||||
const DISTANCE_FROM_CENTER = thisObject.container.frame.radius / 3 + 50
|
||||
const EXECUTING_ICON_SIZE = 20 + thisObject.container.frame.radius / 6
|
||||
|
||||
|
||||
@@ -9,24 +9,37 @@ function newNodesProgress () {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let rootNode
|
||||
let hiriarchyMap
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
rootNode = undefined
|
||||
hiriarchyMap = undefined
|
||||
}
|
||||
|
||||
function initialize (pRootNode) {
|
||||
rootNode = pRootNode
|
||||
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = getHiriarchyMap(rootNode)
|
||||
}
|
||||
|
||||
function onRecordChange (currentRecord) {
|
||||
evalNode(rootNode, currentRecord.array, 0, applyProgress)
|
||||
if (currentRecord === undefined) { return }
|
||||
let array = currentRecord.progress
|
||||
if (array === undefined) { return }
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arrayItem = array[0]
|
||||
let nodeId = arrayItem[0]
|
||||
let value = arrayItem[1]
|
||||
applyValue(nodeId, value)
|
||||
}
|
||||
}
|
||||
|
||||
function applyProgress (node, value) {
|
||||
function applyValue (nodeId, value) {
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
node.payload.uiObject.setPercentage(node, value)
|
||||
if (value === true) { value = 'true' }
|
||||
if (value === false) { value = 'false' }
|
||||
node.payload.uiObject.setPercentage(value, 30)
|
||||
}
|
||||
}
|
||||
|
||||
+22
-13
@@ -9,28 +9,37 @@ function newNodesRunning () {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let rootNode
|
||||
let hiriarchyMap
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
rootNode = undefined
|
||||
hiriarchyMap = undefined
|
||||
}
|
||||
|
||||
function initialize (pRootNode) {
|
||||
rootNode = pRootNode
|
||||
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = getHiriarchyMap(rootNode)
|
||||
}
|
||||
|
||||
function onRecordChange (currentRecord) {
|
||||
evalNode(rootNode, currentRecord.array, 0, applyExecution)
|
||||
}
|
||||
|
||||
function applyExecution (node, value) {
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (value === 1) {
|
||||
node.payload.uiObject.isRunningAtBackend = true
|
||||
} else {
|
||||
node.payload.uiObject.isRunningAtBackend = false
|
||||
if (currentRecord === undefined) { return }
|
||||
let array = currentRecord.running
|
||||
if (array === undefined) { return }
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arrayItem = array[0]
|
||||
let nodeId = arrayItem[0]
|
||||
let value = arrayItem[1]
|
||||
applyValue(nodeId, value)
|
||||
}
|
||||
}
|
||||
|
||||
function applyValue (nodeId, value) {
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (value === true) { value = 'true' }
|
||||
if (value === false) { value = 'false' }
|
||||
node.payload.uiObject.runningAtBackend()
|
||||
}
|
||||
}
|
||||
|
||||
+19
-6
@@ -9,24 +9,37 @@ function newNodesStatus () {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let rootNode
|
||||
let hiriarchyMap
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
rootNode = undefined
|
||||
hiriarchyMap = undefined
|
||||
}
|
||||
|
||||
function initialize (pRootNode) {
|
||||
rootNode = pRootNode
|
||||
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = getHiriarchyMap(rootNode)
|
||||
}
|
||||
|
||||
function onRecordChange (currentRecord) {
|
||||
evalNode(rootNode, currentRecord.array, 0, applyStatus)
|
||||
if (currentRecord === undefined) { return }
|
||||
let array = currentRecord.status
|
||||
if (array === undefined) { return }
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arrayItem = array[0]
|
||||
let nodeId = arrayItem[0]
|
||||
let value = arrayItem[1]
|
||||
applyValue(nodeId, value)
|
||||
}
|
||||
}
|
||||
|
||||
function applyStatus (node, status) {
|
||||
function applyValue (nodeId, value) {
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
node.payload.uiObject.setStatus(node, status)
|
||||
if (value === true) { value = 'true' }
|
||||
if (value === false) { value = 'false' }
|
||||
node.payload.uiObject.setStatus(value, 30)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user