From f58860c3a609e60db54638992a140d6233f562d6 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Wed, 11 Mar 2015 14:50:18 -0400 Subject: [PATCH 1/2] we can now stop execution on a particular Blockly node,as opposed to just one of them. --- support/client/lib/vwf/model/blockly.js | 19 ++++++++++++++++++- support/client/lib/vwf/view/blockly.js | 4 ++-- .../vwf.example.com/blockly/manager.vwf.yaml | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 237c9d231..0fb8c8c7e 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -307,7 +307,7 @@ define( [ "module", "vwf/model", "vwf/utility", // -- callingMethod -------------------------------------------------------------------------- - callingMethod: function( nodeID, methodName /* [, parameter1, parameter2, ... ] */ ) { // TODO: parameters + callingMethod: function( nodeID, methodName, methodParameters ) { var node = this.state.nodes[ nodeID ]; if ( this.debug.methods ) { @@ -318,6 +318,23 @@ define( [ "module", "vwf/model", "vwf/utility", switch ( methodName ) { + case "stopExecutionForNode": + if ( methodParameters ) { + var id = methodParameters; + var currBlockly3Node= this.state.executingBlocks[ id ]; + if ( currBlockly3Node ) { + currBlockly3Node.interpreterStatus = "completed"; + this.kernel.setProperty( id, 'blockly_executing', false ); + this.kernel.fireEvent( id, "blocklyStopped", [ true ] ); + } else { + this.logger.errorx("stopExecutionForNode", "Node with", id, + "is not currently executing Blockly!"); + } + } else { + this.logger.errorx("stopExecutionForNode", "No node specified!"); + } + break; + case "stopAllExecution": for ( var id in this.state.executingBlocks ) { this.state.executingBlocks[ id ].interpreterStatus = "completed"; diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index d79f2f292..b27df8b2f 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -245,7 +245,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor getBlockXML( previousActiveNode ); setBlocklyUIVisibility( previousActiveNode, false ); show = ( previousActiveNode.ID !== newActiveNodeId ); - this.state.blockly.node = undefined; + this.state.blockly.node = undefined; } // If the new active node is different than the old, @@ -269,7 +269,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor if ( previousActiveNode !== undefined ) { getBlockXML( previousActiveNode ); setBlocklyUIVisibility( previousActiveNode, false ); - this.state.blockly.node = undefined; + this.state.blockly.node = undefined; } } break; diff --git a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml index 2cae95f56..1ea052bc6 100644 --- a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml @@ -27,6 +27,6 @@ properties: methods: startAllExecution: stopAllExecution: + stopExecutionForNode: events: blocklyContentChanged: - \ No newline at end of file From bc7c3694c662d9c10dd3afb87a3910549659d245 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Fri, 13 Mar 2015 03:22:37 -0400 Subject: [PATCH 2/2] Now, per Brett's suggestion, we changed stopExecutingForNode in manager.vwf.yaml to stopExecuting in controller.vwf.yaml. This way we don't have to pass the node ID as an argument. --- support/client/lib/vwf/model/blockly.js | 30 +++++++------------ .../blockly/controller.vwf.yaml | 1 + .../vwf.example.com/blockly/manager.vwf.yaml | 1 - 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 0fb8c8c7e..5948c6f12 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -317,23 +317,6 @@ define( [ "module", "vwf/model", "vwf/utility", if ( nodeID == this.kernel.application() ) { switch ( methodName ) { - - case "stopExecutionForNode": - if ( methodParameters ) { - var id = methodParameters; - var currBlockly3Node= this.state.executingBlocks[ id ]; - if ( currBlockly3Node ) { - currBlockly3Node.interpreterStatus = "completed"; - this.kernel.setProperty( id, 'blockly_executing', false ); - this.kernel.fireEvent( id, "blocklyStopped", [ true ] ); - } else { - this.logger.errorx("stopExecutionForNode", "Node with", id, - "is not currently executing Blockly!"); - } - } else { - this.logger.errorx("stopExecutionForNode", "No node specified!"); - } - break; case "stopAllExecution": for ( var id in this.state.executingBlocks ) { @@ -349,8 +332,6 @@ define( [ "module", "vwf/model", "vwf/utility", this.kernel.fireEvent( id, "blocklyStarted", [ true ] ); } break; - - } } else if ( node !== undefined ) { switch ( methodName ) { @@ -361,6 +342,17 @@ define( [ "module", "vwf/model", "vwf/utility", this.kernel.setProperty( nodeID, "blockly_xml", '' ); } break; + case "stopExecution": + var currBlockly3Node = this.state.executingBlocks[ nodeID ]; + if ( currBlockly3Node ) { + currBlockly3Node.interpreterStatus = "completed"; + this.kernel.setProperty( nodeID, 'blockly_executing', false ); + this.kernel.fireEvent( nodeID, "blocklyStopped", [ true ] ); + } else { + this.logger.errorx("stopExecutionForNode", "Node with", nodeID, + "is not currently executing Blockly!"); + } + break; } } }, diff --git a/support/proxy/vwf.example.com/blockly/controller.vwf.yaml b/support/proxy/vwf.example.com/blockly/controller.vwf.yaml index bc120d91b..fe9c506be 100644 --- a/support/proxy/vwf.example.com/blockly/controller.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/controller.vwf.yaml @@ -55,6 +55,7 @@ properties: methods: getWorldXYVector: blocklyClear: + stopExecution: events: blocklyStarted: blocklyExecuted: diff --git a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml index 1ea052bc6..a5143b347 100644 --- a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml @@ -27,6 +27,5 @@ properties: methods: startAllExecution: stopAllExecution: - stopExecutionForNode: events: blocklyContentChanged: