mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Add error dialog for map error during loading.
This commit is contained in:
parent
4de8eb17ec
commit
8a4dee47f2
@ -139,44 +139,3 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) {
|
|||||||
|
|
||||||
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
||||||
};
|
};
|
||||||
|
|
||||||
core.Utils.animatePosition = function (elems, doneFn, designer) {
|
|
||||||
var _moveEffect = null;
|
|
||||||
var i = 10;
|
|
||||||
var step = 10;
|
|
||||||
var moveEffect = function () {
|
|
||||||
if (i > 0) {
|
|
||||||
var keys = elems.keys();
|
|
||||||
for (var j = 0; j < keys.length; j++) {
|
|
||||||
var id = keys[j];
|
|
||||||
var mod = elems.get(id);
|
|
||||||
var allTopics = designer.getModel().getTopics();
|
|
||||||
var currentTopic = allTopics.filter(function(node) {
|
|
||||||
return node.getId() == id;
|
|
||||||
})[0];
|
|
||||||
var xStep = (mod.originalPos.x - mod.newPos.x) / step;
|
|
||||||
var yStep = (mod.originalPos.y - mod.newPos.y) / step;
|
|
||||||
var newPos = currentTopic.getPosition().clone();
|
|
||||||
newPos.x += xStep;
|
|
||||||
newPos.y += yStep;
|
|
||||||
currentTopic.setPosition(newPos, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$clear(_moveEffect);
|
|
||||||
var keys = elems.keys();
|
|
||||||
for (var j = 0; j < keys.length; j++) {
|
|
||||||
var id = keys[j];
|
|
||||||
var mod = elems.get(id);
|
|
||||||
var allTopics = designer.getModel().getTopics();
|
|
||||||
var currentTopic = allTopics.filter(function(node) {
|
|
||||||
return node.getId() == id;
|
|
||||||
})[0];
|
|
||||||
currentTopic.setPosition(mod.originalPos, false);
|
|
||||||
}
|
|
||||||
if ($defined(doneFn))
|
|
||||||
doneFn.attempt();
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
};
|
|
||||||
_moveEffect = moveEffect.periodical(10);
|
|
||||||
};
|
|
||||||
|
@ -447,7 +447,7 @@ mindplot.Designer = new Class({
|
|||||||
$assert(mindmapModel, "mindmapModel can not be null");
|
$assert(mindmapModel, "mindmapModel can not be null");
|
||||||
this._mindmap = mindmapModel;
|
this._mindmap = mindmapModel;
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// Init layout manager ...
|
// Init layout manager ...
|
||||||
var size = {width:25,height:25};
|
var size = {width:25,height:25};
|
||||||
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
||||||
@ -484,9 +484,9 @@ mindplot.Designer = new Class({
|
|||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
||||||
|
|
||||||
this.fireEvent('loadSuccess');
|
this.fireEvent('loadSuccess');
|
||||||
// } catch(e) {
|
} catch(e) {
|
||||||
// this.fireEvent('loadError', e);
|
this.fireEvent('loadError', e);
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getMindmap : function() {
|
getMindmap : function() {
|
||||||
|
@ -29,13 +29,7 @@
|
|||||||
|
|
||||||
// Load map from XML file persisted on disk...
|
// Load map from XML file persisted on disk...
|
||||||
var persistence = mindplot.PersistenceManager.getInstance();
|
var persistence = mindplot.PersistenceManager.getInstance();
|
||||||
var mindmap;
|
var mindmap = mindmap = persistence.load(mapId);
|
||||||
// try {
|
|
||||||
mindmap = persistence.load(mapId);
|
|
||||||
// } catch(e) {
|
|
||||||
// If the map could not be loaded, create a new empty map...
|
|
||||||
// mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
|
|
||||||
// }
|
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -135,22 +129,22 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div style="position: absolute;align:left;background: gray;width: 100px;height: 300px;z-index: 100" id="dragPanel">-->
|
<!--<div style="position: absolute;align:left;background: gray;width: 100px;height: 300px;z-index: 100" id="dragPanel">-->
|
||||||
<!--<div id="dragIcon" style="">-->
|
<!--<div id="dragIcon" style="">-->
|
||||||
<!--<img src="images/logo-small.png"/>-->
|
<!--<img src="images/logo-small.png"/>-->
|
||||||
<!--</div>-->
|
<!--</div>-->
|
||||||
<!--</div>-->
|
<!--</div>-->
|
||||||
|
|
||||||
<!--<script type="text/javascript">-->
|
<!--<script type="text/javascript">-->
|
||||||
<!--$("dragIcon").addEvent('mousedown', function(event) {-->
|
<!--$("dragIcon").addEvent('mousedown', function(event) {-->
|
||||||
<!--event.preventDefault();-->
|
<!--event.preventDefault();-->
|
||||||
|
|
||||||
<!--var options = {imageUrl:"images/logo-small.png",-->
|
<!--var options = {imageUrl:"images/logo-small.png",-->
|
||||||
<!--imageWidth:80,-->
|
<!--imageWidth:80,-->
|
||||||
<!--imageHeight:43,-->
|
<!--imageHeight:43,-->
|
||||||
<!--metadata: "{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}"-->
|
<!--metadata: "{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}"-->
|
||||||
<!--};-->
|
<!--};-->
|
||||||
<!--designer.addDraggedNode(event, options);-->
|
<!--designer.addDraggedNode(event, options);-->
|
||||||
<!--});-->
|
<!--});-->
|
||||||
<!--</script>-->
|
<!--</script>-->
|
||||||
|
|
||||||
<div id="mindplot"></div>
|
<div id="mindplot"></div>
|
||||||
|
BIN
wise-editor/src/main/webapp/images/alert-sign.png
Normal file
BIN
wise-editor/src/main/webapp/images/alert-sign.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
@ -33,6 +33,7 @@ function buildDesigner(options) {
|
|||||||
designer.addEvent('loadError', function(e) {
|
designer.addEvent('loadError', function(e) {
|
||||||
window.waitDialog.close();
|
window.waitDialog.close();
|
||||||
window.waitDialog.destroy();
|
window.waitDialog.destroy();
|
||||||
|
errorDialog.show();
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ function buildDesigner(options) {
|
|||||||
// Configure default persistence manager ...
|
// Configure default persistence manager ...
|
||||||
var persistence;
|
var persistence;
|
||||||
if (options.persistenceManager) {
|
if (options.persistenceManager) {
|
||||||
if(options.persistenceManager instanceof String) {
|
if (options.persistenceManager instanceof String) {
|
||||||
persistence = eval("new " + options.persistenceManager + "()");
|
persistence = eval("new " + options.persistenceManager + "()");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -54,7 +55,7 @@ function buildDesigner(options) {
|
|||||||
|
|
||||||
// Register toolbar event ...
|
// Register toolbar event ...
|
||||||
if ($('toolbar')) {
|
if ($('toolbar')) {
|
||||||
var menu = new mindplot.widget.Menu(designer, 'toolbar',"");
|
var menu = new mindplot.widget.Menu(designer, 'toolbar', "");
|
||||||
|
|
||||||
// If a node has focus, focus can be move to another node using the keys.
|
// If a node has focus, focus can be move to another node using the keys.
|
||||||
designer._cleanScreen = function() {
|
designer._cleanScreen = function() {
|
||||||
@ -110,6 +111,70 @@ editor.WaitDialog = new Class({
|
|||||||
autoOpen:true,
|
autoOpen:true,
|
||||||
useEscKey:false,
|
useEscKey:false,
|
||||||
title:'Loading ...',
|
title:'Loading ...',
|
||||||
|
onInitialize: function(wrapper) {
|
||||||
|
wrapper.setStyle('opacity', 0);
|
||||||
|
this.fx = new Fx.Morph(wrapper, {
|
||||||
|
duration: 100,
|
||||||
|
transition: Fx.Transitions.Bounce.easeOut
|
||||||
|
});
|
||||||
|
this.overlay = new Overlay(this.options.inject, {
|
||||||
|
duration: this.options.duration
|
||||||
|
});
|
||||||
|
if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeOpen: function() {
|
||||||
|
this.overlay.open();
|
||||||
|
this.fx.start({
|
||||||
|
'margin-top': [-200, -100],
|
||||||
|
opacity: [0, 1]
|
||||||
|
}).chain(function() {
|
||||||
|
this.fireEvent('show');
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeClose: function() {
|
||||||
|
this.fx.start({
|
||||||
|
'margin-top': [-100, 0],
|
||||||
|
opacity: 0,
|
||||||
|
duration: 200
|
||||||
|
}).chain(function() {
|
||||||
|
this.fireEvent('hide');
|
||||||
|
}.bind(this));
|
||||||
|
this.overlay.close();
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
this.setContent(panel);
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildPanel : function () {
|
||||||
|
var result = new Element('div');
|
||||||
|
result.setStyles({
|
||||||
|
'text-align':'center',
|
||||||
|
width: '400px'
|
||||||
|
});
|
||||||
|
var img = new Element('img', {'src': 'images/ajax-loader.gif'});
|
||||||
|
img.inject(result);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
show : function() {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
editor.FatalErrorDialog = new Class({
|
||||||
|
Extends:MooDialog,
|
||||||
|
initialize : function() {
|
||||||
|
var panel = this._buildPanel();
|
||||||
|
this.parent({
|
||||||
|
closeButton:false,
|
||||||
|
destroyOnClose:true,
|
||||||
|
autoOpen:true,
|
||||||
|
useEscKey:false,
|
||||||
|
title:'Outch!!. An unexpected error has occurred',
|
||||||
onInitialize: function(wrapper) {
|
onInitialize: function(wrapper) {
|
||||||
wrapper.setStyle('opacity', 0);
|
wrapper.setStyle('opacity', 0);
|
||||||
this.fx = new Fx.Morph(wrapper, {
|
this.fx = new Fx.Morph(wrapper, {
|
||||||
@ -155,8 +220,12 @@ editor.WaitDialog = new Class({
|
|||||||
'text-align':'center',
|
'text-align':'center',
|
||||||
width: '400px'
|
width: '400px'
|
||||||
});
|
});
|
||||||
var img = new Element('img', {'src': 'images/ajax-loader.gif'});
|
var p = new Element('p', {'text': 'We\'re sorry, an error has occurred and we can not process your request. Please try again, or go to the home page.'});
|
||||||
|
p.inject(result);
|
||||||
|
|
||||||
|
var img = new Element('img', {'src': 'images/alert-sign.png'});
|
||||||
img.inject(result);
|
img.inject(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -166,6 +235,7 @@ editor.WaitDialog = new Class({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
editor.Help = {
|
editor.Help = {
|
||||||
buildHelp:function(panel) {
|
buildHelp:function(panel) {
|
||||||
var container = new Element('div');
|
var container = new Element('div');
|
||||||
@ -236,6 +306,7 @@ editor.Help = {
|
|||||||
// Show loading dialog ...
|
// Show loading dialog ...
|
||||||
waitDialog = new editor.WaitDialog();
|
waitDialog = new editor.WaitDialog();
|
||||||
waitDialog.show();
|
waitDialog.show();
|
||||||
|
errorDialog = new editor.FatalErrorDialog();
|
||||||
|
|
||||||
// Loading libraries ...
|
// Loading libraries ...
|
||||||
Asset.javascript("js/mindplot-min.js");
|
Asset.javascript("js/mindplot-min.js");
|
||||||
|
Loading…
Reference in New Issue
Block a user