mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Decouple persistence manager from Designer.
This commit is contained in:
parent
fb1bc476bc
commit
410d3553b1
@ -56,7 +56,7 @@
|
|||||||
files="Overlay.js"/>
|
files="Overlay.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
|
<filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
|
||||||
files="MooDialog.js"/>
|
files="MooDialog.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
|
<filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
|
||||||
files="MooDialog.Request.js"/>
|
files="MooDialog.Request.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
|
<filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
|
||||||
files="MooDialog.Fx.js"/>
|
files="MooDialog.Fx.js"/>
|
||||||
@ -106,7 +106,9 @@
|
|||||||
<filelist dir="${basedir}/src/main/javascript/" files="Beta2PelaMigrator.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="Beta2PelaMigrator.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="XMLMindmapSerializerFactory.js"/>
|
files="XMLMindmapSerializerFactory.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="PersistanceManager.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/" files="DwrPersistenceManager.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/" files="FilePersistenceManager.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="BubbleTip.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="BubbleTip.js"/>
|
||||||
|
@ -345,21 +345,11 @@ mindplot.Designer = new Class({
|
|||||||
return this._actionDispatcher._actionRunner.hasBeenChanged();
|
return this._actionDispatcher._actionRunner.hasBeenChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
save : function(onSavedHandler, saveHistory) {
|
|
||||||
var mindmap = this.getMindmap();
|
|
||||||
var properties = {zoom:this.getModel().getZoom(), layoutManager:this._layoutManager.getClassName()};
|
|
||||||
|
|
||||||
var persistantManager = mindplot.PersistanceManager;
|
getMindmapProperties : function() {
|
||||||
persistantManager.save(mindmap, properties, onSavedHandler, saveHistory);
|
return {zoom:this.getModel().getZoom(), layoutManager:this._layoutManager.getClassName()};
|
||||||
this.fireEvent("save", {type:saveHistory});
|
|
||||||
|
|
||||||
// Refresh undo state...
|
|
||||||
//@Todo: Review all this. It should not be here ...
|
|
||||||
|
|
||||||
// this._actionDispatcher.markAsChangeBase();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
loadMap : function(mindmapModel) {
|
loadMap : function(mindmapModel) {
|
||||||
$assert(mindmapModel, "mindmapModel can not be null");
|
$assert(mindmapModel, "mindmapModel can not be null");
|
||||||
this._mindmap = mindmapModel;
|
this._mindmap = mindmapModel;
|
||||||
|
@ -99,13 +99,12 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
|
|
||||||
'ctrl+s' : function(event) {
|
'ctrl+s' : function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
designer.save(null, true);
|
$('save').fireEvent('click');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'meta+s' : function(event) {
|
'meta+s' : function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
designer.save(null, true);
|
$('save').fireEvent('click');
|
||||||
},
|
},
|
||||||
|
|
||||||
'ctrl+i' : function() {
|
'ctrl+i' : function() {
|
||||||
|
83
mindplot/src/main/javascript/DwrPersistenceManager.js
Normal file
83
mindplot/src/main/javascript/DwrPersistenceManager.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* 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.DwrPersitenceManager = new Class({
|
||||||
|
Extends:mindplot.PersitenceManager,
|
||||||
|
initialize: function() {
|
||||||
|
this.parent();
|
||||||
|
},
|
||||||
|
|
||||||
|
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||||
|
window.MapEditorService.saveMap(mapId, mapXml, pref, saveHistory, {
|
||||||
|
callback:function(response) {
|
||||||
|
if (response.msgCode != "OK") {
|
||||||
|
events.onError(response);
|
||||||
|
} else {
|
||||||
|
events.onSuccess(response);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
errorHandler:function(message) {
|
||||||
|
events.onError(message);
|
||||||
|
},
|
||||||
|
verb:"POST",
|
||||||
|
async: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
load : function(mapId) {
|
||||||
|
$assert(mapId, "mapId can not be null");
|
||||||
|
throw "This must be implemented";
|
||||||
|
|
||||||
|
// var result = {r:null};
|
||||||
|
// window.MapEditorService.loadMap(mapId, {
|
||||||
|
// callback:function(response) {
|
||||||
|
//
|
||||||
|
// if (response.msgCode == "OK") {
|
||||||
|
// // Explorer Hack with local files ...
|
||||||
|
// var xmlContent = response.content;
|
||||||
|
// var domDocument = core.Utils.createDocumentFromText(xmlContent);
|
||||||
|
// var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
|
||||||
|
// var mindmap = serializer.loadFromDom(domDocument);
|
||||||
|
// mindmap.setId(mapId);
|
||||||
|
//
|
||||||
|
// result.r = mindmap;
|
||||||
|
// } else {
|
||||||
|
// // Handle error message ...
|
||||||
|
// var msg = response.msgDetails;
|
||||||
|
// var monitor = core.ToolbarNotifier.getInstance();
|
||||||
|
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
|
||||||
|
//// wLogger.error(msg);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// verb:"GET",
|
||||||
|
// async: false,
|
||||||
|
// errorHandler:function(msg) {
|
||||||
|
// var monitor = core.ToolbarNotifier.getInstance();
|
||||||
|
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
|
||||||
|
//// wLogger.error(msg);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// return result.r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
48
mindplot/src/main/javascript/FilePersistenceManager.js
Normal file
48
mindplot/src/main/javascript/FilePersistenceManager.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.FilePersitenceManager = new Class({
|
||||||
|
Extends:mindplot.PersitenceManager,
|
||||||
|
initialize: function() {
|
||||||
|
this.parent();
|
||||||
|
},
|
||||||
|
|
||||||
|
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||||
|
console.log(mapXml);
|
||||||
|
events.onSuccess();
|
||||||
|
},
|
||||||
|
|
||||||
|
load : function(mapId) {
|
||||||
|
$assert(mapId, "mapId can not be null");
|
||||||
|
|
||||||
|
var domDocument;
|
||||||
|
var xmlRequest = new Request({
|
||||||
|
url: '../maps/' + mapId + '.xml',
|
||||||
|
method: 'get',
|
||||||
|
async: false,
|
||||||
|
onSuccess: function(responseText, responseXML) {
|
||||||
|
domDocument = responseXML;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
xmlRequest.send();
|
||||||
|
return this.loadFromDom(mapId, domDocument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.PersistanceManager = {};
|
|
||||||
|
|
||||||
mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHandler, saveHistory) {
|
|
||||||
$assert(mindmap, "mindmap can not be null");
|
|
||||||
$assert(editorProperties, "editorProperties can not be null");
|
|
||||||
|
|
||||||
var mapId = mindmap.getId();
|
|
||||||
$assert(mapId, "mapId can not be null");
|
|
||||||
|
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap(mindmap);
|
|
||||||
var xmlMap = serializer.toXML(mindmap);
|
|
||||||
var xmlMapStr = core.Utils.innerXML(xmlMap);
|
|
||||||
|
|
||||||
var pref = JSON.encode(editorProperties);
|
|
||||||
|
|
||||||
window.MapEditorService.saveMap(mapId, xmlMapStr, pref, saveHistory,
|
|
||||||
{
|
|
||||||
callback:function(response) {
|
|
||||||
|
|
||||||
if (response.msgCode != "OK") {
|
|
||||||
monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
|
|
||||||
// wLogger.error(response.msgDetails);
|
|
||||||
} else {
|
|
||||||
// Execute on success handler ...
|
|
||||||
if ($defined(onSavedHandler)) {
|
|
||||||
onSavedHandler();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
errorHandler:function(message) {
|
|
||||||
var monitor = core.ToolbarNotifier.getInstance();
|
|
||||||
monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
|
|
||||||
// wLogger.error(message);
|
|
||||||
},
|
|
||||||
verb:"POST",
|
|
||||||
async: false
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
mindplot.PersistanceManager.load = function(mapId) {
|
|
||||||
$assert(mapId, "mapId can not be null");
|
|
||||||
|
|
||||||
var result = {r:null};
|
|
||||||
window.MapEditorService.loadMap(mapId, {
|
|
||||||
callback:function(response) {
|
|
||||||
|
|
||||||
if (response.msgCode == "OK") {
|
|
||||||
// Explorer Hack with local files ...
|
|
||||||
var xmlContent = response.content;
|
|
||||||
var domDocument = core.Utils.createDocumentFromText(xmlContent);
|
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
|
|
||||||
var mindmap = serializer.loadFromDom(domDocument);
|
|
||||||
mindmap.setId(mapId);
|
|
||||||
|
|
||||||
result.r = mindmap;
|
|
||||||
} else {
|
|
||||||
// Handle error message ...
|
|
||||||
var msg = response.msgDetails;
|
|
||||||
var monitor = core.ToolbarNotifier.getInstance();
|
|
||||||
monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
|
|
||||||
// wLogger.error(msg);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
verb:"GET",
|
|
||||||
async: false,
|
|
||||||
errorHandler:function(msg) {
|
|
||||||
var monitor = core.ToolbarNotifier.getInstance();
|
|
||||||
monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
|
|
||||||
// wLogger.error(msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return result.r;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
68
mindplot/src/main/javascript/PersistenceManager.js
Normal file
68
mindplot/src/main/javascript/PersistenceManager.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* 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.PersitenceManager = new Class({
|
||||||
|
initialize: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
save: function(mindmap, editorProperties, saveHistory, events) {
|
||||||
|
$assert(mindmap, "mindmap can not be null");
|
||||||
|
$assert(editorProperties, "editorProperties can not be null");
|
||||||
|
|
||||||
|
var mapId = mindmap.getId();
|
||||||
|
$assert(mapId, "mapId can not be null");
|
||||||
|
|
||||||
|
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap(mindmap);
|
||||||
|
var domMap = serializer.toXML(mindmap);
|
||||||
|
var mapXml = core.Utils.innerXML(domMap);
|
||||||
|
|
||||||
|
var pref = JSON.encode(editorProperties);
|
||||||
|
try {
|
||||||
|
this.saveMapXml(mapId, mapXml, pref, saveHistory, events);
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
events.onError();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
load: function(mapId) {
|
||||||
|
throw "Method must be implemented";
|
||||||
|
},
|
||||||
|
|
||||||
|
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||||
|
throw "Method must be implemented";
|
||||||
|
},
|
||||||
|
|
||||||
|
loadFromDom : function(mapId, mapDom) {
|
||||||
|
$assert(mapId, "mapId can not be null");
|
||||||
|
$assert(mapDom, "mapDom can not be null");
|
||||||
|
|
||||||
|
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(mapDom);
|
||||||
|
return serializer.loadFromDom(mapDom, mapId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mindplot.PersitenceManager.init = function(instance) {
|
||||||
|
mindplot.PersitenceManager._instance = instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
mindplot.PersitenceManager.getInstance = function() {
|
||||||
|
return mindplot.PersitenceManager._instance;
|
||||||
|
};
|
||||||
|
|
@ -245,15 +245,31 @@ mindplot.widget.Menu = new Class({
|
|||||||
var saveElem = $('save');
|
var saveElem = $('save');
|
||||||
if (saveElem) {
|
if (saveElem) {
|
||||||
this.addButton('save', false, false, function() {
|
this.addButton('save', false, false, function() {
|
||||||
|
|
||||||
|
$notify("Saving ...");
|
||||||
saveElem.setStyle('cursor', 'wait');
|
saveElem.setStyle('cursor', 'wait');
|
||||||
designer.save(function() {
|
|
||||||
saveElem.setStyle('cursor', 'pointer');
|
// Load map content ...
|
||||||
}, true);
|
var mindmap = designer.getMindmap();
|
||||||
|
var mindmapProp = designer.getMindmapProperties();
|
||||||
|
|
||||||
|
var persistenceManager = mindplot.PersitenceManager.getInstance();
|
||||||
|
persistenceManager.save(mindmap, mindmapProp, true, {
|
||||||
|
onSuccess: function() {
|
||||||
|
saveElem.setStyle('cursor', 'pointer');
|
||||||
|
$notify("Save complete");
|
||||||
|
|
||||||
|
},
|
||||||
|
onError: function() {
|
||||||
|
saveElem.setStyle('cursor', 'pointer');
|
||||||
|
$notify("Save could not be completed. Try latter");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var discartElem = $('discard');
|
var discardElem = $('discard');
|
||||||
if (discartElem) {
|
if (discardElem) {
|
||||||
this.addButton('discard', false, false, function() {
|
this.addButton('discard', false, false, function() {
|
||||||
|
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
|
@ -34,22 +34,31 @@ mindplot.widget.ToolbarNotifier = new Class({
|
|||||||
this.logMessage(userMsg, mindplot.widget.ToolbarNotifier.MsgKind.ERROR);
|
this.logMessage(userMsg, mindplot.widget.ToolbarNotifier.MsgKind.ERROR);
|
||||||
},
|
},
|
||||||
|
|
||||||
logMessage : function(msg) {
|
hide:function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
logMessage : function(msg, fade) {
|
||||||
$assert(msg, 'msg can not be null');
|
$assert(msg, 'msg can not be null');
|
||||||
this._container.set('text', msg);
|
this._container.set('text', msg);
|
||||||
this._container.setStyle('display', 'block');
|
this._container.setStyle('display', 'block');
|
||||||
|
|
||||||
this._effect.start({
|
|
||||||
0: {
|
|
||||||
opacity: [1,0]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this._container.position({
|
this._container.position({
|
||||||
relativeTo: $('header'),
|
relativeTo: $('header'),
|
||||||
position: 'upperCenter',
|
position: 'upperCenter',
|
||||||
edge: 'centerTop'
|
edge: 'centerTop'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!$defined(fade) || fade) {
|
||||||
|
this._effect.start({
|
||||||
|
0: {
|
||||||
|
opacity: [1,0]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this._container.setStyle('opacity', '1');
|
||||||
|
this._effect.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -53,22 +53,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else if (collab == 'standalone' && mindReady) {
|
} else if (collab == 'standalone' && mindReady) {
|
||||||
|
// Configure default persistence manager ...
|
||||||
|
mindplot.PersitenceManager.init(new mindplot.FilePersitenceManager());
|
||||||
|
|
||||||
// Load map from XML ...
|
// Load map from XML ...
|
||||||
var domDocument;
|
var persitence = mindplot.PersitenceManager.getInstance();
|
||||||
var xmlRequest = new Request({
|
var mindmap = persitence.load("map1");
|
||||||
url: '../maps/map1.xml',
|
|
||||||
method: 'get',
|
|
||||||
async: false,
|
|
||||||
onSuccess: function(responseText, responseXML) {
|
|
||||||
domDocument = responseXML;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
xmlRequest.send();
|
|
||||||
|
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
|
|
||||||
var mindmap = serializer.loadFromDom(domDocument, mapId);
|
|
||||||
|
|
||||||
// Now, load the map ...
|
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
|
|
||||||
// If not problem has arisen, close the dialog ...
|
// If not problem has arisen, close the dialog ...
|
||||||
@ -77,12 +67,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @Todo: Hack for testing save ...
|
|
||||||
window.MapEditorService = {};
|
|
||||||
window.MapEditorService.saveMap = function(mapId, xmlMapStr, pref, saveHistory) {
|
|
||||||
console.log(xmlMapStr);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -232,9 +216,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="headerNotifier">
|
<div id="headerNotifier"></div>
|
||||||
Algo de texto
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="mindplot"></div>
|
<div id="mindplot"></div>
|
||||||
|
@ -37,15 +37,18 @@
|
|||||||
$(document).addEvent('loadcomplete', function(resource) {
|
$(document).addEvent('loadcomplete', function(resource) {
|
||||||
mindReady = resource == 'mind' ? true : mindReady;
|
mindReady = resource == 'mind' ? true : mindReady;
|
||||||
if (mindReady) {
|
if (mindReady) {
|
||||||
|
// Configure default persistence ...
|
||||||
|
mindplot.PersitenceManager.init(new mindplot.DwrPersitenceManager());
|
||||||
|
var persitence = mindplot.PersitenceManager.getInstance();
|
||||||
|
|
||||||
|
// Initialize editor ...
|
||||||
var editorProperties = ${mindmap.properties};
|
var editorProperties = ${mindmap.properties};
|
||||||
editorProperties.collab = 'standalone';
|
editorProperties.collab = 'standalone';
|
||||||
editorProperties.readOnly = false;
|
editorProperties.readOnly = false;
|
||||||
designer = buildDesigner(editorProperties);
|
designer = buildDesigner(editorProperties);
|
||||||
|
|
||||||
var domDocument = core.Utils.createDocumentFromText(mapXml);
|
var domDocument = core.Utils.createDocumentFromText(mapXml);
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
|
var mindmap = persitence.loadFromDom(mapId, domDocument);
|
||||||
var mindmap = serializer.loadFromDom(domDocument, mapId);
|
|
||||||
|
|
||||||
// Now, load the map ...
|
// Now, load the map ...
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
|
Loading…
Reference in New Issue
Block a user