From d75ceba363c4e9fea6acb2bac18f41b916260587 Mon Sep 17 00:00:00 2001 From: Pablol Date: Wed, 10 Aug 2011 23:11:50 -0300 Subject: [PATCH] Adding new node with Brix integration --- .../main/javascript/BrixActionDispatcher.js | 10 ++++ .../src/main/javascript/MindmapDesigner.js | 4 +- .../AbstractCollaborativeFramework.js | 20 +++++++ .../frameworks/brix/model/Mindmap.js | 2 +- .../frameworks/brix/model/NodeModel.js | 60 ++++++++++++------- wise-doc/src/main/webapp/html/editor.html | 2 +- 6 files changed, 72 insertions(+), 26 deletions(-) diff --git a/mindplot/src/main/javascript/BrixActionDispatcher.js b/mindplot/src/main/javascript/BrixActionDispatcher.js index f6db9bbb..fa21fbf1 100644 --- a/mindplot/src/main/javascript/BrixActionDispatcher.js +++ b/mindplot/src/main/javascript/BrixActionDispatcher.js @@ -31,6 +31,16 @@ mindplot.BrixActionDispatcher = new Class({ } var topic = framework.getTopic(topicsIds[0]); topic.setText(text, true); + }, + + addTopic:function(model, parentTopicId, animated) { + var framework = mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework(); + var mindmap = framework.getModel(); + var centralTopic = mindmap.getCentralTopic(); + var newNode = mindmap.createNode(model.getType(), model.getId()); + var position = model.getPosition(); + newNode.setPosition(position.x, position.y); + newNode.connectTo(centralTopic); } }); diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index a85e614d..90457bf3 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -24,8 +24,8 @@ mindplot.MindmapDesigner = new Class({ // Dispatcher manager ... var commandContext = new mindplot.CommandContext(this); -// this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext); - this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext); + this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext); +// this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext); this._actionDispatcher.addEvent("modelUpdate", function(event) { this._fireEvent("modelUpdate", event); diff --git a/mindplot/src/main/javascript/collaboration/frameworks/AbstractCollaborativeFramework.js b/mindplot/src/main/javascript/collaboration/frameworks/AbstractCollaborativeFramework.js index 25b111ae..1bd5a85b 100644 --- a/mindplot/src/main/javascript/collaboration/frameworks/AbstractCollaborativeFramework.js +++ b/mindplot/src/main/javascript/collaboration/frameworks/AbstractCollaborativeFramework.js @@ -21,6 +21,16 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({ var id = branch.getId(); var node = mindmap.createNode(type,id); node.setText(branch.getText()); + var position = branch.getPosition(); + node.setPosition(position.x, position.y); + var children = branch.getChildren(); + children.forEach(function(child){ + var node2 = new mindplot.model.NodeModel(child.getType(),mindmap, child.getId()); + node2.setText(child.getText()); + var pos = child.getPosition(); + node2.setPosition(pos.x, pos.y); + node._appendChild(node2); + }); mindmap.addBranch(node); }.bind(this)); return mindmap; @@ -38,6 +48,16 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({ for(var i = 0; i - + WiseMapping - Editor