First editor integration.

This commit is contained in:
Paulo Veiga 2012-01-11 18:41:09 -03:00
parent d7817a6f2c
commit 8cf9e6d18e
5 changed files with 22 additions and 3 deletions

View File

@ -413,7 +413,6 @@ mindplot.Designer = new Class({
this._nodeModelToNodeGraph(child, false); this._nodeModelToNodeGraph(child, false);
} }
return nodeGraph; return nodeGraph;
}, },

View File

@ -137,6 +137,18 @@ mindplot.DesignerModel = new Class({
selectedTopic : function() { selectedTopic : function() {
var topics = this.filterSelectedTopics(); var topics = this.filterSelectedTopics();
return (topics.length > 0) ? topics[0] : null; 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;
}
}); });

View File

@ -230,6 +230,7 @@ mindplot.StandaloneActionDispatcher = new Class({
execute:function(command) { execute:function(command) {
this._actionRunner.execute(command); this._actionRunner.execute(command);
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
} }
}); });

View File

@ -1187,6 +1187,7 @@ mindplot.Topic = new Class({
workspace.removeChild(line); workspace.removeChild(line);
} }
this._isInWorkspace = false; this._isInWorkspace = false;
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRemoved, this.getModel());
}, },
addToWorkspace : function(workspace) { addToWorkspace : function(workspace) {

View File

@ -23,6 +23,12 @@ mindplot.nlayout.EventBusDispatcher = new Class({
var size = {width:25,height:25}; var size = {width:25,height:25};
this._layoutManager = new mindplot.nlayout.LayoutManager(0, size); 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 () { registerBusEvents:function () {
@ -72,7 +78,7 @@ mindplot.nlayout.EventBusDispatcher = new Class({
}, },
_nodeRemoved: function(node) { _nodeRemoved: function(node) {
console.log("mindplot.nlayout.EventBusDispatcher._nodeRemoved: Not Implemented yet"); this._layoutManager.removeNode(node.getId());
}, },
_doLayout: function() { _doLayout: function() {