Decouple persistence manager from Designer.
This commit is contained in:
@@ -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) {
|
||||
|
@@ -34,22 +34,31 @@ mindplot.widget.ToolbarNotifier = new Class({
|
||||
this.logMessage(userMsg, mindplot.widget.ToolbarNotifier.MsgKind.ERROR);
|
||||
},
|
||||
|
||||
logMessage : function(msg) {
|
||||
hide:function() {
|
||||
|
||||
},
|
||||
|
||||
logMessage : function(msg, fade) {
|
||||
$assert(msg, 'msg can not be null');
|
||||
this._container.set('text', msg);
|
||||
this._container.setStyle('display', 'block');
|
||||
|
||||
this._effect.start({
|
||||
0: {
|
||||
opacity: [1,0]
|
||||
}
|
||||
});
|
||||
this._container.position({
|
||||
relativeTo: $('header'),
|
||||
position: 'upperCenter',
|
||||
edge: 'centerTop'
|
||||
});
|
||||
|
||||
if (!$defined(fade) || fade) {
|
||||
this._effect.start({
|
||||
0: {
|
||||
opacity: [1,0]
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this._container.setStyle('opacity', '1');
|
||||
this._effect.pause();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user