mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
Basic topic propeties integrated with brix.
This commit is contained in:
parent
85defa2ab9
commit
e2da27ebc8
@ -43,7 +43,7 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTopics: function(topicsIds) {
|
deleteTopics: function(topicsIds, relIds) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -79,6 +79,10 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changeFontSizeToTopic : function(topicsIds, size) {
|
||||||
|
throw "method must be implemented.";
|
||||||
|
},
|
||||||
|
|
||||||
changeBackgroundColorToTopic: function(topicsIds, color) {
|
changeBackgroundColorToTopic: function(topicsIds, color) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
@ -95,15 +99,15 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
changeTextOnTopic : function(topicsIds, text) {
|
changeTextToTopic : function(topicsIds, text) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
shrinkBranch : function(topicsIds, collapse)
|
shrinkBranch : function(topicsIds, collapse) {
|
||||||
{
|
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.ActionDispatcher.setInstance = function(dispatcher) {
|
mindplot.ActionDispatcher.setInstance = function(dispatcher) {
|
||||||
|
@ -21,26 +21,112 @@ mindplot.BrixActionDispatcher = new Class({
|
|||||||
initialize: function(commandContext, fireOnChange) {
|
initialize: function(commandContext, fireOnChange) {
|
||||||
this.parent(commandContext, fireOnChange);
|
this.parent(commandContext, fireOnChange);
|
||||||
this._commandContext = commandContext;
|
this._commandContext = commandContext;
|
||||||
this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeTextOnTopic : function(topicsIds, text) {
|
changeTextToTopic : function(topicsIds, text) {
|
||||||
var framework = mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
var framework = this._getFramework();
|
||||||
|
var topicId;
|
||||||
if (!(topicsIds instanceof Array)) {
|
if (!(topicsIds instanceof Array)) {
|
||||||
topicsIds = [topicsIds];
|
topicId = topicsIds;
|
||||||
|
} else {
|
||||||
|
topicId = topicsIds[0];
|
||||||
}
|
}
|
||||||
var topic = framework.getTopic(topicsIds[0]);
|
var topic = framework.getTopic(topicId);
|
||||||
topic.setText(text, true);
|
topic.setText(text, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getFramework:function () {
|
||||||
|
return mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
||||||
|
},
|
||||||
|
|
||||||
addTopic : function(model, parentTopicId, animated) {
|
addTopic : function(model, parentTopicId, animated) {
|
||||||
var framework = mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
var framework = this._getFramework();
|
||||||
var mindmap = framework.getModel();
|
var mindmap = framework.getModel();
|
||||||
var centralTopic = mindmap.getCentralTopic();
|
var centralTopic = mindmap.getCentralTopic();
|
||||||
|
|
||||||
var newNode = mindmap.createNode(model.getType(), model.getId());
|
var newNode = mindmap.createNode(model.getType(), model.getId());
|
||||||
var position = model.getPosition();
|
var position = model.getPosition();
|
||||||
newNode.setPosition(position.x, position.y);
|
newNode.setPosition(position.x, position.y);
|
||||||
newNode.connectTo(centralTopic);
|
newNode.connectTo(centralTopic);
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFontSizeToTopic : function(topicsIds, size) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
topic.setFontSize(size, true);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFontColorToTopic : function(topicsIds, color) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
topic.setFontColor(color, true);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFontFamilyToTopic : function(topicsIds, family) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
topic.setFontFamily(family, true);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFontStyleToTopic : function(topicsIds) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
var style = ( topic.getFontStyle() == "italic") ? "normal" : "italic";
|
||||||
|
topic.setFontStyle(style, true);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
changeShapeToTopic : function(topicsIds, shapeType) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
topic.setShapeType(shapeType);
|
||||||
|
}.bind(this))
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFontWeightToTopic : function(topicsIds) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
var weight = (topic.getFontWeight() == "bold") ? "normal" : "bold";
|
||||||
|
topic.setFontWeight(weight, true);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
changeBackgroundColorToTopic : function(topicsIds, color) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
topic.setBackgroundColor(color, true);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
changeBorderColorToTopic : function(topicsIds, color) {
|
||||||
|
topicsIds.forEach(function(topicId) {
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
topic.setBorderColor(color);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteTopics : function(topicsIds, relIds) {
|
||||||
|
$assert(topicsIds, "topicsIds can not be null");
|
||||||
|
var framework = this._getFramework();
|
||||||
|
var mindmap = framework.getModel();
|
||||||
|
|
||||||
|
var topicId = topicsIds[0];
|
||||||
|
var topic = framework.getTopic(topicId);
|
||||||
|
$assert(topic, "Could not find topic with id:" + topicId);
|
||||||
|
mindmap.disconnect(topic);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ mindplot.ConnectionLine = new Class({
|
|||||||
var line;
|
var line;
|
||||||
if (targetNode.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
if (targetNode.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
line = this._createLine(lineType, mindplot.ConnectionLine.CURVED);
|
line = this._createLine(lineType, mindplot.ConnectionLine.CURVED);
|
||||||
// line = new web2d.Line();
|
|
||||||
if (line.getType() == "CurvedLine") {
|
if (line.getType() == "CurvedLine") {
|
||||||
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
||||||
line.setSrcControlPoint(ctrlPoints[0]);
|
line.setSrcControlPoint(ctrlPoints[0]);
|
||||||
@ -114,7 +113,6 @@ mindplot.ConnectionLine = new Class({
|
|||||||
line2d.setSrcControlPoint(ctrlPoints[0]);
|
line2d.setSrcControlPoint(ctrlPoints[0]);
|
||||||
line2d.setDestControlPoint(ctrlPoints[1]);
|
line2d.setDestControlPoint(ctrlPoints[1]);
|
||||||
}
|
}
|
||||||
// line2d.moveToBack();
|
|
||||||
|
|
||||||
// Add connector ...
|
// Add connector ...
|
||||||
this._positionateConnector(targetTopic);
|
this._positionateConnector(targetTopic);
|
||||||
|
@ -53,8 +53,8 @@ mindplot.LocalActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTopics: function(topicsIds) {
|
deleteTopics: function(topicsIds,relIds) {
|
||||||
var command = new mindplot.commands.DeleteCommand(topicsIds);
|
var command = new mindplot.commands.DeleteCommand(topicsIds,relIds);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ mindplot.LocalActionDispatcher = new Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeTextOnTopic : function(topicsIds, text) {
|
changeTextToTopic : function(topicsIds, text) {
|
||||||
$assert(topicsIds, "topicsIds can not be null");
|
$assert(topicsIds, "topicsIds can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, value) {
|
var commandFunc = function(topic, value) {
|
||||||
@ -118,7 +118,7 @@ mindplot.LocalActionDispatcher = new Class({
|
|||||||
var result = topic.getFontFamily();
|
var result = topic.getFontFamily();
|
||||||
topic.setFontFamily(fontFamily, true);
|
topic.setFontFamily(fontFamily, true);
|
||||||
|
|
||||||
topic._adjustShapes.delay(0, topic);
|
topic._adjustShapes();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ mindplot.LocalActionDispatcher = new Class({
|
|||||||
var result = topic.getFontSize();
|
var result = topic.getFontSize();
|
||||||
topic.setFontSize(size, true);
|
topic.setFontSize(size, true);
|
||||||
|
|
||||||
topic._adjustShapes.delay(0, topic);
|
topic._adjustShapes();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ mindplot.LocalActionDispatcher = new Class({
|
|||||||
var weight = (result == "bold") ? "normal" : "bold";
|
var weight = (result == "bold") ? "normal" : "bold";
|
||||||
topic.setFontWeight(weight, true);
|
topic.setFontWeight(weight, true);
|
||||||
|
|
||||||
topic._adjustShapes.delay(0, topic);
|
topic._adjustShapes();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
|
|
||||||
// Dispatcher manager ...
|
// Dispatcher manager ...
|
||||||
var commandContext = new mindplot.CommandContext(this);
|
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 = 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));
|
||||||
@ -164,7 +164,7 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
var targetTopicModel = model.getParent();
|
var targetTopicModel = model.getParent();
|
||||||
var targetTopic = null;
|
var targetTopic = null;
|
||||||
|
|
||||||
var topics = this.getModel.getTopics();
|
var topics = this.getModel().getTopics();
|
||||||
for (var i = 0; i < topics.length; i++) {
|
for (var i = 0; i < topics.length; i++) {
|
||||||
var t = topics[i];
|
var t = topics[i];
|
||||||
if (t.getModel() == targetTopicModel) {
|
if (t.getModel() == targetTopicModel) {
|
||||||
@ -593,7 +593,8 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_removeNode : function(node) {
|
_removeNode : function(node) {
|
||||||
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
|
||||||
|
{
|
||||||
var parent = node._parent;
|
var parent = node._parent;
|
||||||
node.disconnect(this._workspace);
|
node.disconnect(this._workspace);
|
||||||
|
|
||||||
@ -621,12 +622,13 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
return object.getType() == mindplot.RelationshipLine.type || object.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE
|
return object.getType() == mindplot.RelationshipLine.type || object.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE
|
||||||
};
|
};
|
||||||
var validateError = 'Central topic can not be deleted.';
|
var validateError = 'Central topic can not be deleted.';
|
||||||
var model = this.getModel();
|
|
||||||
var topics = model.filterTopicsIds(validateFunc, validateError);
|
|
||||||
var rel = model.filterRelationIds(validateFunc, validateError);
|
|
||||||
|
|
||||||
if (topics.length > 0 || rel.length > 0) {
|
var model = this.getModel();
|
||||||
this._actionDispatcher.deleteTopics({'nodes':topics,'relationship':rel});
|
var topicsIds = model.filterTopicsIds(validateFunc, validateError);
|
||||||
|
var relIds = model.filterRelationIds(validateFunc, validateError);
|
||||||
|
|
||||||
|
if (topicsIds.length > 0 || relIds.length > 0) {
|
||||||
|
this._actionDispatcher.deleteTopics(topicsIds,relIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -684,8 +686,7 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
if (topicsIds.length > 0) {
|
if (topicsIds.length > 0) {
|
||||||
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);
|
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
,
|
|
||||||
|
|
||||||
changeTopicShape : function(shape) {
|
changeTopicShape : function(shape) {
|
||||||
var validateFunc = function(topic) {
|
var validateFunc = function(topic) {
|
||||||
|
@ -129,7 +129,7 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
var topicId = this._topic.getId();
|
var topicId = this._topic.getId();
|
||||||
|
|
||||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||||
actionDispatcher.changeTextOnTopic([topicId], text);
|
actionDispatcher.changeTextToTopic([topicId], text);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ mindplot.Note = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getText: function() {
|
getText: function() {
|
||||||
return this._textShape;
|
return this._text;
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel : function() {
|
getModel : function() {
|
||||||
|
@ -101,9 +101,9 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
|
|||||||
//becarefull this._editor is not mootools!!
|
//becarefull this._editor is not mootools!!
|
||||||
this._editor.addEvent('blur',function(event){
|
this._editor.addEvent('blur',function(event){
|
||||||
this._myOverlay.setStyle('display','none');
|
this._myOverlay.setStyle('display','none');
|
||||||
var text = this._textShape;
|
var text = this._text;
|
||||||
this._textShape = this._editor.instanceById("inputText2").getContent();
|
this._text = this._editor.instanceById("inputText2").getContent();
|
||||||
if(text!=this._textShape){
|
if(text!=this._text){
|
||||||
this._applyChanges = true;
|
this._applyChanges = true;
|
||||||
}
|
}
|
||||||
console.log('bye');
|
console.log('bye');
|
||||||
@ -118,7 +118,7 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
|
|||||||
$(this.inputText).focus();
|
$(this.inputText).focus();
|
||||||
},
|
},
|
||||||
getText:function(){
|
getText:function(){
|
||||||
return this._textShape;
|
return this._text;
|
||||||
},
|
},
|
||||||
lostFocusListener:function(){
|
lostFocusListener:function(){
|
||||||
this._hideNode();
|
this._hideNode();
|
||||||
|
@ -112,7 +112,7 @@ mindplot.TextEditor = new Class({
|
|||||||
var topicId = this._topic.getId();
|
var topicId = this._topic.getId();
|
||||||
|
|
||||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||||
actionDispatcher.changeTextOnTopic([topicId], text);
|
actionDispatcher.changeTextToTopic([topicId], text);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -236,14 +236,14 @@ mindplot.Topic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getTextShape : function() {
|
getTextShape : function() {
|
||||||
if (!$defined(this._textShape)) {
|
if (!$defined(this._text)) {
|
||||||
this._textShape = this._buildTextShape(false);
|
this._text = this._buildTextShape(false);
|
||||||
|
|
||||||
// Set Text ...
|
// Set Text ...
|
||||||
var text = this.getText();
|
var text = this.getText();
|
||||||
this._setText(text, false);
|
this._setText(text, false);
|
||||||
}
|
}
|
||||||
return this._textShape;
|
return this._text;
|
||||||
},
|
},
|
||||||
|
|
||||||
getOrBuildIconGroup : function() {
|
getOrBuildIconGroup : function() {
|
||||||
@ -1175,8 +1175,6 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
// Position node ...
|
// Position node ...
|
||||||
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
|
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
|
||||||
|
|
||||||
console.log(textShape.getText() + ":works ?");
|
|
||||||
}).delay(0, this);
|
}).delay(0, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -9,9 +9,11 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
|
|||||||
this._model = model;
|
this._model = model;
|
||||||
this._actionDispatcher = null;
|
this._actionDispatcher = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel : function() {
|
getModel : function() {
|
||||||
return this._model;
|
return this._model;
|
||||||
},
|
},
|
||||||
|
|
||||||
buildWiseModel : function() {
|
buildWiseModel : function() {
|
||||||
var cmindMap = this.getModel();
|
var cmindMap = this.getModel();
|
||||||
var mindmap = new mindplot.model.Mindmap();
|
var mindmap = new mindplot.model.Mindmap();
|
||||||
@ -35,6 +37,7 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
return mindmap;
|
return mindmap;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildInitialCollaborativeModel: function() {
|
_buildInitialCollaborativeModel: function() {
|
||||||
var mindmap = this._collaborativeModelFactory.buildMindMap();
|
var mindmap = this._collaborativeModelFactory.buildMindMap();
|
||||||
var centralTopic = mindmap.createNode(mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE);
|
var centralTopic = mindmap.createNode(mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE);
|
||||||
@ -42,26 +45,35 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
|
|||||||
this.addMindmap(mindmap);
|
this.addMindmap(mindmap);
|
||||||
return mindmap;
|
return mindmap;
|
||||||
},
|
},
|
||||||
addMindmap:function(model){},
|
addMindmap:function(model) {
|
||||||
getTopic:function(id){
|
|
||||||
var branches = this.getModel().getBranches();
|
|
||||||
for(var i = 0; i<branches.length; i++){
|
|
||||||
if(branches[i].getId()==id){
|
|
||||||
return branches[i];
|
|
||||||
}else {
|
|
||||||
|
|
||||||
var children = branches[i].getChildren();
|
|
||||||
for(var j=0; j<children.length; j++){
|
|
||||||
if(children[j].getId()==id){
|
|
||||||
return children[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_findTopic : function(topics, id) {
|
||||||
|
var result;
|
||||||
|
for (var i = 0; i < topics.length; i++) {
|
||||||
|
var topic = topics[i];
|
||||||
|
if (topic.getId() == id) {
|
||||||
|
result = topic;
|
||||||
|
} else {
|
||||||
|
var children = topic.getChildren();
|
||||||
|
result = this._findTopic(children, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
getTopic:function(id) {
|
||||||
|
$assert(id, "id can not be null")
|
||||||
|
var branches = this.getModel().getBranches();
|
||||||
|
var result = this._findTopic(branches, id);
|
||||||
|
$assert(result, "Could not find topic:" + id);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
getActionDispatcher:function() {
|
getActionDispatcher:function() {
|
||||||
if (this._actionDispatcher == null) {
|
if (this._actionDispatcher == null) {
|
||||||
var context = mindplot.ActionDispatcher.getInstance()._commandContext;
|
var context = mindplot.ActionDispatcher.getInstance()._commandContext;
|
||||||
|
@ -22,6 +22,7 @@ mindplot.collaboration.frameworks.brix.BrixFramework = new Class({
|
|||||||
return this.parent();
|
return this.parent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
instanciated = false;
|
instanciated = false;
|
||||||
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate = function() {
|
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate = function() {
|
||||||
if ((typeof isGoogleBrix != "undefined") && !instanciated) {
|
if ((typeof isGoogleBrix != "undefined") && !instanciated) {
|
||||||
|
@ -19,19 +19,34 @@ mindplot.collaboration.frameworks.brix={};
|
|||||||
mindplot.collaboration.frameworks.brix.model = {};
|
mindplot.collaboration.frameworks.brix.model = {};
|
||||||
mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||||
Extends: mindplot.model.NodeModel,
|
Extends: mindplot.model.NodeModel,
|
||||||
|
Attributes: ['text','fontSize','fontFamily','fontStyle','fontColor','fontWeight','borderColor','backgroundColor','shapeType'],
|
||||||
initialize : function(brixModel, brixFramework, type, mindmap, id) {
|
initialize : function(brixModel, brixFramework, type, mindmap, id) {
|
||||||
|
// Inject property getters and setters ...
|
||||||
|
this._injectSetAndGet();
|
||||||
|
|
||||||
this._brixModel = brixModel;
|
this._brixModel = brixModel;
|
||||||
this._brixFramework = brixFramework;
|
this._brixFramework = brixFramework;
|
||||||
if ($defined(this._brixModel)) {
|
if ($defined(this._brixModel)) {
|
||||||
type = this._brixModel.get("type");
|
type = this._brixModel.get("type");
|
||||||
id = this._brixModel.get("id");
|
id = this._brixModel.get("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.parent(type, mindmap, id);
|
this.parent(type, mindmap, id);
|
||||||
if (!$defined(this._brixModel)) {
|
if (!$defined(this._brixModel)) {
|
||||||
this._brixModel = this._createBrixModel();
|
this._brixModel = this._createBrixModel();
|
||||||
} else {
|
} else {
|
||||||
var text = this._brixModel.get("text");
|
|
||||||
this.setText(text, false);
|
// Call all the required setters for simple properties ...
|
||||||
|
var keys = mindplot.collaboration.frameworks.brix.model.NodeModel.prototype.Attributes;
|
||||||
|
keys.forEach(function(key) {
|
||||||
|
|
||||||
|
// Call setters ...
|
||||||
|
var funName = 'set' + key.capitalize();
|
||||||
|
var value = this._brixModel.get(key);
|
||||||
|
if (value != null) {
|
||||||
|
this[funName](value, false);
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
var position = this._brixModel.get("position");
|
var position = this._brixModel.get("position");
|
||||||
this.setPosition(position.get("x"), position.get("y"), false);
|
this.setPosition(position.get("x"), position.get("y"), false);
|
||||||
@ -45,13 +60,46 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
}
|
}
|
||||||
this._addBrixListeners();
|
this._addBrixListeners();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_injectSetAndGet : function() {
|
||||||
|
var keys = mindplot.collaboration.frameworks.brix.model.NodeModel.prototype.Attributes;
|
||||||
|
|
||||||
|
keys.forEach(function(key) {
|
||||||
|
// Create setters ...
|
||||||
|
var setterName = 'set' + key.capitalize();
|
||||||
|
this[setterName] = function(value, updateModel) {
|
||||||
|
console.log('Calling setter for:' + setterName);
|
||||||
|
if (!$defined(updateModel) || updateModel) {
|
||||||
|
this._brixModel.put(key, value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create getters ...
|
||||||
|
var getterName = 'get' + key.capitalize();
|
||||||
|
this[getterName] = function() {
|
||||||
|
return this._brixModel.get(key);
|
||||||
|
};
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
_addBrixListeners:function() {
|
_addBrixListeners:function() {
|
||||||
this._brixModel.addListener("valueChanged", this._valuechangeListener.bindWithEvent(this));
|
// Register listener for properties changes ....
|
||||||
this._brixModel.get("children").addListener("valuesAdded", this._childAddedListener.bindWithEvent(this));
|
this._brixModel.addListener("valueChanged", function(event) {
|
||||||
},
|
var key = event.getProperty();
|
||||||
_valuechangeListener:function(event){
|
|
||||||
this._brixFramework.getActionDispatcher().changeTextOnTopic(this.getId(),event.getNewValue());
|
var actionDispatcher = this._brixFramework.getActionDispatcher();
|
||||||
|
var value = event.getNewValue();
|
||||||
|
|
||||||
|
var funName = 'change' + key.capitalize() + 'ToTopic';
|
||||||
|
if (!$defined(actionDispatcher[funName])) {
|
||||||
|
throw "No implementation for:" + funName;
|
||||||
|
}
|
||||||
|
actionDispatcher[funName](this.getId(), value);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
this._brixModel.get("children").addListener("valuesAdded", this._childAddedListener.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
_childAddedListener:function(event) {
|
_childAddedListener:function(event) {
|
||||||
var newValue = event.getValues().get(0);
|
var newValue = event.getValues().get(0);
|
||||||
var cmodel = new mindplot.collaboration.frameworks.brix.model.NodeModel(newValue, this._brixFramework, null, this.getMindmap());
|
var cmodel = new mindplot.collaboration.frameworks.brix.model.NodeModel(newValue, this._brixFramework, null, this.getMindmap());
|
||||||
@ -63,7 +111,9 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
var y = position.get("y");
|
var y = position.get("y");
|
||||||
model.setPosition(x, y);
|
model.setPosition(x, y);
|
||||||
this._brixFramework.getActionDispatcher().addTopic(model, this.getId(), true);
|
this._brixFramework.getActionDispatcher().addTopic(model, this.getId(), true);
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
_createBrixModel:function() {
|
_createBrixModel:function() {
|
||||||
var model = this._brixFramework.getBrixModel().create("Map");
|
var model = this._brixFramework.getBrixModel().create("Map");
|
||||||
model.put("type", this._type);
|
model.put("type", this._type);
|
||||||
@ -76,10 +126,12 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
var children = this._brixFramework.getBrixModel().create("List");
|
var children = this._brixFramework.getBrixModel().create("List");
|
||||||
model.put("children", children);
|
model.put("children", children);
|
||||||
return model;
|
return model;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
getBrixModel:function() {
|
getBrixModel:function() {
|
||||||
return this._brixModel;
|
return this._brixModel;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
clone : function() {
|
clone : function() {
|
||||||
var result = new mindplot.model.NodeModel(this._type, this._mindmap);
|
var result = new mindplot.model.NodeModel(this._type, this._mindmap);
|
||||||
result._order = this._order;
|
result._order = this._order;
|
||||||
@ -98,7 +150,7 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
result._position = this._position;
|
result._position = this._position;
|
||||||
result._id = this._id;
|
result._id = this._id;
|
||||||
result._mindmap = this._mindmap;
|
result._mindmap = this._mindmap;
|
||||||
result._textShape = this._textShape;
|
result._text = this._text;
|
||||||
result._shapeType = this._shapeType;
|
result._shapeType = this._shapeType;
|
||||||
result._fontFamily = this._fontFamily;
|
result._fontFamily = this._fontFamily;
|
||||||
result._fontSize = this._fontSize;
|
result._fontSize = this._fontSize;
|
||||||
@ -109,15 +161,18 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
result._backgroundColor = this._backgroundColor;
|
result._backgroundColor = this._backgroundColor;
|
||||||
result._areChildrenShrinked = this._areChildrenShrinked;
|
result._areChildrenShrinked = this._areChildrenShrinked;
|
||||||
return result;
|
return result;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
areChildrenShrinked : function() {
|
areChildrenShrinked : function() {
|
||||||
return this._areChildrenShrinked;
|
return this._areChildrenShrinked;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
setChildrenShrinked : function(value) {
|
setChildrenShrinked : function(value) {
|
||||||
this._areChildrenShrinked = value;
|
this._areChildrenShrinked = value;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getId : function() {
|
getId : function() {
|
||||||
return this._id;
|
return this._id;
|
||||||
@ -135,17 +190,6 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
return this._type;
|
return this._type;
|
||||||
},
|
},
|
||||||
|
|
||||||
setText : function(text,updateModel) {
|
|
||||||
this.parent(text);
|
|
||||||
if($defined(updateModel) && updateModel){
|
|
||||||
this._brixModel.put("text",text);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getText : function() {
|
|
||||||
return this._textShape;
|
|
||||||
},
|
|
||||||
|
|
||||||
isNodeModel : function() {
|
isNodeModel : function() {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -192,29 +236,34 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
addIcon : function(icon) {
|
addIcon : function(icon) {
|
||||||
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
|
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
|
||||||
this._icons.push(icon);
|
this._icons.push(icon);
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
removeIcon : function(icon) {
|
removeIcon : function(icon) {
|
||||||
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
|
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
|
||||||
this._icons.erase(icon);
|
this._icons.erase(icon);
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
removeLastIcon : function() {
|
removeLastIcon : function() {
|
||||||
this._icons.pop();
|
this._icons.pop();
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
_appendChild : function(child, updateModel) {
|
_appendChild : function(child, updateModel) {
|
||||||
this.parent(child);
|
this.parent(child);
|
||||||
if (!$defined(updateModel) || ($defined(updateModel) && updateModel)) {
|
if (!$defined(updateModel) || ($defined(updateModel) && updateModel)) {
|
||||||
this.getBrixModel().get("children").add(child.getBrixModel());
|
this.getBrixModel().get("children").add(child.getBrixModel());
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
_removeChild : function(child) {
|
_removeChild : function(child) {
|
||||||
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
|
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
|
||||||
this._children.erase(child);
|
this._children.erase(child);
|
||||||
child._parent = null;
|
child._parent = null;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
setPosition : function(x, y, updateModel) {
|
setPosition : function(x, y, updateModel) {
|
||||||
this.parent(x, y);
|
this.parent(x, y);
|
||||||
@ -223,7 +272,8 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
position.put("x", this._position.x);
|
position.put("x", this._position.x);
|
||||||
position.put("y", this._position.y);
|
position.put("y", this._position.y);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
setFinalPosition : function(x, y) {
|
setFinalPosition : function(x, y) {
|
||||||
$assert(x, "x coordinate must be defined");
|
$assert(x, "x coordinate must be defined");
|
||||||
@ -234,7 +284,8 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
}
|
}
|
||||||
this._finalPosition.x = parseInt(x);
|
this._finalPosition.x = parseInt(x);
|
||||||
this._finalPosition.y = parseInt(y);
|
this._finalPosition.y = parseInt(y);
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getFinalPosition : function() {
|
getFinalPosition : function() {
|
||||||
return this._finalPosition;
|
return this._finalPosition;
|
||||||
@ -243,7 +294,8 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
setSize : function(width, height) {
|
setSize : function(width, height) {
|
||||||
this._size.width = width;
|
this._size.width = width;
|
||||||
this._size.height = height;
|
this._size.height = height;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getSize : function() {
|
getSize : function() {
|
||||||
return {width:this._size.width,height:this._size.height};
|
return {width:this._size.width,height:this._size.height};
|
||||||
@ -251,32 +303,39 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
|
|
||||||
getChildren : function() {
|
getChildren : function() {
|
||||||
return this._children;
|
return this._children;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getIcons : function() {
|
getIcons : function() {
|
||||||
return this._icons;
|
return this._icons;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getLinks : function() {
|
getLinks : function() {
|
||||||
return this._links;
|
return this._links;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getNotes : function() {
|
getNotes : function() {
|
||||||
return this._notes;
|
return this._notes;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getParent : function() {
|
getParent : function() {
|
||||||
return this._parent;
|
return this._parent;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getMindmap : function() {
|
getMindmap : function() {
|
||||||
return this._mindmap;
|
return this._mindmap;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
setParent : function(parent) {
|
setParent : function(parent) {
|
||||||
$assert(parent != this, 'The same node can not be parent and child if itself.');
|
$assert(parent != this, 'The same node can not be parent and child if itself.');
|
||||||
this._parent = parent;
|
this._parent = parent;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
|
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
|
||||||
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
||||||
@ -322,7 +381,8 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
throw "No implemented yet";
|
throw "No implemented yet";
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
_isChildNode : function(node) {
|
_isChildNode : function(node) {
|
||||||
var result = false;
|
var result = false;
|
||||||
@ -340,12 +400,14 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
disconnect : function() {
|
disconnect : function() {
|
||||||
var mindmap = this.getMindmap();
|
var mindmap = this.getMindmap();
|
||||||
mindmap.disconnect(this);
|
mindmap.disconnect(this);
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
getOrder : function() {
|
getOrder : function() {
|
||||||
return this._order;
|
return this._order;
|
||||||
@ -363,66 +425,6 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
this._order = value;
|
this._order = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
setFontFamily : function(value) {
|
|
||||||
this._fontFamily = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
getOrder : function() {
|
|
||||||
return this._order;
|
|
||||||
},
|
|
||||||
|
|
||||||
getFontFamily : function() {
|
|
||||||
return this._fontFamily;
|
|
||||||
},
|
|
||||||
|
|
||||||
setFontStyle : function(value) {
|
|
||||||
this._fontStyle = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
getFontStyle : function() {
|
|
||||||
return this._fontStyle;
|
|
||||||
},
|
|
||||||
|
|
||||||
setFontWeight : function(value) {
|
|
||||||
this._fontWeight = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
getFontWeight : function() {
|
|
||||||
return this._fontWeight;
|
|
||||||
},
|
|
||||||
|
|
||||||
setFontColor : function(value) {
|
|
||||||
this._fontColor = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
getFontColor : function() {
|
|
||||||
return this._fontColor;
|
|
||||||
},
|
|
||||||
|
|
||||||
setFontSize : function(value) {
|
|
||||||
this._fontSize = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
getFontSize : function() {
|
|
||||||
return this._fontSize;
|
|
||||||
},
|
|
||||||
|
|
||||||
getBorderColor : function() {
|
|
||||||
return this._borderColor;
|
|
||||||
},
|
|
||||||
|
|
||||||
setBorderColor : function(color) {
|
|
||||||
this._borderColor = color;
|
|
||||||
},
|
|
||||||
|
|
||||||
getBackgroundColor : function() {
|
|
||||||
return this._backgroundColor;
|
|
||||||
},
|
|
||||||
|
|
||||||
setBackgroundColor : function(color) {
|
|
||||||
this._backgroundColor = color;
|
|
||||||
},
|
|
||||||
|
|
||||||
deleteNode : function() {
|
deleteNode : function() {
|
||||||
var mindmap = this._mindmap;
|
var mindmap = this._mindmap;
|
||||||
|
|
||||||
@ -443,33 +445,10 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
|||||||
var branches = mindmap.getBranches();
|
var branches = mindmap.getBranches();
|
||||||
branches.erase(this);
|
branches.erase(this);
|
||||||
|
|
||||||
},
|
}
|
||||||
|
,
|
||||||
|
|
||||||
inspect : function() {
|
inspect : function() {
|
||||||
return '(type:' + this.getType() + ' , id: ' + this.getId() + ')';
|
return '(type:' + this.getType() + ' , id: ' + this.getId() + ')';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic';
|
|
||||||
mindplot.model.NodeModel.MAIN_TOPIC_TYPE = 'MainTopic';
|
|
||||||
mindplot.model.NodeModel.DRAGGED_TOPIC_TYPE = 'DraggedTopic';
|
|
||||||
|
|
||||||
mindplot.model.NodeModel.SHAPE_TYPE_RECT = 'rectagle';
|
|
||||||
mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT = 'rounded rectagle';
|
|
||||||
mindplot.model.NodeModel.SHAPE_TYPE_ELIPSE = 'elipse';
|
|
||||||
mindplot.model.NodeModel.SHAPE_TYPE_LINE = 'line';
|
|
||||||
|
|
||||||
mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo: This method must be implemented.
|
|
||||||
*/
|
|
||||||
mindplot.model.NodeModel._nextUUID = function() {
|
|
||||||
if (!$defined(this._uuid)) {
|
|
||||||
this._uuid = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._uuid = this._uuid + 1;
|
|
||||||
return this._uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ mindplot.commands.AddIconToTopicCommand = new Class({
|
|||||||
initialize: function(topicId, iconType) {
|
initialize: function(topicId, iconType) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
$assert(iconType, 'iconType can not be null');
|
$assert(iconType, 'iconType can not be null');
|
||||||
this._topicsIds = topicId;
|
this._objectsIds = topicId;
|
||||||
this._iconType = iconType;
|
this._iconType = iconType;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
|
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
|
||||||
this._iconModel = iconImg.getModel();
|
this._iconModel = iconImg.getModel();
|
||||||
@ -36,7 +36,7 @@ mindplot.commands.AddIconToTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.removeIcon(this._iconModel);
|
topic.removeIcon(this._iconModel);
|
||||||
topic._adjustShapes();
|
topic._adjustShapes();
|
||||||
|
@ -20,12 +20,12 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
|
|||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId, url) {
|
initialize: function(topicId, url) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
this._topicsIds = topicId;
|
this._objectsIds = topicId;
|
||||||
this._url = url;
|
this._url = url;
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.addLink(this._url, commandContext._designer);
|
topic.addLink(this._url, commandContext._designer);
|
||||||
topic._adjustShapes();
|
topic._adjustShapes();
|
||||||
@ -33,7 +33,7 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
|
|||||||
updated.delay(0);
|
updated.delay(0);
|
||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.removeLink();
|
topic.removeLink();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
@ -20,20 +20,20 @@ mindplot.commands.AddNoteToTopicCommand = new Class({
|
|||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId, text) {
|
initialize: function(topicId, text) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
this._topicsIds = topicId;
|
this._objectsIds = topicId;
|
||||||
this._textShape = text;
|
this._text = text;
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.addNote(this._textShape);
|
topic.addNote(this._text);
|
||||||
topic._adjustShapes();
|
topic._adjustShapes();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
updated.delay(0);
|
updated.delay(0);
|
||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.removeNote();
|
topic.removeNote();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
mindplot.commands.DeleteCommand = new Class({
|
mindplot.commands.DeleteCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(objectIds) {
|
initialize: function(topicIds,relIds) {
|
||||||
$assert(objectIds, "objectIds must be defined");
|
this._relIds = relIds;
|
||||||
this._topicsIds = objectIds;
|
this._topicIds = topicIds;
|
||||||
this._deletedTopicModels = [];
|
this._deletedTopicModels = [];
|
||||||
this._parentTopicIds = [];
|
this._parentTopicIds = [];
|
||||||
this._deletedRelationships = [];
|
this._deletedRelationships = [];
|
||||||
@ -28,7 +28,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topics = commandContext.findTopics(this._topicsIds.nodes);
|
var topics = commandContext.findTopics(this._topicIds);
|
||||||
if (topics.length > 0) {
|
if (topics.length > 0) {
|
||||||
topics.forEach(
|
topics.forEach(
|
||||||
function(topic, index) {
|
function(topic, index) {
|
||||||
@ -58,7 +58,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var lines = commandContext.findRelationships(this._topicsIds.relationship);
|
var lines = commandContext.findRelationships(this._relIds);
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
lines.forEach(function(line, index) {
|
lines.forEach(function(line, index) {
|
||||||
if (line.isInWorkspace()) {
|
if (line.isInWorkspace()) {
|
||||||
@ -70,7 +70,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
|
|
||||||
var topics = commandContext.findTopics(this._topicsIds);
|
var topics = commandContext.findTopics(this._topicIds);
|
||||||
var parent = commandContext.findTopics(this._parentTopicIds);
|
var parent = commandContext.findTopics(this._parentTopicIds);
|
||||||
|
|
||||||
this._deletedTopicModels.forEach(
|
this._deletedTopicModels.forEach(
|
||||||
|
@ -21,7 +21,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
|||||||
initialize: function(topicIds, position, order, parentTopic) {
|
initialize: function(topicIds, position, order, parentTopic) {
|
||||||
$assert(topicIds, "topicIds must be defined");
|
$assert(topicIds, "topicIds must be defined");
|
||||||
|
|
||||||
this._topicsIds = topicIds;
|
this._objectsIds = topicIds;
|
||||||
if ($defined(parentTopic))
|
if ($defined(parentTopic))
|
||||||
this._parentId = parentTopic.getId();
|
this._parentId = parentTopic.getId();
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
|
|
||||||
var topic = commandContext.findTopics([this._topicsIds])[0];
|
var topic = commandContext.findTopics([this._objectsIds])[0];
|
||||||
|
|
||||||
// Save old position ...
|
// Save old position ...
|
||||||
var origParentTopic = topic.getOutgoingConnectedTopic();
|
var origParentTopic = topic.getOutgoingConnectedTopic();
|
||||||
|
@ -23,14 +23,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
$assert(topicsIds, "topicsIds must be defined");
|
$assert(topicsIds, "topicsIds must be defined");
|
||||||
|
|
||||||
this._value = value;
|
this._value = value;
|
||||||
this._topicsIds = topicsIds;
|
this._objectsIds = topicsIds;
|
||||||
this._commandFunc = commandFunc;
|
this._commandFunc = commandFunc;
|
||||||
this._oldValues = [];
|
this._oldValues = [];
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
if (!this.applied) {
|
if (!this.applied) {
|
||||||
var topics = commandContext.findTopics(this._topicsIds);
|
var topics = commandContext.findTopics(this._objectsIds);
|
||||||
topics.forEach(function(topic) {
|
topics.forEach(function(topic) {
|
||||||
var oldValue = this._commandFunc(topic, this._value);
|
var oldValue = this._commandFunc(topic, this._value);
|
||||||
this._oldValues.push(oldValue);
|
this._oldValues.push(oldValue);
|
||||||
@ -43,7 +43,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
if (this.applied) {
|
if (this.applied) {
|
||||||
var topics = commandContext.findTopics(this._topicsIds);
|
var topics = commandContext.findTopics(this._objectsIds);
|
||||||
topics.forEach(function(topic, index) {
|
topics.forEach(function(topic, index) {
|
||||||
this._commandFunc(topic, this._oldValues[index]);
|
this._commandFunc(topic, this._oldValues[index]);
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
|||||||
{
|
{
|
||||||
$assert(topicIds, 'topicIds can not be null');
|
$assert(topicIds, 'topicIds can not be null');
|
||||||
$assert(iconModel, 'iconModel can not be null');
|
$assert(iconModel, 'iconModel can not be null');
|
||||||
this._topicsIds = topicIds;
|
this._objectsIds = topicIds;
|
||||||
this._iconModel = iconModel;
|
this._iconModel = iconModel;
|
||||||
},
|
},
|
||||||
execute: function(commandContext)
|
execute: function(commandContext)
|
||||||
{
|
{
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.removeIcon(this._iconModel);
|
topic.removeIcon(this._iconModel);
|
||||||
topic._adjustShapes();
|
topic._adjustShapes();
|
||||||
@ -36,7 +36,7 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
undoExecute: function(commandContext)
|
undoExecute: function(commandContext)
|
||||||
{
|
{
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
var iconType = this._iconModel.getIconType();
|
var iconType = this._iconModel.getIconType();
|
||||||
var iconImg = topic.addIcon(iconType, commandContext._designer);
|
var iconImg = topic.addIcon(iconType, commandContext._designer);
|
||||||
|
@ -20,10 +20,10 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
|||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId) {
|
initialize: function(topicId) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
this._topicsIds = topicId;
|
this._objectsIds = topicId;
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
this._url = topic._link.getUrl();
|
this._url = topic._link.getUrl();
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.removeLink();
|
topic.removeLink();
|
||||||
@ -31,7 +31,7 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
|||||||
updated.delay(0);
|
updated.delay(0);
|
||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.addLink(this._url, commandContext._designer);
|
topic.addLink(this._url, commandContext._designer);
|
||||||
topic._adjustShapes();
|
topic._adjustShapes();
|
||||||
|
@ -21,12 +21,12 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
|||||||
initialize: function(topicId)
|
initialize: function(topicId)
|
||||||
{
|
{
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
this._topicsIds = topicId;
|
this._objectsIds = topicId;
|
||||||
},
|
},
|
||||||
execute: function(commandContext)
|
execute: function(commandContext)
|
||||||
{
|
{
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
this._textShape = topic._note.getText();
|
this._text = topic._note.getText();
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.removeNote();
|
topic.removeNote();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
@ -34,9 +34,9 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
undoExecute: function(commandContext)
|
undoExecute: function(commandContext)
|
||||||
{
|
{
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||||
var updated = function() {
|
var updated = function() {
|
||||||
topic.addNote(this._textShape,commandContext._designer);
|
topic.addNote(this._text,commandContext._designer);
|
||||||
topic._adjustShapes();
|
topic._adjustShapes();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
updated.delay(0);
|
updated.delay(0);
|
||||||
|
@ -38,7 +38,7 @@ mindplot.model.NodeModel = new Class({
|
|||||||
this._id = mindplot.model.NodeModel._nextUUID();
|
this._id = mindplot.model.NodeModel._nextUUID();
|
||||||
}
|
}
|
||||||
this._mindmap = mindmap;
|
this._mindmap = mindmap;
|
||||||
this._textShape = null;
|
this._text = null;
|
||||||
this._shapeType = null;
|
this._shapeType = null;
|
||||||
this._fontFamily = null;
|
this._fontFamily = null;
|
||||||
this._fontSize = null;
|
this._fontSize = null;
|
||||||
@ -68,7 +68,7 @@ mindplot.model.NodeModel = new Class({
|
|||||||
result._position = this._position;
|
result._position = this._position;
|
||||||
result._id = this._id;
|
result._id = this._id;
|
||||||
result._mindmap = this._mindmap;
|
result._mindmap = this._mindmap;
|
||||||
result._textShape = this._textShape;
|
result._text = this._text;
|
||||||
result._shapeType = this._shapeType;
|
result._shapeType = this._shapeType;
|
||||||
result._fontFamily = this._fontFamily;
|
result._fontFamily = this._fontFamily;
|
||||||
result._fontSize = this._fontSize;
|
result._fontSize = this._fontSize;
|
||||||
@ -106,11 +106,11 @@ mindplot.model.NodeModel = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setText : function(text) {
|
setText : function(text) {
|
||||||
this._textShape = text;
|
this._text = text;
|
||||||
},
|
},
|
||||||
|
|
||||||
getText : function() {
|
getText : function() {
|
||||||
return this._textShape;
|
return this._text;
|
||||||
},
|
},
|
||||||
|
|
||||||
isNodeModel : function() {
|
isNodeModel : function() {
|
||||||
@ -322,10 +322,6 @@ mindplot.model.NodeModel = new Class({
|
|||||||
mindmap.disconnect(this);
|
mindmap.disconnect(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
getOrder : function() {
|
|
||||||
return this._order;
|
|
||||||
},
|
|
||||||
|
|
||||||
getShapeType : function() {
|
getShapeType : function() {
|
||||||
return this._shapeType;
|
return this._shapeType;
|
||||||
},
|
},
|
||||||
|
@ -18,18 +18,18 @@
|
|||||||
|
|
||||||
mindplot.model.NoteModel = new Class({
|
mindplot.model.NoteModel = new Class({
|
||||||
initialize : function(text, topic) {
|
initialize : function(text, topic) {
|
||||||
$assert(text != null, 'note text can not be null');
|
$assert(text, 'text text can not be null');
|
||||||
$assert(topic, 'mindmap can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
this._textShape = text;
|
this._text = text;
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
},
|
},
|
||||||
|
|
||||||
getText:function() {
|
getText:function() {
|
||||||
return this._textShape;
|
return this._text;
|
||||||
},
|
},
|
||||||
|
|
||||||
setText : function(text) {
|
setText : function(text) {
|
||||||
this._textShape = text;
|
this._text = text;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopic : function() {
|
getTopic : function() {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<!--<script type="text/javascript" src="http://docs.google.com/brix/static/api/js/jsapi.nocache.js"></script>-->
|
<script type="text/javascript" src="http://docs.google.com/brix/static/api/js/jsapi.nocache.js"></script>
|
||||||
<!-- Internet Explorer 8 Hack -->
|
<!-- Internet Explorer 8 Hack -->
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
||||||
<title>WiseMapping - Editor </title>
|
<title>WiseMapping - Editor </title>
|
||||||
|
Loading…
Reference in New Issue
Block a user