From a923e202f4480042c25058ef441649809fa4bcc6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 27 May 2019 11:17:33 +0200 Subject: [PATCH] Designer Loading --- .../Workspace/FunctionLibraries/PartsFromNodes.js | 4 ++-- .../Workspace/FunctionLibraries/ProtocolNode.js | 11 +---------- .../Workspace/FunctionLibraries/WorkspaceNode.js | 13 ++----------- StrategySpace/Workspace/Workspace.js | 1 + 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 07e127ecc..894930488 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -3,7 +3,7 @@ function newPartsFromNodes () { createPartFromNode: createPartFromNode } - return newPartsFromNodes + return thisObject function createPartFromNode (node, parentNode, chainParent) { switch (node.type) { @@ -201,7 +201,7 @@ function newPartsFromNodes () { payload.node = node payload.parentNode = parentNode payload.chainParent = chainParent - payload.onMenuItemClick = onMenuItemClick + payload.onMenuItemClick = canvas.strategySpace.workspace.onMenuItemClick if (node.id === undefined) { node.id = newUniqueId() diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 49c93456e..d4ab6529a 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -5,6 +5,7 @@ function newProtocolNode () { return thisObject function getProtocolNode (node) { + if (node === undefined) { return } switch (node.type) { case 'Condition': { @@ -46,7 +47,6 @@ function newProtocolNode () { return phase } case 'Stop': { - if (node === undefined) { return } let stop = { type: node.type, subType: node.subType, @@ -61,7 +61,6 @@ function newProtocolNode () { return stop } case 'Take Profit': { - if (node === undefined) { return } let takeProfit = { type: node.type, subType: node.subType, @@ -76,7 +75,6 @@ function newProtocolNode () { return takeProfit } case 'Take Position Event': { - if (node === undefined) { return } let event = { type: node.type, subType: node.subType, @@ -91,7 +89,6 @@ function newProtocolNode () { return event } case 'Trigger On Event': { - if (node === undefined) { return } let event = { type: node.type, subType: node.subType, @@ -106,7 +103,6 @@ function newProtocolNode () { return event } case 'Trigger Off Event': { - if (node === undefined) { return } let event = { type: node.type, subType: node.subType, @@ -121,7 +117,6 @@ function newProtocolNode () { return event } case 'Initial Definition': { - if (node === undefined) { return } let object = { type: node.type, subType: node.subType, @@ -130,7 +125,6 @@ function newProtocolNode () { return object } case 'Trigger Stage': { - if (node === undefined) { return } let stage = { type: node.type, subType: node.subType, @@ -142,7 +136,6 @@ function newProtocolNode () { return stage } case 'Open Stage': { - if (node === undefined) { return } let stage = { type: node.type, subType: node.subType, @@ -152,7 +145,6 @@ function newProtocolNode () { return stage } case 'Manage Stage': { - if (node === undefined) { return } let stage = { type: node.type, subType: node.subType, @@ -163,7 +155,6 @@ function newProtocolNode () { return stage } case 'Close Stage': { - if (node === undefined) { return } let stage = { type: node.type, subType: node.subType, diff --git a/StrategySpace/Workspace/FunctionLibraries/WorkspaceNode.js b/StrategySpace/Workspace/FunctionLibraries/WorkspaceNode.js index 20a8bedef..73dd2061d 100644 --- a/StrategySpace/Workspace/FunctionLibraries/WorkspaceNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/WorkspaceNode.js @@ -1,10 +1,11 @@ -function newProtocolNode () { +function newWorkspaceNode () { thisObject = { getWorkspaceNode: getWorkspaceNode } return thisObject function getWorkspaceNode (node) { + if (node === undefined) { return } switch (node.type) { case 'Condition': { @@ -52,7 +53,6 @@ function newProtocolNode () { return phase } case 'Stop': { - if (node === undefined) { return } let stop = { id: node.id, type: node.type, @@ -69,7 +69,6 @@ function newProtocolNode () { return stop } case 'Take Profit': { - if (node === undefined) { return } let takeProfit = { id: node.id, type: node.type, @@ -86,7 +85,6 @@ function newProtocolNode () { return takeProfit } case 'Take Position Event': { - if (node === undefined) { return } let event = { id: node.id, type: node.type, @@ -103,7 +101,6 @@ function newProtocolNode () { return event } case 'Trigger On Event': { - if (node === undefined) { return } let event = { id: node.id, type: node.type, @@ -120,7 +117,6 @@ function newProtocolNode () { return event } case 'Trigger Off Event': { - if (node === undefined) { return } let event = { id: node.id, type: node.type, @@ -137,7 +133,6 @@ function newProtocolNode () { return event } case 'Initial Definition': { - if (node === undefined) { return } let object = { id: node.id, type: node.type, @@ -148,7 +143,6 @@ function newProtocolNode () { return object } case 'Trigger Stage': { - if (node === undefined) { return } let stage = { id: node.id, type: node.type, @@ -162,7 +156,6 @@ function newProtocolNode () { return stage } case 'Open Stage': { - if (node === undefined) { return } let stage = { id: node.id, type: node.type, @@ -174,7 +167,6 @@ function newProtocolNode () { return stage } case 'Manage Stage': { - if (node === undefined) { return } let stage = { id: node.id, type: node.type, @@ -187,7 +179,6 @@ function newProtocolNode () { return stage } case 'Close Stage': { - if (node === undefined) { return } let stage = { id: node.id, type: node.type, diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 8b3b1a3aa..3c5fc586b 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -6,6 +6,7 @@ function newWorkspace () { tradingSystem: undefined, container: undefined, idAtStrategizer: undefined, + onMenuItemClick: onMenuItemClick, physics: physics, spawn: spawn, detachNode: detachNode,