mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 03:43:48 +01:00
Add new Tango serializer. Pending to comple migration.
This commit is contained in:
parent
89060af08b
commit
1b3ad1b42d
@ -107,6 +107,8 @@
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="ModelCodeName.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="XMLMindmapSerializer_Pela.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="XMLMindmapSerializer_Tango.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="XMLMindmapSerializer_Beta.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="Beta2PelaMigrator.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);
|
||||
|
||||
|
@ -17,5 +17,6 @@
|
||||
*/
|
||||
mindplot.ModelCodeName = {
|
||||
BETA : "beta",
|
||||
PELA : "pela"
|
||||
PELA : "pela",
|
||||
TANGO : "tango"
|
||||
};
|
37
mindplot/src/main/javascript/Pela2TangoMigrator.js
Normal file
37
mindplot/src/main/javascript/Pela2TangoMigrator.js
Normal file
@ -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;
|
||||
}
|
||||
});
|
@ -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;
|
||||
},
|
||||
|
||||
|
@ -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,7 +800,6 @@ 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();
|
||||
@ -845,16 +815,6 @@ mindplot.Topic = new Class({
|
||||
|
||||
// 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]);
|
||||
}
|
||||
},
|
||||
|
||||
getOutgoingLine : function() {
|
||||
|
@ -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
|
||||
}
|
||||
];
|
@ -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;
|
||||
|
21
mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js
Normal file
21
mindplot/src/main/javascript/XMLMindmapSerializer_Tango.js
Normal file
@ -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
|
||||
});
|
@ -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) {
|
||||
|
@ -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;
|
||||
},
|
||||
|
||||
|
26
wise-doc/src/main/webapp/maps/pepe.xml
Normal file
26
wise-doc/src/main/webapp/maps/pepe.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<map name="mapId" version="pela">
|
||||
<topic central="true" id="0">
|
||||
<topic position="127,-163" order="0" id="1"/>
|
||||
<topic position="-127,-33" order="1" id="2"/>
|
||||
<topic position="127,-130" order="2" id="3"/>
|
||||
<topic position="-127,0" order="3" id="4"/>
|
||||
<topic position="127,94" order="6" id="5">
|
||||
<topic position="251,94" order="0" text="ddddddddddddddddddddd" id="8">
|
||||
<topic position="364,55" order="0" id="9"/>
|
||||
<topic position="364,81" order="1" id="10"/>
|
||||
<topic position="364,107" order="2" id="11"/>
|
||||
<topic position="364,133" order="3" id="12"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic position="-127,33" order="5" id="6"/>
|
||||
<topic position="127,163" order="8" id="7"/>
|
||||
<topic position="127,-35" order="4" id="13">
|
||||
<topic position="216,-100" order="0" id="14"/>
|
||||
<topic position="216,-74" order="1" id="15"/>
|
||||
<topic position="216,3" order="4" id="16"/>
|
||||
<topic position="216,-48" order="2" id="17"/>
|
||||
<topic position="216,29" order="5" id="18"/>
|
||||
<topic position="216,-22" order="3" id="19"/>
|
||||
</topic>
|
||||
</topic>
|
||||
</map>
|
Loading…
Reference in New Issue
Block a user