From 6f7567abea4701ab35f5832d6a63de2532e4322d Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sat, 4 Feb 2012 12:51:50 -0300 Subject: [PATCH] More refactors. --- core-js/pom.xml | 18 +- core-js/src/main/javascript/LoadingDialog.js | 56 ----- core-js/src/main/javascript/WaitDialog.js | 135 ------------ mindplot/pom.xml | 9 - mindplot/src/main/javascript/Designer.js | 68 +++--- wise-editor/src/main/webapp/css/editor.less | 1 - .../src/main/webapp/css/widget/lightbox.css | 1 - .../src/main/webapp/html/container.html | 4 +- .../src/main/webapp/html/container.json | 3 +- wise-editor/src/main/webapp/html/editor.html | 43 +--- .../src/main/webapp/html/embedded.html | 49 +---- .../src/main/webapp/html/fulleditor.html | 199 ------------------ .../src/main/webapp/html/viewmode.html | 123 ++++++++--- .../src/main/webapp/images/ajax-loader.gif | Bin 673 -> 6820 bytes wise-editor/src/main/webapp/images/rebota.gif | Bin 218360 -> 0 bytes wise-editor/src/main/webapp/js/editor.js | 175 +++++++++++++-- wise-webapp/src/main/webapp/js/editor.js | 60 ------ .../src/main/webapp/jsp/mindmapEditor.jsp | 96 +++------ wise-webapp/src/main/webapp/jsp/toolbar.jsf | 2 +- 19 files changed, 348 insertions(+), 694 deletions(-) delete mode 100644 core-js/src/main/javascript/LoadingDialog.js delete mode 100644 core-js/src/main/javascript/WaitDialog.js delete mode 120000 wise-editor/src/main/webapp/css/widget/lightbox.css delete mode 100644 wise-editor/src/main/webapp/html/fulleditor.html delete mode 100644 wise-editor/src/main/webapp/images/rebota.gif delete mode 100644 wise-webapp/src/main/webapp/js/editor.js diff --git a/core-js/pom.xml b/core-js/pom.xml index 3fd9b14c..0d636336 100644 --- a/core-js/pom.xml +++ b/core-js/pom.xml @@ -25,7 +25,7 @@ - + @@ -54,9 +54,21 @@ ${basedir}/target/tmp/Monitor-min.js ${basedir}/target/tmp/Point-min.js ${basedir}/target/tmp/Utils-min.js - ${basedir}/target/tmp/WaitDialog-min.js - + + + ${basedir}/../mindplot/src/main/javascript/libraries/moodialog/Overlay.js + + + ${basedir}/../mindplot/src/main/javascript/libraries/moodialog/MooDialog.js + + + ${basedir}/../mindplot/src/main/javascript/libraries/moodialog/MooDialog.Request.js + + + ${basedir}/../mindplot/src/main/javascript/libraries/moodialog/MooDialog.Fx.js + ${basedir}/target/tmp/footer-min.js + diff --git a/core-js/src/main/javascript/LoadingDialog.js b/core-js/src/main/javascript/LoadingDialog.js deleted file mode 100644 index 87197090..00000000 --- a/core-js/src/main/javascript/LoadingDialog.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright [2011] [wisemapping] - * - * Licensed under WiseMapping Public License, Version 1.0 (the "License"). - * It is basically the Apache License, Version 2.0 (the "License") plus the - * "powered by wisemapping" text requirement on every single page; - * you may not use this file except in compliance with the License. - * You may obtain a copy of the license at - * - * http://www.wisemapping.org/license - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -core.LoadingDiaglog = new Class({ - Extends:MooDialog, - initialize : function() { - this.parent({ - closeButton:false, - useEscKey:false - }); - var panel = this._buildPanel(); - this.setContent(panel); - }, - - _buildPanel : function () { - - var result = new Element('div'); - var content = new Element('p', {text:"sample"}); - - - result.addEvent('keydown', function(event) { - event.stopPropagation(); - }); - -// waitDialog.activate(true, $("waitDialog")); -// $(window).addEvent("error", function(event) { -// -// // Show error dialog ... -// waitDialog.changeContent($("errorDialog"), false); -// return false; -// }); - - content.inject(result); - return result; - }, - - show : function() { - this.open(); - } - -}); diff --git a/core-js/src/main/javascript/WaitDialog.js b/core-js/src/main/javascript/WaitDialog.js deleted file mode 100644 index b1e9c356..00000000 --- a/core-js/src/main/javascript/WaitDialog.js +++ /dev/null @@ -1,135 +0,0 @@ -/* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. - */ - -/* - Created By: Chris Campbell - Website: http://particletree.com - Date: 2/1/2006 - - Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ - /*-----------------------------------------------------------------------------------------------*/ - - -core.WaitDialog = new Class({ - - - yPos : 0, - xPos : 0, - - initialize: function() { - }, - // Turn everything on - mainly the IE fixes - activate: function(changeCursor, dialogContent) - { - - this.content = dialogContent; - - this._initLightboxMarkup(); - - this.displayLightbox("block"); - - // Change to loading cursor. - if (changeCursor) - { - window.document.body.style.cursor = "wait"; - } - }, - changeContent: function(dialogContent, changeCursor) - { - this.content = dialogContent; - if (!$('lbContent')) - { - // Dialog is not activated. Nothing to do ... - window.document.body.style.cursor = "pointer"; - return; - } - - this.processInfo(); - - // Change to loading cursor. - if (changeCursor) - { - window.document.body.style.cursor = "wait"; - }else - { - window.document.body.style.cursor = "auto"; - } - }, - displayLightbox: function(display) { - if (display != 'none') - this.processInfo(); - $('overlay-lightbox').style.display = display; - $('lightbox').style.display = display; - - }, - - // Display dialog content ... - processInfo: function() { - if ($('lbContent')) - $('lbContent').dispose(); - - var lbContentElement = new Element('div').setProperty('id', 'lbContent'); - lbContentElement.innerHTML = this.content.innerHTML; - - lbContentElement.inject($('lbLoadMessage'),'before'); - $('lightbox').className = "done"; - }, - - // Search through new links within the lightbox, and attach click event - actions: function() { - lbActions = document.getElementsByClassName('lbAction'); - - for (i = 0; i < lbActions.length; i++) { - $(lbActions[i]).addEvent('click', function() { - this[lbActions[i].rel].pass(this) - }.bind(this)); - lbActions[i].onclick = function() { - return false; - }; - } - - }, - - // Example of creating your own functionality once lightbox is initiated - deactivate: function(time) { - - if ($('lbContent')) - $('lbContent').dispose(); - - this.displayLightbox("none"); - - window.document.body.style.cursor = "default"; - } - , _initLightboxMarkup:function() - { - // Add overlay element inside body ... - var bodyElem = document.getElementsByTagName('body')[0]; - var overlayElem = new Element('div').setProperty('id', 'overlay-lightbox'); - overlayElem.inject(bodyElem); - - // Add lightbox element inside body ... - var lightboxElem = new Element('div').setProperty('id', 'lightbox'); - lightboxElem.addClass('loading'); - - var lbLoadMessageElem = new Element('div').setProperty('id', 'lbLoadMessage'); - lbLoadMessageElem.inject(lightboxElem); - - lightboxElem.inject(bodyElem); - - } -}); \ No newline at end of file diff --git a/mindplot/pom.xml b/mindplot/pom.xml index f2ad4f8a..97985918 100644 --- a/mindplot/pom.xml +++ b/mindplot/pom.xml @@ -52,15 +52,6 @@ - - - - - diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index 844d80a4..f528d2fe 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -422,41 +422,47 @@ mindplot.Designer = new Class({ $assert(mindmapModel, "mindmapModel can not be null"); this._mindmap = mindmapModel; - // Init layout manager ... - var size = {width:25,height:25}; - var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size); - layoutManager.addEvent('change', function(event) { - var id = event.getId(); - var topic = this.getModel().findTopicById(id); - topic.setPosition(event.getPosition()); - topic.setOrder(event.getOrder()); - }.bind(this)); - this._eventBussDispatcher.setLayoutManager(layoutManager); + try { + // Init layout manager ... + var size = {width:25,height:25}; + var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size); + layoutManager.addEvent('change', function(event) { + var id = event.getId(); + var topic = this.getModel().findTopicById(id); + topic.setPosition(event.getPosition()); + topic.setOrder(event.getOrder()); + }.bind(this)); + this._eventBussDispatcher.setLayoutManager(layoutManager); - // Building node graph ... - var branches = mindmapModel.getBranches(); - for (var i = 0; i < branches.length; i++) { - // NodeModel -> NodeGraph ... - var nodeModel = branches[i]; - var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false); + // Building node graph ... + var branches = mindmapModel.getBranches(); + for (var i = 0; i < branches.length; i++) { + // NodeModel -> NodeGraph ... + var nodeModel = branches[i]; + var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false); - // Update shrink render state... - nodeGraph.setBranchVisibility(true); + // Update shrink render state... + nodeGraph.setBranchVisibility(true); + } + + + var relationships = mindmapModel.getRelationships(); + for (var j = 0; j < relationships.length; j++) { + this._relationshipModelToRelationship(relationships[j]); + } + + // Place the focus on the Central Topic + var centralTopic = this.getModel().getCentralTopic(); + this.goToNode(centralTopic); + + // Finally, sort the map ... + mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); + + this.fireEvent('loadSuccess'); + } catch(e) { + this.fireEvent('loadError',e); } - - - var relationships = mindmapModel.getRelationships(); - for (var j = 0; j < relationships.length; j++) { - this._relationshipModelToRelationship(relationships[j]); - } - - // Place the focus on the Central Topic - var centralTopic = this.getModel().getCentralTopic(); - this.goToNode(centralTopic); - - // Finally, sort the map ... - mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); }, getMindmap : function() { diff --git a/wise-editor/src/main/webapp/css/editor.less b/wise-editor/src/main/webapp/css/editor.less index 8539f04c..17ce1982 100644 --- a/wise-editor/src/main/webapp/css/editor.less +++ b/wise-editor/src/main/webapp/css/editor.less @@ -1,5 +1,4 @@ @import "compatibility.less"; -@import "../css/widget/lightbox.css"; @import "../css/libraries/moodialog/css/MooDialog.css"; diff --git a/wise-editor/src/main/webapp/css/widget/lightbox.css b/wise-editor/src/main/webapp/css/widget/lightbox.css deleted file mode 120000 index 68bcf494..00000000 --- a/wise-editor/src/main/webapp/css/widget/lightbox.css +++ /dev/null @@ -1 +0,0 @@ -../../../../../../mindplot/src/main/javascript/widget/lightbox.css \ No newline at end of file diff --git a/wise-editor/src/main/webapp/html/container.html b/wise-editor/src/main/webapp/html/container.html index 6a967d5a..b18f1fef 100644 --- a/wise-editor/src/main/webapp/html/container.html +++ b/wise-editor/src/main/webapp/html/container.html @@ -50,7 +50,9 @@
  • zoom: Scale to be applied to the map
  • readOnly: If the map could be modified.
  • persistenceManager: Persistence managers to be used. By default, local browser storage is used.
  • -
  • mapId: UUID of the map to be loaded..
  • +
  • mapId: UUID of the map to be loaded.
  • +
  • container: div element where the mindmap will be embedded..
  • +

    It's important to point out that embedded.html is a static html page that it's mean to be a template page diff --git a/wise-editor/src/main/webapp/html/container.json b/wise-editor/src/main/webapp/html/container.json index 5a9d4b05..950d6485 100644 --- a/wise-editor/src/main/webapp/html/container.json +++ b/wise-editor/src/main/webapp/html/container.json @@ -11,5 +11,6 @@ "height":400 }, "persistenceManager": "mindplot.LocalStorageManager", - "mapId": "welcome" + "mapId": "welcome", + "container":"mindplot" } \ No newline at end of file diff --git a/wise-editor/src/main/webapp/html/editor.html b/wise-editor/src/main/webapp/html/editor.html index 8d06c462..84c6289b 100644 --- a/wise-editor/src/main/webapp/html/editor.html +++ b/wise-editor/src/main/webapp/html/editor.html @@ -24,9 +24,6 @@ var options = loadDesignerOptions(); var designer = buildDesigner(options); - // Configure default persistence manager ... - mindplot.PersistenceManager.init(new mindplot.LocalStorageManager()); - // Load map from XML ... var persistence = mindplot.PersistenceManager.getInstance(); var mindmap; @@ -37,11 +34,6 @@ mindmap = mindplot.model.Mindmap.buildEmpty(mapId); } designer.loadMap(mindmap); - - // If not problem has arisen, close the dialog ... - if (!window.hasUnexpectedErrors) { - waitDialog.deactivate(); - } }); @@ -49,37 +41,6 @@ -

    - - - - - -