diff --git a/mindplot/pom.xml b/mindplot/pom.xml
index 011fa1a5..d9892f10 100644
--- a/mindplot/pom.xml
+++ b/mindplot/pom.xml
@@ -95,6 +95,8 @@
files="XMLMindmapSerializer_Pela.js"/>
+
@@ -145,7 +147,7 @@
files="commands/AddRelationshipCommand.js"/>
-
diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js
index 744fe8ea..747f6787 100644
--- a/mindplot/src/main/javascript/Designer.js
+++ b/mindplot/src/main/javascript/Designer.js
@@ -137,7 +137,7 @@ mindplot.Designer = new Class({
if (!dragTopic.isVisible() && dragTopic.isConnected()) {
dragTopic.setVisibility(true);
}
- }
+ }
});
dragger.addEvent('enddragging', function(event, dragTopic) {
@@ -330,7 +330,6 @@ mindplot.Designer = new Class({
var layoutManager = this._eventBussDispatcher.getLayoutManager();
var result = layoutManager.predict(topic.getId(), mousePos);
childModel.setOrder(result.order);
- console.log(result.order);
var position = result.position;
childModel.setPosition(position.x, position.y);
@@ -420,6 +419,18 @@ mindplot.Designer = new Class({
$assert(mindmapModel, "mindmapModel can not be null");
this._mindmap = mindmapModel;
+ // Init layout manager ...
+ var size = {width:25,height:25};
+ var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
+ layoutManager.addEvent('change', function(event) {
+ var id = event.getId();
+ var topic = this.getModel().findTopicById(id);
+ topic.setPosition(event.getPosition());
+ topic.setOrder(event.getOrder());
+ }.bind(this));
+ this._eventBussDispatcher.setLayoutManager(layoutManager);
+
+
// Building node graph ...
var branches = mindmapModel.getBranches();
for (var i = 0; i < branches.length; i++) {
diff --git a/mindplot/src/main/javascript/Pela2TangoMigrator.js b/mindplot/src/main/javascript/Pela2TangoMigrator.js
index fe7fc04a..f97f9c66 100644
--- a/mindplot/src/main/javascript/Pela2TangoMigrator.js
+++ b/mindplot/src/main/javascript/Pela2TangoMigrator.js
@@ -29,9 +29,38 @@ mindplot.Pela2TangoMigrator = new Class({
$assert($defined(mapId), "mapId can not be null");
var mindmap = this._pelaSerializer.loadFromDom(dom, mapId);
mindmap.setVersion(mindplot.ModelCodeName.TANGO);
-
- // @todo: Cocinar los ordenes ....
-
+ this._fixOrder(mindmap);
return mindmap;
+ },
+
+ _fixOrder : function(mindmap) {
+ // First level node policies has been changed.
+ var centralNode = mindmap.getBranches()[0];
+ var children = centralNode.getChildren();
+ var leftNodes = [];
+ var rightNodes = [];
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var position = child.getPosition();
+ if (position.x < 0) {
+ leftNodes.push(child);
+ } else {
+ rightNodes.push(child);
+ }
+ }
+ rightNodes.sort(function(a, b) {
+ return a.getOrder() > b.getOrder()
+ });
+ leftNodes.sort(function(a, b) {
+ return a.getOrder() > b.getOrder();
+ });
+
+ for (i = 0; i < rightNodes.length; i++) {
+ rightNodes[i].setOrder(i*2);
+ }
+
+ for (i = 0; i < leftNodes.length; i++) {
+ leftNodes[i].setOrder(i*2+1);
+ }
}
});
diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js
index 47589b0d..3682aa2d 100644
--- a/mindplot/src/main/javascript/Topic.js
+++ b/mindplot/src/main/javascript/Topic.js
@@ -194,11 +194,11 @@ mindplot.Topic = new Class({
};
var setStrokeFunction = result.setStroke;
- result.setFill = function(color) {
+ result.setFill = function() {
};
- result.setStroke = function(color) {
+ result.setStroke = function() {
};
}
@@ -1091,7 +1091,7 @@ mindplot.Topic = new Class({
var size = this.getFontSize();
this.setFontSize(size, false);
}
- var textShape = this.getTextShape();
+ this.getTextShape();
// Display connection node...
var connector = targetTopic.getShrinkConnector();
@@ -1141,7 +1141,9 @@ mindplot.Topic = new Class({
var elem = this.get2DElement();
workspace.appendChild(elem);
if (!this.isInWorkspace()) {
- mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeAdded, this.getModel());
+ if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
+ mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeAdded, this.getModel());
+ }
if (this.getModel().isConnected())
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:this.getOutgoingConnectedTopic().getModel(), childNode: this.getModel()});
diff --git a/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js b/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js
index 64d73f99..a3f4a959 100644
--- a/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js
+++ b/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js
@@ -18,4 +18,4 @@
mindplot.XMLMindmapSerializer_Tango = new Class({
Extends: mindplot.XMLMindmapSerializer_Pela
-});
+});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/layout/EventBusDispatcher.js b/mindplot/src/main/javascript/layout/EventBusDispatcher.js
index 0e50c98b..5a122b78 100644
--- a/mindplot/src/main/javascript/layout/EventBusDispatcher.js
+++ b/mindplot/src/main/javascript/layout/EventBusDispatcher.js
@@ -17,19 +17,12 @@
*/
mindplot.layout.EventBusDispatcher = new Class({
- initialize:function(designerModel) {
- $assert(designerModel, "designerModel cannot be null");
+ initialize:function() {
this.registerBusEvents();
+ },
- var size = {width:25,height:25};
- this._layoutManager = new mindplot.layout.LayoutManager(0, size);
-
- this._layoutManager.addEvent('change', function(event) {
- var id = event.getId();
- var topic = designerModel.findTopicById(id);
- topic.setPosition(event.getPosition());
- topic.setOrder(event.getOrder());
- });
+ setLayoutManager : function(layoutManager) {
+ this._layoutManager = layoutManager;
},
registerBusEvents:function () {
diff --git a/wise-doc/src/main/webapp/html/editor.html b/wise-doc/src/main/webapp/html/editor.html
index f5298f55..c6544037 100644
--- a/wise-doc/src/main/webapp/html/editor.html
+++ b/wise-doc/src/main/webapp/html/editor.html
@@ -25,7 +25,7 @@
$(document).fireEvent('loadcomplete', 'brix');
};
- var mapId = 'mapId'; // @todo: Must be changed ...
+ var mapId = 'welcome'; // @todo: Must be changed ...
var brixReady = false;
var mindReady = false;
var collab = 'standalone';
@@ -59,12 +59,12 @@
// Load map from XML ...
var persitence = mindplot.PersitenceManager.getInstance();
var mindmap;
- try {
+// try {
mindmap = persitence.load(mapId);
- } catch(e) {
- // If the map could not be loaded, create a new empty map...
- mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
- }
+// } catch(e) {
+// // If the map could not be loaded, create a new empty map...
+// mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
+// }
designer.loadMap(mindmap);
diff --git a/wise-doc/src/main/webapp/maps/pepe.xml b/wise-doc/src/main/webapp/maps/pepe.xml
deleted file mode 100644
index 1e7680b4..00000000
--- a/wise-doc/src/main/webapp/maps/pepe.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
\ No newline at end of file
diff --git a/wise-doc/src/main/webapp/maps/welcome.xml b/wise-doc/src/main/webapp/maps/welcome.xml
index a3f432f2..813a82fb 100644
--- a/wise-doc/src/main/webapp/maps/welcome.xml
+++ b/wise-doc/src/main/webapp/maps/welcome.xml
@@ -33,7 +33,7 @@
-
+