diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index ce17e6ba..a8f7e46f 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -17,6 +17,7 @@ */ mindplot.MindmapDesigner = new Class({ + Extends: Events, initialize: function(profile, divElement) { $assert(profile, "profile must be defined"); $assert(profile.zoom, "zoom must be defined"); @@ -27,8 +28,9 @@ mindplot.MindmapDesigner = new Class({ this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext); // this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext); this._actionDispatcher.addEvent("modelUpdate", function(event) { - this._fireEvent("modelUpdate", event); + this.fireEvent("modelUpdate", event); }.bind(this)); + mindplot.ActionDispatcher.setInstance(this._actionDispatcher); this._model = new mindplot.DesignerModel(profile); @@ -44,9 +46,6 @@ mindplot.MindmapDesigner = new Class({ if (!profile.readOnly) { this._registerEvents(); } - - this._events = {}; - }, _registerEvents : function() { @@ -119,17 +118,6 @@ mindplot.MindmapDesigner = new Class({ }, - addEvent : function(eventType, listener) { - this._events[eventType] = listener; - }, - - _fireEvent : function(eventType, event) { - var listener = this._events[eventType]; - if (listener != null) { - listener(event); - } - }, - setViewPort : function(size) { this._workspace.setViewPort(size); var model = this.getModel(); @@ -388,7 +376,7 @@ mindplot.MindmapDesigner = new Class({ var properties = {zoom:this.getModel().getZoom(), layoutManager:this._layoutManager.getClassName()}; persistantManager.save(mindmap, properties, onSavedHandler, saveHistory); - this._fireEvent("save", {type:saveHistory}); + this.fireEvent("save", {type:saveHistory}); // Refresh undo state... this._actionRunner.markAsChangeBase(); @@ -401,8 +389,6 @@ mindplot.MindmapDesigner = new Class({ // Place the focus on the Central Topic var centralTopic = this.getModel().getCentralTopic(); this.goToNode.attempt(centralTopic, this); - - this._fireEvent("loadsuccess"); }, loadFromXML : function(mapId, xmlContent) { @@ -421,8 +407,6 @@ mindplot.MindmapDesigner = new Class({ var centralTopic = this.getModel().getCentralTopic(); this.goToNode(centralTopic); - this._fireEvent("loadsuccess"); - }, load : function(mapId) { @@ -440,10 +424,7 @@ mindplot.MindmapDesigner = new Class({ // Place the focus on the Central Topic var centralTopic = this.getModel().getCentralTopic(); this.goToNode.attempt(centralTopic, this); - - this._fireEvent("loadsuccess"); - } - , + }, _loadMap : function(mapId, mindmapModel) { var designer = this; @@ -471,8 +452,6 @@ mindplot.MindmapDesigner = new Class({ delete topic.getModel()._finalPosition; }); - this._fireEvent("loadsuccess"); - }, getMindmap : function() { diff --git a/mindplot/src/main/javascript/collaboration/CollaborationManager.js b/mindplot/src/main/javascript/collaboration/CollaborationManager.js index d53a4614..4daad420 100644 --- a/mindplot/src/main/javascript/collaboration/CollaborationManager.js +++ b/mindplot/src/main/javascript/collaboration/CollaborationManager.js @@ -20,7 +20,6 @@ mindplot.collaboration.CollaborationManager = new Class({ initialize:function() { this.collaborativeModelReady = false; this.collaborativeModelReady = null; - this.wiseReady = false; }, isCollaborationFrameworkAvailable : function() { @@ -30,13 +29,6 @@ mindplot.collaboration.CollaborationManager = new Class({ setCollaborativeFramework : function(framework) { this._collaborativeFramework = framework; this.collaborativeModelReady = true; - if (this.wiseReady) { - buildCollaborativeMindmapDesigner(); - } - }, - - setWiseReady:function(ready) { - this.wiseReady = ready; }, isCollaborativeFrameworkReady:function() { @@ -58,5 +50,5 @@ mindplot.collaboration.CollaborationManager.getInstance = function() { mindplot.collaboration.CollaborationManager.__collaborationManager = new mindplot.collaboration.CollaborationManager(); } return mindplot.collaboration.CollaborationManager.__collaborationManager; -} +}; mindplot.collaboration.CollaborationManager.getInstance(); diff --git a/mindplot/src/main/javascript/collaboration/framework/brix/BrixFramework.js b/mindplot/src/main/javascript/collaboration/framework/brix/BrixFramework.js index 31d61202..849a411f 100644 --- a/mindplot/src/main/javascript/collaboration/framework/brix/BrixFramework.js +++ b/mindplot/src/main/javascript/collaboration/framework/brix/BrixFramework.js @@ -41,7 +41,8 @@ mindplot.collaboration.framework.brix.BrixFramework = new Class({ }); instanciated = false; -mindplot.collaboration.framework.brix.BrixFramework.instanciate = function() { +mindplot.collaboration.framework.brix.BrixFramework.init = function(onload) { + $assert(onload, "load function can not be null"); if ((typeof isGoogleBrix != "undefined") && !instanciated) { instanciated = true; var app = new goog.collab.CollaborativeApp(); @@ -50,6 +51,7 @@ mindplot.collaboration.framework.brix.BrixFramework.instanciate = function() { app.addListener('modelLoad', function(model) { var framework = new mindplot.collaboration.framework.brix.BrixFramework(model, app); mindplot.collaboration.CollaborationManager.getInstance().setCollaborativeFramework(framework); + onload(); }.bind(this)); } }; @@ -80,6 +82,5 @@ mindplot.collaboration.framework.brix.BrixFramework.buildMenu = function(app) { app.setMenuBar(menuBar); }; -mindplot.collaboration.framework.brix.BrixFramework.instanciate(); diff --git a/wise-doc/src/main/webapp/html/editor.html b/wise-doc/src/main/webapp/html/editor.html index 3d4b5429..8c7b8e0c 100644 --- a/wise-doc/src/main/webapp/html/editor.html +++ b/wise-doc/src/main/webapp/html/editor.html @@ -30,13 +30,48 @@ @@ -78,13 +113,6 @@ waitDialog.changeContent($("errorDialog"), false); return false; }); - - // @Todo: This must be persited in the map properties ... - var mapId = '1'; - var mapXml = ''; - var editorProperties = {zoom:0.85,saveOnLoad:true}; - -