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

@@ -245,15 +245,31 @@ mindplot.widget.Menu = new Class({
var saveElem = $('save');
if (saveElem) {
this.addButton('save', false, false, function() {
$notify("Saving ...");
saveElem.setStyle('cursor', 'wait');
designer.save(function() {
saveElem.setStyle('cursor', 'pointer');
}, true);
// Load map content ...
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');
if (discartElem) {
var discardElem = $('discard');
if (discardElem) {
this.addButton('discard', false, false, function() {
if (!readOnly) {