Fix error on brix framework loading ...
parent
6468f6f0bc
commit
dbed45c802
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.MindmapDesigner = new Class({
|
mindplot.MindmapDesigner = new Class({
|
||||||
|
Extends: Events,
|
||||||
initialize: function(profile, divElement) {
|
initialize: function(profile, divElement) {
|
||||||
$assert(profile, "profile must be defined");
|
$assert(profile, "profile must be defined");
|
||||||
$assert(profile.zoom, "zoom 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.BrixActionDispatcher(commandContext);
|
||||||
// this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext);
|
// this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext);
|
||||||
this._actionDispatcher.addEvent("modelUpdate", function(event) {
|
this._actionDispatcher.addEvent("modelUpdate", function(event) {
|
||||||
this._fireEvent("modelUpdate", event);
|
this.fireEvent("modelUpdate", event);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
mindplot.ActionDispatcher.setInstance(this._actionDispatcher);
|
mindplot.ActionDispatcher.setInstance(this._actionDispatcher);
|
||||||
this._model = new mindplot.DesignerModel(profile);
|
this._model = new mindplot.DesignerModel(profile);
|
||||||
|
|
||||||
|
@ -44,9 +46,6 @@ mindplot.MindmapDesigner = new Class({
|
||||||
if (!profile.readOnly) {
|
if (!profile.readOnly) {
|
||||||
this._registerEvents();
|
this._registerEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._events = {};
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_registerEvents : function() {
|
_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) {
|
setViewPort : function(size) {
|
||||||
this._workspace.setViewPort(size);
|
this._workspace.setViewPort(size);
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
|
@ -388,7 +376,7 @@ mindplot.MindmapDesigner = new Class({
|
||||||
|
|
||||||
var properties = {zoom:this.getModel().getZoom(), layoutManager:this._layoutManager.getClassName()};
|
var properties = {zoom:this.getModel().getZoom(), layoutManager:this._layoutManager.getClassName()};
|
||||||
persistantManager.save(mindmap, properties, onSavedHandler, saveHistory);
|
persistantManager.save(mindmap, properties, onSavedHandler, saveHistory);
|
||||||
this._fireEvent("save", {type:saveHistory});
|
this.fireEvent("save", {type:saveHistory});
|
||||||
|
|
||||||
// Refresh undo state...
|
// Refresh undo state...
|
||||||
this._actionRunner.markAsChangeBase();
|
this._actionRunner.markAsChangeBase();
|
||||||
|
@ -401,8 +389,6 @@ mindplot.MindmapDesigner = new Class({
|
||||||
// Place the focus on the Central Topic
|
// Place the focus on the Central Topic
|
||||||
var centralTopic = this.getModel().getCentralTopic();
|
var centralTopic = this.getModel().getCentralTopic();
|
||||||
this.goToNode.attempt(centralTopic, this);
|
this.goToNode.attempt(centralTopic, this);
|
||||||
|
|
||||||
this._fireEvent("loadsuccess");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loadFromXML : function(mapId, xmlContent) {
|
loadFromXML : function(mapId, xmlContent) {
|
||||||
|
@ -421,8 +407,6 @@ mindplot.MindmapDesigner = new Class({
|
||||||
var centralTopic = this.getModel().getCentralTopic();
|
var centralTopic = this.getModel().getCentralTopic();
|
||||||
this.goToNode(centralTopic);
|
this.goToNode(centralTopic);
|
||||||
|
|
||||||
this._fireEvent("loadsuccess");
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
load : function(mapId) {
|
load : function(mapId) {
|
||||||
|
@ -440,10 +424,7 @@ mindplot.MindmapDesigner = new Class({
|
||||||
// Place the focus on the Central Topic
|
// Place the focus on the Central Topic
|
||||||
var centralTopic = this.getModel().getCentralTopic();
|
var centralTopic = this.getModel().getCentralTopic();
|
||||||
this.goToNode.attempt(centralTopic, this);
|
this.goToNode.attempt(centralTopic, this);
|
||||||
|
},
|
||||||
this._fireEvent("loadsuccess");
|
|
||||||
}
|
|
||||||
,
|
|
||||||
|
|
||||||
_loadMap : function(mapId, mindmapModel) {
|
_loadMap : function(mapId, mindmapModel) {
|
||||||
var designer = this;
|
var designer = this;
|
||||||
|
@ -471,8 +452,6 @@ mindplot.MindmapDesigner = new Class({
|
||||||
delete topic.getModel()._finalPosition;
|
delete topic.getModel()._finalPosition;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._fireEvent("loadsuccess");
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getMindmap : function() {
|
getMindmap : function() {
|
||||||
|
|
|
@ -20,7 +20,6 @@ mindplot.collaboration.CollaborationManager = new Class({
|
||||||
initialize:function() {
|
initialize:function() {
|
||||||
this.collaborativeModelReady = false;
|
this.collaborativeModelReady = false;
|
||||||
this.collaborativeModelReady = null;
|
this.collaborativeModelReady = null;
|
||||||
this.wiseReady = false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isCollaborationFrameworkAvailable : function() {
|
isCollaborationFrameworkAvailable : function() {
|
||||||
|
@ -30,13 +29,6 @@ mindplot.collaboration.CollaborationManager = new Class({
|
||||||
setCollaborativeFramework : function(framework) {
|
setCollaborativeFramework : function(framework) {
|
||||||
this._collaborativeFramework = framework;
|
this._collaborativeFramework = framework;
|
||||||
this.collaborativeModelReady = true;
|
this.collaborativeModelReady = true;
|
||||||
if (this.wiseReady) {
|
|
||||||
buildCollaborativeMindmapDesigner();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
setWiseReady:function(ready) {
|
|
||||||
this.wiseReady = ready;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isCollaborativeFrameworkReady:function() {
|
isCollaborativeFrameworkReady:function() {
|
||||||
|
@ -58,5 +50,5 @@ mindplot.collaboration.CollaborationManager.getInstance = function() {
|
||||||
mindplot.collaboration.CollaborationManager.__collaborationManager = new mindplot.collaboration.CollaborationManager();
|
mindplot.collaboration.CollaborationManager.__collaborationManager = new mindplot.collaboration.CollaborationManager();
|
||||||
}
|
}
|
||||||
return mindplot.collaboration.CollaborationManager.__collaborationManager;
|
return mindplot.collaboration.CollaborationManager.__collaborationManager;
|
||||||
}
|
};
|
||||||
mindplot.collaboration.CollaborationManager.getInstance();
|
mindplot.collaboration.CollaborationManager.getInstance();
|
||||||
|
|
|
@ -41,7 +41,8 @@ mindplot.collaboration.framework.brix.BrixFramework = new Class({
|
||||||
});
|
});
|
||||||
|
|
||||||
instanciated = false;
|
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) {
|
if ((typeof isGoogleBrix != "undefined") && !instanciated) {
|
||||||
instanciated = true;
|
instanciated = true;
|
||||||
var app = new goog.collab.CollaborativeApp();
|
var app = new goog.collab.CollaborativeApp();
|
||||||
|
@ -50,6 +51,7 @@ mindplot.collaboration.framework.brix.BrixFramework.instanciate = function() {
|
||||||
app.addListener('modelLoad', function(model) {
|
app.addListener('modelLoad', function(model) {
|
||||||
var framework = new mindplot.collaboration.framework.brix.BrixFramework(model, app);
|
var framework = new mindplot.collaboration.framework.brix.BrixFramework(model, app);
|
||||||
mindplot.collaboration.CollaborationManager.getInstance().setCollaborativeFramework(framework);
|
mindplot.collaboration.CollaborationManager.getInstance().setCollaborativeFramework(framework);
|
||||||
|
onload();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -80,6 +82,5 @@ mindplot.collaboration.framework.brix.BrixFramework.buildMenu = function(app) {
|
||||||
|
|
||||||
app.setMenuBar(menuBar);
|
app.setMenuBar(menuBar);
|
||||||
};
|
};
|
||||||
mindplot.collaboration.framework.brix.BrixFramework.instanciate();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,48 @@
|
||||||
<script type='text/javascript' src='/core-js/target/classes/core.js'></script>
|
<script type='text/javascript' src='/core-js/target/classes/core.js'></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
//Google-Brix framework load callback function
|
//Google-Brix framework load callback function
|
||||||
collabOnLoad = function() {
|
collabOnLoad = function() {
|
||||||
isGoogleBrix = true;
|
isGoogleBrix = true;
|
||||||
if ($defined(mindplot) && $defined(mindplot.collaboration) && $defined(mindplot.collaboration.framework)) {
|
$(document).fireEvent('loadcomplete', 'brix');
|
||||||
mindplot.collaboration.framework.brix.BrixFramework.instanciate();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var brixReady = false;
|
||||||
|
var mindReady = false;
|
||||||
|
var local = false;
|
||||||
|
$(document).addEvent('loadcomplete', function(resource) {
|
||||||
|
brixReady = resource == 'brix' ? true : brixReady;
|
||||||
|
mindReady = resource == 'mind' ? true : mindReady;
|
||||||
|
|
||||||
|
// If both resources has been loaded, start loading the framework...
|
||||||
|
if (brixReady && mindReady) {
|
||||||
|
var designer = buildDesigner();
|
||||||
|
mindplot.collaboration.framework.brix.BrixFramework.init(function() {
|
||||||
|
var collaborationManager = mindplot.collaboration.CollaborationManager.getInstance();
|
||||||
|
if (collaborationManager.isCollaborativeFrameworkReady()) {
|
||||||
|
designer.loadFromCollaborativeModel(collaborationManager);
|
||||||
|
|
||||||
|
}
|
||||||
|
// If not problem has arisen, close the dialog ...
|
||||||
|
if (!window.hasUnexpectedErrors) {
|
||||||
|
waitDialog.deactivate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (local) {
|
||||||
|
// Only for debug and local development...
|
||||||
|
var desig = buildDesigner();
|
||||||
|
|
||||||
|
var mapId = '1';
|
||||||
|
var mapXml = '<map name="38298" version="pela"><topic central="true" text="test\nThis is working ?" id="1"/></map>';
|
||||||
|
desig.loadFromXML(mapId, mapXml);
|
||||||
|
|
||||||
|
if (!window.hasUnexpectedErrors) {
|
||||||
|
waitDialog.deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
||||||
|
@ -78,13 +113,6 @@
|
||||||
waitDialog.changeContent($("errorDialog"), false);
|
waitDialog.changeContent($("errorDialog"), false);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// @Todo: This must be persited in the map properties ...
|
|
||||||
var mapId = '1';
|
|
||||||
var mapXml = '<map name="38298" version="pela"><topic central="true" text="test\nThis is working ?" id="1"/></map>';
|
|
||||||
var editorProperties = {zoom:0.85,saveOnLoad:true};
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="colorPalette">
|
<div id="colorPalette">
|
||||||
|
|
|
@ -150,29 +150,23 @@ Tabs.Init();
|
||||||
// Hide the content while waiting for the onload event to trigger.
|
// Hide the content while waiting for the onload event to trigger.
|
||||||
var contentId = window.location.hash || "#Introduction";
|
var contentId = window.location.hash || "#Introduction";
|
||||||
|
|
||||||
function afterMindpotLibraryLoading() {
|
function buildDesigner() {
|
||||||
buildMindmapDesigner();
|
|
||||||
|
|
||||||
if ($('helpButton') != null) {
|
var container = $('mindplot');
|
||||||
var helpPanel = new Panel({panelButton:$('helpButton'), backgroundColor:'black'});
|
container.setStyles({
|
||||||
helpPanel.setContent(Help.buildHelp(helpPanel));
|
height: parseInt(screen.height),
|
||||||
}
|
width: parseInt(screen.width)
|
||||||
|
});
|
||||||
|
|
||||||
if ($('helpButtonFirstSteps') != null) {
|
var editorProperties = {zoom:0.85,saveOnLoad:true};
|
||||||
var firstStepsPanel = $('helpButtonFirstSteps')
|
designer = new mindplot.MindmapDesigner(editorProperties, container);
|
||||||
firstStepsPanel.addEvent('click', function(event) {
|
designer.setViewPort({
|
||||||
var firstStepWindow = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
|
height: parseInt(window.innerHeight - 112), // Footer and Header
|
||||||
firstStepWindow.focus();
|
width: parseInt(window.innerWidth)
|
||||||
firstStepWindow.moveTo(0, 0);
|
});
|
||||||
firstStepWindow.resizeTo(screen.availWidth, screen.availHeight);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($('helpButtonKeyboard') != null) {
|
if (!mindplot.collaboration.CollaborationManager.getInstance().isCollaborationFrameworkAvailable()) {
|
||||||
var keyboardPanel = $('helpButtonKeyboard')
|
loadSingleModel(designer);
|
||||||
keyboardPanel.addEvent('click', function(event) {
|
|
||||||
MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var menu = new mindplot.widget.Menu(designer, 'toolbar');
|
var menu = new mindplot.widget.Menu(designer, 'toolbar');
|
||||||
|
@ -182,50 +176,7 @@ function afterMindpotLibraryLoading() {
|
||||||
menu.clear()
|
menu.clear()
|
||||||
};
|
};
|
||||||
|
|
||||||
// If not problem has arisen, close the dialog ...
|
return designer;
|
||||||
(function() {
|
|
||||||
if (!window.hasUnexpectedErrors) {
|
|
||||||
waitDialog.deactivate();
|
|
||||||
}
|
|
||||||
}).delay(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildMindmapDesigner() {
|
|
||||||
// Initialize message logger ...
|
|
||||||
// var monitor = new core.Monitor($('msgLoggerContainer'), $('msgLogger'));
|
|
||||||
// core.Monitor.setInstance(monitor);
|
|
||||||
|
|
||||||
var container = $('mindplot');
|
|
||||||
|
|
||||||
container.setStyles({
|
|
||||||
height: parseInt(screen.height),
|
|
||||||
width: parseInt(screen.width)
|
|
||||||
});
|
|
||||||
|
|
||||||
designer = new mindplot.MindmapDesigner(editorProperties, container);
|
|
||||||
designer.setViewPort({
|
|
||||||
height: parseInt(window.innerHeight-112), // Footer and Header
|
|
||||||
width: parseInt(window.innerWidth)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mindplot.collaboration.CollaborationManager.getInstance().isCollaborationFrameworkAvailable()) {
|
|
||||||
buildCollaborativeMindmapDesigner();
|
|
||||||
} else {
|
|
||||||
buildStandaloneMindmapDesigner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildStandaloneMindmapDesigner() {
|
|
||||||
designer.loadFromXML(mapId, mapXml);
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildCollaborativeMindmapDesigner() {
|
|
||||||
var collaborationManager = mindplot.collaboration.CollaborationManager.getInstance();
|
|
||||||
if (collaborationManager.isCollaborativeFrameworkReady()) {
|
|
||||||
designer.loadFromCollaborativeModel(collaborationManager);
|
|
||||||
} else {
|
|
||||||
collaborationManager.setWiseReady(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//######################### Libraries Loading ##################################
|
//######################### Libraries Loading ##################################
|
||||||
|
@ -262,7 +213,6 @@ function JSPomLoader(pomUrl, callback) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
var url = urls.pop();
|
var url = urls.pop();
|
||||||
// console.log("load url:" + url);
|
|
||||||
Asset.javascript(url, {
|
Asset.javascript(url, {
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
jsRecLoad(urls)
|
jsRecLoad(urls)
|
||||||
|
@ -285,13 +235,15 @@ var localEnv = true;
|
||||||
if (localEnv) {
|
if (localEnv) {
|
||||||
Asset.javascript("../../../../../web2d/target/classes/web2d.svg-min.js", {
|
Asset.javascript("../../../../../web2d/target/classes/web2d.svg-min.js", {
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
JSPomLoader('../../../../../mindplot/pom.xml', afterMindpotLibraryLoading)
|
JSPomLoader('../../../../../mindplot/pom.xml', function() {
|
||||||
|
$(document).fireEvent('loadcomplete', 'mind')
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Asset.javascript("../js/mindplot.svg.js", {
|
Asset.javascript("../js/mindplot.svg.js", {
|
||||||
onLoad: function() {
|
onLoad:function() {
|
||||||
afterMindpotLibraryLoading();
|
$(document).fireEvent('loadcomplete', 'mind')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
Reference in New Issue