Decouple persistence manager from Designer.

This commit is contained in:
Paulo Veiga
2011-11-28 21:27:57 -03:00
parent fb1bc476bc
commit 410d3553b1
11 changed files with 255 additions and 150 deletions

View File

@@ -37,15 +37,18 @@
$(document).addEvent('loadcomplete', function(resource) {
mindReady = resource == 'mind' ? true : mindReady;
if (mindReady) {
// Configure default persistence ...
mindplot.PersitenceManager.init(new mindplot.DwrPersitenceManager());
var persitence = mindplot.PersitenceManager.getInstance();
// Initialize editor ...
var editorProperties = ${mindmap.properties};
editorProperties.collab = 'standalone';
editorProperties.readOnly = false;
designer = buildDesigner(editorProperties);
var domDocument = core.Utils.createDocumentFromText(mapXml);
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
var mindmap = serializer.loadFromDom(domDocument, mapId);
var mindmap = persitence.loadFromDom(mapId, domDocument);
// Now, load the map ...
designer.loadMap(mindmap);