From 8a4dee47f2dda1cb041d248b6e932d87f36f26ea Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Wed, 7 Mar 2012 21:17:19 -0300 Subject: [PATCH] Add error dialog for map error during loading. --- core-js/src/main/javascript/Utils.js | 43 +--------- mindplot/src/main/javascript/Designer.js | 8 +- wise-editor/src/main/webapp/html/editor.html | 32 +++---- .../src/main/webapp/images/alert-sign.png | Bin 0 -> 5000 bytes wise-editor/src/main/webapp/js/editor.js | 81 ++++++++++++++++-- 5 files changed, 94 insertions(+), 70 deletions(-) create mode 100644 wise-editor/src/main/webapp/images/alert-sign.png diff --git a/core-js/src/main/javascript/Utils.js b/core-js/src/main/javascript/Utils.js index ff870beb..ed986bd0 100644 --- a/core-js/src/main/javascript/Utils.js +++ b/core-js/src/main/javascript/Utils.js @@ -138,45 +138,4 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) { var y2 = m * (x2 - tarPos.x) + tarPos.y; 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); -}; +}; \ No newline at end of file diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index ac5db35a..9f78f3e0 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -447,7 +447,7 @@ mindplot.Designer = new Class({ $assert(mindmapModel, "mindmapModel can not be null"); this._mindmap = mindmapModel; -// try { + try { // Init layout manager ... var size = {width:25,height:25}; 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); this.fireEvent('loadSuccess'); -// } catch(e) { -// this.fireEvent('loadError', e); -// } + } catch(e) { + this.fireEvent('loadError', e); + } }, getMindmap : function() { diff --git a/wise-editor/src/main/webapp/html/editor.html b/wise-editor/src/main/webapp/html/editor.html index 38622a98..491bc7b9 100644 --- a/wise-editor/src/main/webapp/html/editor.html +++ b/wise-editor/src/main/webapp/html/editor.html @@ -29,13 +29,7 @@ // Load map from XML file persisted on disk... var persistence = mindplot.PersistenceManager.getInstance(); - var mindmap; -// 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); -// } + var mindmap = mindmap = persistence.load(mapId); designer.loadMap(mindmap); }); @@ -135,22 +129,22 @@ - - - + + + - - + + - - - - - - - + + + + + + +
diff --git a/wise-editor/src/main/webapp/images/alert-sign.png b/wise-editor/src/main/webapp/images/alert-sign.png new file mode 100644 index 0000000000000000000000000000000000000000..8d3e5df04781628539abc327c1d5ad950782f587 GIT binary patch literal 5000 zcmV;36L;*1P)}o$Y+U8oDKBLwagwS8FBKF=CA-B0dc3Ay8~DGtO!+zuU+N_3voMK)UF;LagN4&*oo$ZEQsJTMRW0J^!T19fSd?( zP30{mK!7L)bs!NK6m?3}u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