Minor fixes.
This commit is contained in:
@@ -25,15 +25,15 @@ mindplot.BrixActionDispatcher = new Class({
|
||||
},
|
||||
|
||||
changeTextOnTopic : function(topicsIds, text) {
|
||||
var framework=$wise_collaborationManager.getCollaborativeFramework();
|
||||
var framework = mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
||||
if (!(topicsIds instanceof Array)) {
|
||||
topicsIds = [topicsIds];
|
||||
}
|
||||
var topic = framework.getTopic(topicsIds[0]);
|
||||
var callback = function(event, topic){
|
||||
var callback = function(event, topic) {
|
||||
topic.getBrixModel().removeListener("valueChanged", callback);
|
||||
this._actionDispatcher.changeTextOnTopic(topic.getId(),event.getNewValue());
|
||||
}.bindWithEvent(this,topic);
|
||||
this._actionDispatcher.changeTextOnTopic(topic.getId(), event.getNewValue());
|
||||
}.bindWithEvent(this, topic);
|
||||
topic.setText(text, true, callback);
|
||||
}
|
||||
});
|
||||
|
@@ -24,7 +24,9 @@ mindplot.MindmapDesigner = new Class({
|
||||
|
||||
// Dispatcher manager ...
|
||||
var commandContext = new mindplot.CommandContext(this);
|
||||
this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext);
|
||||
// this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext);
|
||||
this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext);
|
||||
|
||||
this._actionDispatcher.addEvent("modelUpdate", function(event) {
|
||||
this._fireEvent("modelUpdate", event);
|
||||
}.bind(this));
|
||||
|
@@ -1,32 +1,45 @@
|
||||
mindplot.collaboration = {};
|
||||
mindplot.collaboration.CollaborationManager = new Class({
|
||||
initialize:function(){
|
||||
initialize:function() {
|
||||
this.collaborativeModelReady = false;
|
||||
this.collaborativeModelReady = null;
|
||||
this.wiseReady = false;
|
||||
},
|
||||
isCollaborationFrameworkAvailable:function(){
|
||||
return $defined(goog.collab.CollaborativeApp);
|
||||
|
||||
isCollaborationFrameworkAvailable:function() {
|
||||
return (typeof goog != "undefined") && (typeof goog.collab != "undefined");
|
||||
},
|
||||
setCollaborativeFramework:function(framework){
|
||||
|
||||
setCollaborativeFramework:function(framework) {
|
||||
this._collaborativeFramework = framework;
|
||||
this.collaborativeModelReady = true;
|
||||
if(this.wiseReady){
|
||||
if (this.wiseReady) {
|
||||
buildCollaborativeMindmapDesigner();
|
||||
}
|
||||
},
|
||||
setWiseReady:function(ready){
|
||||
this.wiseReady=ready;
|
||||
|
||||
setWiseReady:function(ready) {
|
||||
this.wiseReady = ready;
|
||||
},
|
||||
isCollaborativeFrameworkReady:function(){
|
||||
|
||||
isCollaborativeFrameworkReady:function() {
|
||||
return this.collaborativeModelReady;
|
||||
},
|
||||
buildWiseModel: function(){
|
||||
|
||||
buildWiseModel: function() {
|
||||
return this._collaborativeFramework.buildWiseModel();
|
||||
},
|
||||
getCollaborativeFramework:function(){
|
||||
|
||||
getCollaborativeFramework:function() {
|
||||
return this._collaborativeFramework;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$wise_collaborationManager = new mindplot.collaboration.CollaborationManager();
|
||||
mindplot.collaboration.CollaborationManager.getInstance = function() {
|
||||
if (!$defined(mindplot.collaboration.CollaborationManager.__collaborationManager)) {
|
||||
mindplot.collaboration.CollaborationManager.__collaborationManager = new mindplot.collaboration.CollaborationManager();
|
||||
}
|
||||
return mindplot.collaboration.CollaborationManager.__collaborationManager;
|
||||
}
|
||||
mindplot.collaboration.CollaborationManager.getInstance();
|
||||
|
@@ -1,68 +1,66 @@
|
||||
|
||||
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework = new Class({
|
||||
Extends: mindplot.collaboration.frameworks.AbstractCollaborativeFramework,
|
||||
|
||||
initialize: function(model, app){
|
||||
initialize: function(model, app) {
|
||||
this._app = app;
|
||||
var collaborativeModelFactory = new mindplot.collaboration.frameworks.brix.BrixCollaborativeModelFactory(this);
|
||||
var cModel = null;
|
||||
var root = this.getBrixModel().getRoot();
|
||||
if(!root.isEmpty()){
|
||||
if (!root.isEmpty()) {
|
||||
cModel = collaborativeModelFactory.buildCollaborativeModelFor(root.get("mindmap"));
|
||||
}
|
||||
this.parent(cModel, collaborativeModelFactory);
|
||||
},
|
||||
addMindmap:function(model){
|
||||
addMindmap:function(model) {
|
||||
var root = this.getBrixModel().getRoot();
|
||||
root.put("mindmap",model);
|
||||
root.put("mindmap", model);
|
||||
},
|
||||
getBrixModel:function(){
|
||||
getBrixModel:function() {
|
||||
return this._app.getModel();
|
||||
},
|
||||
buildWiseModel: function(){
|
||||
return this.parent();
|
||||
buildWiseModel: function() {
|
||||
return this.parent();
|
||||
}
|
||||
});
|
||||
instanciated=false;
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate=function(){
|
||||
if($defined(isGoogleBrix) && !instanciated){
|
||||
instanciated=true;
|
||||
instanciated = false;
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate = function() {
|
||||
if ((typeof isGoogleBrix != "undefined") && !instanciated) {
|
||||
instanciated = true;
|
||||
var app = new goog.collab.CollaborativeApp();
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.buildMenu(app);
|
||||
app.start();
|
||||
app.addListener('modelLoad', function(model){
|
||||
app.addListener('modelLoad', function(model) {
|
||||
var framework = new mindplot.collaboration.frameworks.brix.BrixFramework(model, app);
|
||||
$wise_collaborationManager.setCollaborativeFramework(framework);
|
||||
mindplot.collaboration.CollaborationManager.getInstance().setCollaborativeFramework(framework);
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.buildMenu=function(app){
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.buildMenu = function(app) {
|
||||
var menuBar = new goog.collab.ui.MenuBar();
|
||||
|
||||
// Configure toolbar menu ...
|
||||
var fileMenu = menuBar.addSubMenu("File");
|
||||
fileMenu.addItem("Save", function() {
|
||||
});
|
||||
fileMenu.addItem("Export", function() {
|
||||
});
|
||||
// Configure toolbar menu ...
|
||||
var fileMenu = menuBar.addSubMenu("File");
|
||||
fileMenu.addItem("Save", function() {
|
||||
});
|
||||
fileMenu.addItem("Export", function() {
|
||||
});
|
||||
|
||||
var editMenu = menuBar.addSubMenu("Edit");
|
||||
editMenu.addItem("Undo", function() {
|
||||
});
|
||||
editMenu.addItem("Redo", function() {
|
||||
});
|
||||
var editMenu = menuBar.addSubMenu("Edit");
|
||||
editMenu.addItem("Undo", function() {
|
||||
});
|
||||
editMenu.addItem("Redo", function() {
|
||||
});
|
||||
|
||||
var formatMenu = menuBar.addSubMenu("Format");
|
||||
formatMenu.addItem("Bold", function() {
|
||||
});
|
||||
var formatMenu = menuBar.addSubMenu("Format");
|
||||
formatMenu.addItem("Bold", function() {
|
||||
});
|
||||
|
||||
var helpMenu = menuBar.addSubMenu("Help");
|
||||
helpMenu.addItem("Shortcuts", function() {
|
||||
});
|
||||
var helpMenu = menuBar.addSubMenu("Help");
|
||||
helpMenu.addItem("Shortcuts", function() {
|
||||
});
|
||||
|
||||
app.setMenuBar(menuBar);
|
||||
app.setMenuBar(menuBar);
|
||||
};
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate();
|
||||
|
||||
|
@@ -69,6 +69,8 @@ mindplot.widget.IconPanel = new Class({
|
||||
|
||||
show:function() {
|
||||
this.fireEvent("show");
|
||||
$(this._buttonId).className = 'buttonActive';
|
||||
|
||||
if (this.options.state == 'close') {
|
||||
if (!$defined(this.options.panel)) {
|
||||
this.init();
|
||||
@@ -84,7 +86,6 @@ mindplot.widget.IconPanel = new Class({
|
||||
this.fireEvent('onStart');
|
||||
this.registerClosePanel();
|
||||
this.options.state = 'open';
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -94,6 +95,7 @@ mindplot.widget.IconPanel = new Class({
|
||||
this.options.panel.setStyles({border: '1px solid transparent', opacity:0});
|
||||
this.registerOpenPanel();
|
||||
this.options.state = 'close';
|
||||
$(this._buttonId).className = 'button';
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -37,7 +37,9 @@ mindplot.widget.Menu = new Class({
|
||||
}
|
||||
};
|
||||
var fontFamilyPanel = new mindplot.widget.FontFamilyPanel("fontFamily", fontFamilyModel);
|
||||
fontFamilyPanel.addEvent('show',function(){this.clear()}.bind(this));
|
||||
fontFamilyPanel.addEvent('show', function() {
|
||||
this.clear()
|
||||
}.bind(this));
|
||||
this._toolbarElems.push(fontFamilyPanel);
|
||||
|
||||
var fontSizeModel = {
|
||||
@@ -53,7 +55,9 @@ mindplot.widget.Menu = new Class({
|
||||
}
|
||||
};
|
||||
var fontSizePanel = new mindplot.widget.FontSizePanel("fontSize", fontSizeModel);
|
||||
fontSizePanel.addEvent('show',function(){this.clear()}.bind(this));
|
||||
fontSizePanel.addEvent('show', function() {
|
||||
this.clear()
|
||||
}.bind(this));
|
||||
this._toolbarElems.push(fontSizePanel);
|
||||
|
||||
var topicShapeModel = {
|
||||
@@ -69,7 +73,9 @@ mindplot.widget.Menu = new Class({
|
||||
}
|
||||
};
|
||||
var topicShapePanel = new mindplot.widget.TopicShapePanel("topicShape", topicShapeModel);
|
||||
topicShapePanel.addEvent('show',function(){this.clear()}.bind(this));
|
||||
topicShapePanel.addEvent('show', function() {
|
||||
this.clear()
|
||||
}.bind(this));
|
||||
this._toolbarElems.push(topicShapePanel);
|
||||
|
||||
// Create icon panel dialog ...
|
||||
@@ -82,11 +88,13 @@ mindplot.widget.Menu = new Class({
|
||||
}
|
||||
};
|
||||
var iconPanel = new mindplot.widget.IconPanel('topicIcon', topicIconModel);
|
||||
iconPanel.addEvent('show',function(){this.clear()}.bind(this));
|
||||
iconPanel.addEvent('show', function() {
|
||||
this.clear()
|
||||
}.bind(this));
|
||||
this._toolbarElems.push(iconPanel);
|
||||
|
||||
|
||||
var topicColorPicker = new MooRainbow('topicColor', {
|
||||
var colorPickerOptions = {
|
||||
id: 'topicColor',
|
||||
imgPath: '../images/',
|
||||
startColor: [255, 255, 255],
|
||||
@@ -100,7 +108,8 @@ mindplot.widget.Menu = new Class({
|
||||
onComplete: function() {
|
||||
this.clear();
|
||||
}.bind(this)
|
||||
});
|
||||
};
|
||||
var topicColorPicker = new MooRainbow('topicColor', colorPickerOptions);
|
||||
this._colorPickers.push(topicColorPicker);
|
||||
|
||||
var borderColorPicker = new MooRainbow('topicBorder', {
|
||||
@@ -135,6 +144,72 @@ mindplot.widget.Menu = new Class({
|
||||
}.bind(this)
|
||||
});
|
||||
this._colorPickers.push(fontColorPicker);
|
||||
|
||||
|
||||
// Register Events ...
|
||||
$('zoomIn').addEvent('click', function(event) {
|
||||
designer.zoomIn();
|
||||
});
|
||||
|
||||
$('zoomOut').addEvent('click', function(event) {
|
||||
designer.zoomOut();
|
||||
});
|
||||
|
||||
$('undoEdition').addEvent('click', function(event) {
|
||||
designer.undo();
|
||||
});
|
||||
|
||||
$('redoEdition').addEvent('click', function(event) {
|
||||
designer.redo();
|
||||
});
|
||||
|
||||
designer.addEventListener("modelUpdate", function(event) {
|
||||
if (event.undoSteps > 0) {
|
||||
$("undoEdition").setStyle("background-image", "url(../images/file_undo.png)");
|
||||
} else {
|
||||
$("undoEdition").setStyle("background-image", "url(../images/file_undo_dis.png)");
|
||||
}
|
||||
|
||||
if (event.redoSteps > 0) {
|
||||
$("redoEdition").setStyle("background-image", "url(../images/file_redo.png)");
|
||||
} else {
|
||||
$("redoEdition").setStyle("background-image", "url(../images/file_redo_dis.png)");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('addTopic').addEvent('click', function(event) {
|
||||
designer.createSiblingForSelectedNode();
|
||||
});
|
||||
|
||||
$('deleteTopic').addEvent('click', function(event) {
|
||||
designer.deleteCurrentNode();
|
||||
});
|
||||
|
||||
|
||||
$('topicLink').addEvent('click', function(event) {
|
||||
designer.addLink2SelectedNode();
|
||||
|
||||
});
|
||||
|
||||
$('topicRelation').addEvent('click', function(event) {
|
||||
designer.addRelationShip2SelectedNode(event);
|
||||
});
|
||||
|
||||
$('topicNote').addEvent('click', function(event) {
|
||||
designer.addNote2SelectedNode();
|
||||
|
||||
});
|
||||
|
||||
$('fontBold').addEvent('click', function(event) {
|
||||
designer.setWeight2SelectedNode();
|
||||
});
|
||||
|
||||
$('fontItalic').addEvent('click', function(event) {
|
||||
designer.setStyle2SelectedNode();
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
clear : function() {
|
||||
|
@@ -22,6 +22,7 @@ mindplot.widget.ToolbarPanel = new Class({
|
||||
$assert(buttonId, "buttonId can not be null");
|
||||
$assert(model, "model can not be null");
|
||||
this._model = model;
|
||||
this._buttonId = buttonId;
|
||||
this._panelId = this.initPanel(buttonId);
|
||||
},
|
||||
|
||||
@@ -42,10 +43,11 @@ mindplot.widget.ToolbarPanel = new Class({
|
||||
// Register on toolbar elements ...
|
||||
var menuElems = panelElem.getElements('div');
|
||||
menuElems.forEach(function(elem) {
|
||||
elem.addEvent('click', function() {
|
||||
elem.addEvent('click', function(event) {
|
||||
var value = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
|
||||
this._model.setValue(value);
|
||||
this.hide();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
@@ -77,10 +79,14 @@ mindplot.widget.ToolbarPanel = new Class({
|
||||
});
|
||||
$(this._panelId).setStyle('display', 'block');
|
||||
|
||||
// Mark the button as active...
|
||||
$(this._buttonId).className = 'buttonActive';
|
||||
},
|
||||
|
||||
hide : function() {
|
||||
$(this._panelId).setStyle('display', 'none');
|
||||
$(this._buttonId).className = 'button';
|
||||
|
||||
},
|
||||
|
||||
isVisible : function() {
|
||||
|
Reference in New Issue
Block a user