Add fist version of notifier. More work pending ...
This commit is contained in:
@@ -188,6 +188,7 @@
|
||||
files="collaboration/framework/brix/BrixCollaborativeModelFactory.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="collaboration/framework/brix/BrixFramework.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarNotifier.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarItem.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarPaneItem.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/widget/" files="NoteEditor.js"/>
|
||||
|
@@ -239,7 +239,7 @@ mindplot.Designer = new Class({
|
||||
this._workspace.setZoom(scale);
|
||||
}
|
||||
else {
|
||||
core.Monitor.getInstance().logMessage('Sorry, no more zoom can be applied. \n Why do you need more?');
|
||||
$notify('No more zoom can be applied');
|
||||
}
|
||||
|
||||
},
|
||||
@@ -256,7 +256,7 @@ mindplot.Designer = new Class({
|
||||
this._workspace.setZoom(scale);
|
||||
}
|
||||
else {
|
||||
core.Monitor.getInstance().logMessage('Sorry, no more zoom can be applied. \n Why do you need more?');
|
||||
$notify('No more zoom can be applied');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -269,14 +269,14 @@ mindplot.Designer = new Class({
|
||||
var nodes = this.getModel().filterSelectedTopics();
|
||||
if (nodes.length <= 0) {
|
||||
// If there are more than one node selected,
|
||||
core.Monitor.getInstance().logMessage('Could not create a topic. Only one node must be selected.');
|
||||
$notify('Could not create a topic. Only one node must be selected.');
|
||||
return;
|
||||
|
||||
}
|
||||
if (nodes.length != 1) {
|
||||
|
||||
// If there are more than one node selected,
|
||||
core.Monitor.getInstance().logMessage('Could not create a topic. One topic must be selected.');
|
||||
$notify('Could not create a topic. One topic must be selected.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -294,13 +294,13 @@ mindplot.Designer = new Class({
|
||||
var nodes = this.getModel().filterSelectedTopics();
|
||||
if (nodes.length <= 0) {
|
||||
// If there are more than one node selected,
|
||||
core.Monitor.getInstance().logMessage('Could not create a topic. Only one node must be selected.');
|
||||
$notify('Could not create a topic. Only one node must be selected.');
|
||||
return;
|
||||
|
||||
}
|
||||
if (nodes.length > 1) {
|
||||
// If there are more than one node selected,
|
||||
core.Monitor.getInstance().logMessage('Could not create a topic. One topic must be selected.');
|
||||
$notify('Could not create a topic. One topic must be selected.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -103,7 +103,7 @@ mindplot.DesignerModel = new Class({
|
||||
if (isValid) {
|
||||
result.push(selectedNode.getId());
|
||||
} else {
|
||||
core.Monitor.getInstance().logMessage(errorMsg);
|
||||
$notify(errorMsg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -124,7 +124,7 @@ mindplot.DesignerModel = new Class({
|
||||
if (isValid) {
|
||||
result.push(selectedLine.getId());
|
||||
} else {
|
||||
core.Monitor.getInstance().logMessage(errorMsg);
|
||||
$notify(errorMsg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@@ -46,7 +46,7 @@ mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHa
|
||||
}
|
||||
},
|
||||
errorHandler:function(message) {
|
||||
var monitor = core.Monitor.getInstance();
|
||||
var monitor = core.ToolbarNotifier.getInstance();
|
||||
monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
|
||||
// wLogger.error(message);
|
||||
},
|
||||
@@ -75,7 +75,7 @@ mindplot.PersistanceManager.load = function(mapId) {
|
||||
} else {
|
||||
// Handle error message ...
|
||||
var msg = response.msgDetails;
|
||||
var monitor = core.Monitor.getInstance();
|
||||
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);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ mindplot.PersistanceManager.load = function(mapId) {
|
||||
verb:"GET",
|
||||
async: false,
|
||||
errorHandler:function(msg) {
|
||||
var monitor = core.Monitor.getInstance();
|
||||
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);
|
||||
}
|
||||
|
@@ -17,32 +17,49 @@
|
||||
*/
|
||||
|
||||
mindplot.widget.ToolbarNotifier = new Class({
|
||||
initialize : function() {
|
||||
},
|
||||
|
||||
_showMsg : function(msg, msgKind) {
|
||||
if (msgKind == core.ToolbarNotifier.MsgKind.ERROR) {
|
||||
msg = "<div id='small_error_icon'>" + msg + "</div>";
|
||||
}
|
||||
this._msgElem.innerHTML = msg;
|
||||
initialize : function() {
|
||||
this._container = $('headerNotifier');
|
||||
this._effect = new Fx.Elements(this._container, {
|
||||
onComplete: function() {
|
||||
this._container.setStyle('display', 'none');
|
||||
}.bind(this),
|
||||
link:'cancel',
|
||||
duration:8000,
|
||||
transition: Fx.Transitions.Expo.easeInOut
|
||||
});
|
||||
},
|
||||
|
||||
logError : function(userMsg) {
|
||||
this.logMessage(userMsg, core.ToolbarNotifier.MsgKind.ERROR);
|
||||
this.logMessage(userMsg, mindplot.widget.ToolbarNotifier.MsgKind.ERROR);
|
||||
},
|
||||
|
||||
logMessage : function(msg, msgKind) {
|
||||
console.log(msg);
|
||||
},
|
||||
logMessage : function(msg) {
|
||||
$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'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
core.ToolbarNotifier.MsgKind = {
|
||||
mindplot.widget.ToolbarNotifier.MsgKind = {
|
||||
INFO:1,
|
||||
WARNING:2,
|
||||
ERROR:3,
|
||||
FATAL:4
|
||||
};
|
||||
|
||||
$notifier = new mindplot.widget.ToolbarNotifier();
|
||||
var toolbarNotifier = new mindplot.widget.ToolbarNotifier();
|
||||
$notify = toolbarNotifier.logMessage.bind(toolbarNotifier);
|
@@ -22,7 +22,7 @@ TestCase("Mindplot test",{
|
||||
{
|
||||
designer.save(function()
|
||||
{
|
||||
// var monitor = core.Monitor.getInstance();
|
||||
// var monitor = core.ToolbarNotifier.getInstance();
|
||||
}, false);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user