diff --git a/mindplot/pom.xml b/mindplot/pom.xml index 95403a38..c8c9a490 100644 --- a/mindplot/pom.xml +++ b/mindplot/pom.xml @@ -107,6 +107,8 @@ + diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index 6d9455f1..61611999 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -443,9 +443,6 @@ mindplot.Designer = new Class({ var nodeModel = branches[i]; var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false); - // Now, refresh UI changes ... - nodeGraph.enableUICache(false); - // Update shrink render state... nodeGraph.setBranchVisibility(true); } @@ -480,6 +477,9 @@ mindplot.Designer = new Class({ _nodeModelToNodeGraph : function(nodeModel, isVisible) { $assert(nodeModel, "Node model can not be null"); var children = nodeModel.getChildren().slice(); + children = children.sort(function(a, b) { + return a.getOrder() - b.getOrder() + }); var nodeGraph = this._buildNodeGraph(nodeModel); diff --git a/mindplot/src/main/javascript/ModelCodeName.js b/mindplot/src/main/javascript/ModelCodeName.js index edc66ea9..4b201a75 100644 --- a/mindplot/src/main/javascript/ModelCodeName.js +++ b/mindplot/src/main/javascript/ModelCodeName.js @@ -17,5 +17,6 @@ */ mindplot.ModelCodeName = { BETA : "beta", - PELA : "pela" + PELA : "pela", + TANGO : "tango" }; \ No newline at end of file diff --git a/mindplot/src/main/javascript/Pela2TangoMigrator.js b/mindplot/src/main/javascript/Pela2TangoMigrator.js new file mode 100644 index 00000000..fe7fc04a --- /dev/null +++ b/mindplot/src/main/javascript/Pela2TangoMigrator.js @@ -0,0 +1,37 @@ +/* + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +mindplot.Pela2TangoMigrator = new Class({ + initialize : function(pelaSerializer) { + this._pelaSerializer = pelaSerializer; + this._tangoSerializer = new mindplot.XMLMindmapSerializer_Tango(); + }, + + toXML : function(mindmap) { + return this._tangoSerializer.toXML(mindmap); + }, + + loadFromDom : function(dom, mapId) { + $assert($defined(mapId), "mapId can not be null"); + var mindmap = this._pelaSerializer.loadFromDom(dom, mapId); + mindmap.setVersion(mindplot.ModelCodeName.TANGO); + + // @todo: Cocinar los ordenes .... + + return mindmap; + } +}); diff --git a/mindplot/src/main/javascript/StandaloneActionDispatcher.js b/mindplot/src/main/javascript/StandaloneActionDispatcher.js index a70318ef..4efcc00f 100644 --- a/mindplot/src/main/javascript/StandaloneActionDispatcher.js +++ b/mindplot/src/main/javascript/StandaloneActionDispatcher.js @@ -260,7 +260,6 @@ mindplot.CommandContext = new Class({ createTopic:function(model, isVisible) { $assert(model, "model can not be null"); var result = this._designer._nodeModelToNodeGraph(model, isVisible); - result.enableUICache(false); return result; }, diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js index 93718ac1..8862a487 100644 --- a/mindplot/src/main/javascript/Topic.js +++ b/mindplot/src/main/javascript/Topic.js @@ -41,38 +41,9 @@ mindplot.Topic = new Class({ this._registerEvents(); } - - this._cacheUIEnabled = true; - this._iuCache = {}; }, - isUICacheEnabled : function() { - return this._cacheUIEnabled; - }, - - enableUICache : function(value) { - this._cacheUIEnabled = value; - if (!value) { - this._flushUIUpdate(); - } - - // Propagate the change to the children nodes ... - var children = this._getChildren(); - for (var i = 0; i < children.length; i++) { - var node = children[i]; - node.enableUICache(value); - } - }, - - _flushUIUpdate: function() { - var position = this._iuCache['position']; - if (position) { - this.setPosition(position); - } - this._iuCache = {}; - }, - _registerEvents : function() { this.setMouseEventsEnabled(true); @@ -829,32 +800,21 @@ mindplot.Topic = new Class({ var currentPos = model.getPosition(); model.setPosition(point.x, point.y); - if (!this.isUICacheEnabled()) { - // Elements are positioned in the center. - // All topic element must be positioned based on the innerShape. - var size = this.getSize(); + // Elements are positioned in the center. + // All topic element must be positioned based on the innerShape. + var size = this.getSize(); - var cx = Math.round(point.x - (size.width / 2)); - var cy = Math.round(point.y - (size.height / 2)); + var cx = Math.round(point.x - (size.width / 2)); + var cy = Math.round(point.y - (size.height / 2)); - // Update visual position. - this._elem2d.setPosition(cx, cy); + // Update visual position. + this._elem2d.setPosition(cx, cy); - // Update connection lines ... - this._updateConnectionLines(); + // Update connection lines ... + this._updateConnectionLines(); - // Check object state. - this.invariant(); - - } else { - this._iuCache['position'] = point; - } - - if (!$defined(currentPos) || parseInt(currentPos.x) != parseInt(point.x) || parseInt(currentPos.y) != parseInt(point.y)) { - - // Fire Listener events ... - mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMoveEvent, [this]); - } + // Check object state. + this.invariant(); }, getOutgoingLine : function() { diff --git a/mindplot/src/main/javascript/XMLMindmapSerializerFactory.js b/mindplot/src/main/javascript/XMLMindmapSerializerFactory.js index 6a891ce1..7fa666f5 100644 --- a/mindplot/src/main/javascript/XMLMindmapSerializerFactory.js +++ b/mindplot/src/main/javascript/XMLMindmapSerializerFactory.js @@ -53,12 +53,17 @@ mindplot.XMLMindmapSerializerFactory._codeNames = { codeName:mindplot.ModelCodeName.BETA, serializer: mindplot.XMLMindmapSerializer_Beta, - migrator:function() {//todo:error + migrator:function() { } }, { codeName:mindplot.ModelCodeName.PELA, serializer:mindplot.XMLMindmapSerializer_Pela, migrator:mindplot.Beta2PelaMigrator + }, + { + codeName:mindplot.ModelCodeName.TANGO, + serializer:mindplot.XMLMindmapSerializer_Tango, + migrator:mindplot.Pela2TangoMigrator } ]; \ No newline at end of file diff --git a/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js b/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js index 117dd746..c0e27aca 100644 --- a/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js +++ b/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js @@ -168,6 +168,7 @@ mindplot.XMLMindmapSerializer_Beta = new Class({ // Start the loading process ... var version = rootElem.getAttribute("version"); + version = !$defined(version) ? mindplot.ModelCodeName.BETA : version; var mindmap = new mindplot.model.Mindmap(mapId, version); var children = rootElem.childNodes; diff --git a/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js b/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js new file mode 100644 index 00000000..64d73f99 --- /dev/null +++ b/mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js @@ -0,0 +1,21 @@ +/* + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +mindplot.XMLMindmapSerializer_Tango = new Class({ + Extends: mindplot.XMLMindmapSerializer_Pela +}); diff --git a/mindplot/src/main/javascript/commands/DragTopicCommand.js b/mindplot/src/main/javascript/commands/DragTopicCommand.js index 95fde129..e6d73c7c 100644 --- a/mindplot/src/main/javascript/commands/DragTopicCommand.js +++ b/mindplot/src/main/javascript/commands/DragTopicCommand.js @@ -41,9 +41,6 @@ mindplot.commands.DragTopicCommand = new Class({ // Cache nodes position ... var topics = designer.getModel().getTopics(); - topics.forEach(function(topic) { - topic.enableUICache(true); - }); // In this case, topics are positioned using order ... origOrder = topic.getOrder(); @@ -83,10 +80,6 @@ mindplot.commands.DragTopicCommand = new Class({ this._order = origOrder; this._position = origPosition; - topics.forEach(function(topic) { - topic.enableUICache(false); - }); - }, undoExecute: function(commandContext) { diff --git a/mindplot/src/main/javascript/model/Mindmap.js b/mindplot/src/main/javascript/model/Mindmap.js index 60f200d1..02c6ca86 100644 --- a/mindplot/src/main/javascript/model/Mindmap.js +++ b/mindplot/src/main/javascript/model/Mindmap.js @@ -22,7 +22,7 @@ mindplot.model.Mindmap = new Class({ this._branches = []; this._description = null; this._relationships = []; - this._version = $defined(version) ? version : 'pela'; + this._version = $defined(version) ? version : mindplot.ModelCodeName.TANGO; this._id = id; }, diff --git a/wise-doc/src/main/webapp/maps/pepe.xml b/wise-doc/src/main/webapp/maps/pepe.xml new file mode 100644 index 00000000..1e7680b4 --- /dev/null +++ b/wise-doc/src/main/webapp/maps/pepe.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file