diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index 0df8afc4..73bcbe56 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -413,7 +413,6 @@ mindplot.Designer = new Class({ this._nodeModelToNodeGraph(child, false); } - return nodeGraph; }, diff --git a/mindplot/src/main/javascript/DesignerModel.js b/mindplot/src/main/javascript/DesignerModel.js index 084f2939..fac2ee6a 100644 --- a/mindplot/src/main/javascript/DesignerModel.js +++ b/mindplot/src/main/javascript/DesignerModel.js @@ -137,6 +137,18 @@ mindplot.DesignerModel = new Class({ selectedTopic : function() { var topics = this.filterSelectedTopics(); return (topics.length > 0) ? topics[0] : null; - } + }, + findTopicById: function(id) { + var result = null; + for (var i = 0; i < this._topics.length; i++) { + var topic = this._topics[i]; + if(topic.getId()==id){ + result = topic; + break; + } + } + return result; + + } }); \ No newline at end of file diff --git a/mindplot/src/main/javascript/StandaloneActionDispatcher.js b/mindplot/src/main/javascript/StandaloneActionDispatcher.js index 1dfc224b..0a488ed5 100644 --- a/mindplot/src/main/javascript/StandaloneActionDispatcher.js +++ b/mindplot/src/main/javascript/StandaloneActionDispatcher.js @@ -230,6 +230,7 @@ mindplot.StandaloneActionDispatcher = new Class({ execute:function(command) { this._actionRunner.execute(command); + mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); } }); diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js index 1f9bc010..6a6a4916 100644 --- a/mindplot/src/main/javascript/Topic.js +++ b/mindplot/src/main/javascript/Topic.js @@ -1187,6 +1187,7 @@ mindplot.Topic = new Class({ workspace.removeChild(line); } this._isInWorkspace = false; + mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRemoved, this.getModel()); }, addToWorkspace : function(workspace) { diff --git a/mindplot/src/main/javascript/nlayout/EventBusDispatcher.js b/mindplot/src/main/javascript/nlayout/EventBusDispatcher.js index c643302e..c71f6194 100644 --- a/mindplot/src/main/javascript/nlayout/EventBusDispatcher.js +++ b/mindplot/src/main/javascript/nlayout/EventBusDispatcher.js @@ -23,6 +23,12 @@ mindplot.nlayout.EventBusDispatcher = new Class({ var size = {width:25,height:25}; this._layoutManager = new mindplot.nlayout.LayoutManager(0, size); + + this._layoutManager.addEvent('change', function(event) { + var id = event.getId(); + var topic = designerModel.findTopicById(id); + console.log("Modifing position to:" + id); + }); }, registerBusEvents:function () { @@ -72,7 +78,7 @@ mindplot.nlayout.EventBusDispatcher = new Class({ }, _nodeRemoved: function(node) { - console.log("mindplot.nlayout.EventBusDispatcher._nodeRemoved: Not Implemented yet"); + this._layoutManager.removeNode(node.getId()); }, _doLayout: function() {