mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +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.";
|
||||
},
|
||||
|
||||
deleteTopics: function(topicsIds) {
|
||||
deleteTopics: function(topicsIds, relIds) {
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
@ -79,6 +79,10 @@ mindplot.ActionDispatcher = new Class({
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
changeFontSizeToTopic : function(topicsIds, size) {
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
changeBackgroundColorToTopic: function(topicsIds, color) {
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
@ -95,15 +99,15 @@ mindplot.ActionDispatcher = new Class({
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
changeTextOnTopic : function(topicsIds, text) {
|
||||
changeTextToTopic : function(topicsIds, text) {
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
shrinkBranch : function(topicsIds, collapse)
|
||||
{
|
||||
shrinkBranch : function(topicsIds, collapse) {
|
||||
throw "method must be implemented.";
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
mindplot.ActionDispatcher.setInstance = function(dispatcher) {
|
||||
|
@ -21,26 +21,112 @@ mindplot.BrixActionDispatcher = new Class({
|
||||
initialize: function(commandContext, fireOnChange) {
|
||||
this.parent(commandContext, fireOnChange);
|
||||
this._commandContext = commandContext;
|
||||
this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext);
|
||||
},
|
||||
|
||||
changeTextOnTopic : function(topicsIds, text) {
|
||||
var framework = mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
||||
changeTextToTopic : function(topicsIds, text) {
|
||||
var framework = this._getFramework();
|
||||
var topicId;
|
||||
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);
|
||||
},
|
||||
|
||||
addTopic:function(model, parentTopicId, animated) {
|
||||
var framework = mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
||||
_getFramework:function () {
|
||||
return mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
||||
},
|
||||
|
||||
addTopic : function(model, parentTopicId, animated) {
|
||||
var framework = this._getFramework();
|
||||
var mindmap = framework.getModel();
|
||||
var centralTopic = mindmap.getCentralTopic();
|
||||
|
||||
var newNode = mindmap.createNode(model.getType(), model.getId());
|
||||
var position = model.getPosition();
|
||||
newNode.setPosition(position.x, position.y);
|
||||
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;
|
||||
if (targetNode.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
line = this._createLine(lineType, mindplot.ConnectionLine.CURVED);
|
||||
// line = new web2d.Line();
|
||||
if (line.getType() == "CurvedLine") {
|
||||
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
||||
line.setSrcControlPoint(ctrlPoints[0]);
|
||||
@ -114,7 +113,6 @@ mindplot.ConnectionLine = new Class({
|
||||
line2d.setSrcControlPoint(ctrlPoints[0]);
|
||||
line2d.setDestControlPoint(ctrlPoints[1]);
|
||||
}
|
||||
// line2d.moveToBack();
|
||||
|
||||
// Add connector ...
|
||||
this._positionateConnector(targetTopic);
|
||||
|
@ -53,8 +53,8 @@ mindplot.LocalActionDispatcher = new Class({
|
||||
this.execute(command);
|
||||
},
|
||||
|
||||
deleteTopics: function(topicsIds) {
|
||||
var command = new mindplot.commands.DeleteCommand(topicsIds);
|
||||
deleteTopics: function(topicsIds,relIds) {
|
||||
var command = new mindplot.commands.DeleteCommand(topicsIds,relIds);
|
||||
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");
|
||||
|
||||
var commandFunc = function(topic, value) {
|
||||
@ -118,7 +118,7 @@ mindplot.LocalActionDispatcher = new Class({
|
||||
var result = topic.getFontFamily();
|
||||
topic.setFontFamily(fontFamily, true);
|
||||
|
||||
topic._adjustShapes.delay(0, topic);
|
||||
topic._adjustShapes();
|
||||
return result;
|
||||
};
|
||||
|
||||
@ -179,7 +179,7 @@ mindplot.LocalActionDispatcher = new Class({
|
||||
var result = topic.getFontSize();
|
||||
topic.setFontSize(size, true);
|
||||
|
||||
topic._adjustShapes.delay(0, topic);
|
||||
topic._adjustShapes();
|
||||
return result;
|
||||
};
|
||||
|
||||
@ -209,7 +209,7 @@ mindplot.LocalActionDispatcher = new Class({
|
||||
var weight = (result == "bold") ? "normal" : "bold";
|
||||
topic.setFontWeight(weight, true);
|
||||
|
||||
topic._adjustShapes.delay(0, topic);
|
||||
topic._adjustShapes();
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -24,8 +24,8 @@ mindplot.MindmapDesigner = new Class({
|
||||
|
||||
// Dispatcher manager ...
|
||||
var commandContext = new mindplot.CommandContext(this);
|
||||
// this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext);
|
||||
this._actionDispatcher = new mindplot.LocalActionDispatcher(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));
|
||||
@ -164,7 +164,7 @@ mindplot.MindmapDesigner = new Class({
|
||||
var targetTopicModel = model.getParent();
|
||||
var targetTopic = null;
|
||||
|
||||
var topics = this.getModel.getTopics();
|
||||
var topics = this.getModel().getTopics();
|
||||
for (var i = 0; i < topics.length; i++) {
|
||||
var t = topics[i];
|
||||
if (t.getModel() == targetTopicModel) {
|
||||
@ -593,7 +593,8 @@ mindplot.MindmapDesigner = new Class({
|
||||
},
|
||||
|
||||
_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;
|
||||
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
|
||||
};
|
||||
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) {
|
||||
this._actionDispatcher.deleteTopics({'nodes':topics,'relationship':rel});
|
||||
var model = this.getModel();
|
||||
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) {
|
||||
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
changeTopicShape : function(shape) {
|
||||
var validateFunc = function(topic) {
|
||||
|
@ -129,7 +129,7 @@ mindplot.MultilineTextEditor = new Class({
|
||||
var topicId = this._topic.getId();
|
||||
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.changeTextOnTopic([topicId], text);
|
||||
actionDispatcher.changeTextToTopic([topicId], text);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -39,7 +39,7 @@ mindplot.Note = new Class({
|
||||
},
|
||||
|
||||
getText: function() {
|
||||
return this._textShape;
|
||||
return this._text;
|
||||
},
|
||||
|
||||
getModel : function() {
|
||||
|
@ -101,9 +101,9 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
|
||||
//becarefull this._editor is not mootools!!
|
||||
this._editor.addEvent('blur',function(event){
|
||||
this._myOverlay.setStyle('display','none');
|
||||
var text = this._textShape;
|
||||
this._textShape = this._editor.instanceById("inputText2").getContent();
|
||||
if(text!=this._textShape){
|
||||
var text = this._text;
|
||||
this._text = this._editor.instanceById("inputText2").getContent();
|
||||
if(text!=this._text){
|
||||
this._applyChanges = true;
|
||||
}
|
||||
console.log('bye');
|
||||
@ -118,7 +118,7 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
|
||||
$(this.inputText).focus();
|
||||
},
|
||||
getText:function(){
|
||||
return this._textShape;
|
||||
return this._text;
|
||||
},
|
||||
lostFocusListener:function(){
|
||||
this._hideNode();
|
||||
|
@ -112,7 +112,7 @@ mindplot.TextEditor = new Class({
|
||||
var topicId = this._topic.getId();
|
||||
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.changeTextOnTopic([topicId], text);
|
||||
actionDispatcher.changeTextToTopic([topicId], text);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -59,7 +59,7 @@ mindplot.Topic = new Class({
|
||||
// var oldText = textShape.getText();
|
||||
|
||||
// this._setText(text, false);
|
||||
// @Todo: I must resize, no change the position ...
|
||||
// @Todo: I must resize, no change the position ...
|
||||
// textShape.setText(oldText);
|
||||
}.bind(this));
|
||||
|
||||
@ -236,14 +236,14 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
getTextShape : function() {
|
||||
if (!$defined(this._textShape)) {
|
||||
this._textShape = this._buildTextShape(false);
|
||||
if (!$defined(this._text)) {
|
||||
this._text = this._buildTextShape(false);
|
||||
|
||||
// Set Text ...
|
||||
var text = this.getText();
|
||||
this._setText(text, false);
|
||||
}
|
||||
return this._textShape;
|
||||
return this._text;
|
||||
},
|
||||
|
||||
getOrBuildIconGroup : function() {
|
||||
@ -1175,8 +1175,6 @@ mindplot.Topic = new Class({
|
||||
|
||||
// Position node ...
|
||||
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
|
||||
|
||||
console.log(textShape.getText() + ":works ?");
|
||||
}).delay(0, this);
|
||||
},
|
||||
|
||||
|
@ -6,11 +6,11 @@ mindplot.collaboration.CollaborationManager = new Class({
|
||||
this.wiseReady = false;
|
||||
},
|
||||
|
||||
isCollaborationFrameworkAvailable:function() {
|
||||
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) {
|
||||
|
@ -1,31 +1,33 @@
|
||||
mindplot.collaboration.frameworks = {};
|
||||
|
||||
mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
|
||||
initialize: function(model, collaborativeModelFactory){
|
||||
initialize: function(model, collaborativeModelFactory) {
|
||||
this._collaborativeModelFactory = collaborativeModelFactory;
|
||||
if(!$defined(model)){
|
||||
if (!$defined(model)) {
|
||||
model = this._buildInitialCollaborativeModel();
|
||||
}
|
||||
this._model = model;
|
||||
this._actionDispatcher = null;
|
||||
},
|
||||
getModel: function(){
|
||||
|
||||
getModel : function() {
|
||||
return this._model;
|
||||
},
|
||||
buildWiseModel: function(){
|
||||
|
||||
buildWiseModel : function() {
|
||||
var cmindMap = this.getModel();
|
||||
var mindmap = new mindplot.model.Mindmap();
|
||||
var branches = cmindMap.getBranches();
|
||||
branches.forEach(function(branch){
|
||||
branches.forEach(function(branch) {
|
||||
var type = branch.getType();
|
||||
var id = branch.getId();
|
||||
var node = mindmap.createNode(type,id);
|
||||
var node = mindmap.createNode(type, id);
|
||||
node.setText(branch.getText());
|
||||
var position = branch.getPosition();
|
||||
node.setPosition(position.x, position.y);
|
||||
var children = branch.getChildren();
|
||||
children.forEach(function(child){
|
||||
var node2 = new mindplot.model.NodeModel(child.getType(),mindmap, child.getId());
|
||||
children.forEach(function(child) {
|
||||
var node2 = new mindplot.model.NodeModel(child.getType(), mindmap, child.getId());
|
||||
node2.setText(child.getText());
|
||||
var pos = child.getPosition();
|
||||
node2.setPosition(pos.x, pos.y);
|
||||
@ -35,35 +37,45 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
|
||||
}.bind(this));
|
||||
return mindmap;
|
||||
},
|
||||
_buildInitialCollaborativeModel: function(){
|
||||
|
||||
_buildInitialCollaborativeModel: function() {
|
||||
var mindmap = this._collaborativeModelFactory.buildMindMap();
|
||||
var centralTopic = mindmap.createNode(mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE);
|
||||
mindmap.addBranch(centralTopic, true);
|
||||
this.addMindmap(mindmap);
|
||||
return mindmap;
|
||||
},
|
||||
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 {
|
||||
addMindmap:function(model) {
|
||||
},
|
||||
|
||||
var children = branches[i].getChildren();
|
||||
for(var j=0; j<children.length; j++){
|
||||
if(children[j].getId()==id){
|
||||
return children[j];
|
||||
}
|
||||
|
||||
}
|
||||
_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 null;
|
||||
return result;
|
||||
},
|
||||
getActionDispatcher:function(){
|
||||
if(this._actionDispatcher == null){
|
||||
|
||||
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() {
|
||||
if (this._actionDispatcher == null) {
|
||||
var context = mindplot.ActionDispatcher.getInstance()._commandContext;
|
||||
this._actionDispatcher = new mindplot.LocalActionDispatcher(context);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ mindplot.collaboration.frameworks.brix.BrixFramework = new Class({
|
||||
return this.parent();
|
||||
}
|
||||
});
|
||||
|
||||
instanciated = false;
|
||||
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate = function() {
|
||||
if ((typeof isGoogleBrix != "undefined") && !instanciated) {
|
||||
|
@ -15,71 +15,123 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.collaboration.frameworks.brix={};
|
||||
mindplot.collaboration.frameworks.brix = {};
|
||||
mindplot.collaboration.frameworks.brix.model = {};
|
||||
mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
Extends: mindplot.model.NodeModel,
|
||||
initialize:function(brixModel, brixFramework, type, mindmap, id) {
|
||||
Attributes: ['text','fontSize','fontFamily','fontStyle','fontColor','fontWeight','borderColor','backgroundColor','shapeType'],
|
||||
initialize : function(brixModel, brixFramework, type, mindmap, id) {
|
||||
// Inject property getters and setters ...
|
||||
this._injectSetAndGet();
|
||||
|
||||
this._brixModel = brixModel;
|
||||
this._brixFramework = brixFramework;
|
||||
if($defined(this._brixModel)){
|
||||
if ($defined(this._brixModel)) {
|
||||
type = this._brixModel.get("type");
|
||||
id = this._brixModel.get("id");
|
||||
}
|
||||
|
||||
this.parent(type, mindmap, id);
|
||||
if(!$defined(this._brixModel)){
|
||||
if (!$defined(this._brixModel)) {
|
||||
this._brixModel = this._createBrixModel();
|
||||
}else{
|
||||
var text = this._brixModel.get("text");
|
||||
this.setText(text, false);
|
||||
} else {
|
||||
|
||||
// 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");
|
||||
this.setPosition(position.get("x"),position.get("y"), false);
|
||||
this.setPosition(position.get("x"), position.get("y"), false);
|
||||
|
||||
var children = this._brixModel.get("children");
|
||||
for(var i=0; i<children.size(); i++){
|
||||
for (var i = 0; i < children.size(); i++) {
|
||||
var bChild = children.get(i);
|
||||
var child= new mindplot.collaboration.frameworks.brix.model.NodeModel(bChild, this._brixFramework, null, mindmap);
|
||||
var child = new mindplot.collaboration.frameworks.brix.model.NodeModel(bChild, this._brixFramework, null, mindmap);
|
||||
this._appendChild(child, false);
|
||||
}
|
||||
}
|
||||
this._addBrixListeners();
|
||||
},
|
||||
_addBrixListeners:function(){
|
||||
this._brixModel.addListener("valueChanged", this._valuechangeListener.bindWithEvent(this));
|
||||
this._brixModel.get("children").addListener("valuesAdded", this._childAddedListener.bindWithEvent(this));
|
||||
|
||||
_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));
|
||||
},
|
||||
_valuechangeListener:function(event){
|
||||
this._brixFramework.getActionDispatcher().changeTextOnTopic(this.getId(),event.getNewValue());
|
||||
|
||||
_addBrixListeners:function() {
|
||||
// Register listener for properties changes ....
|
||||
this._brixModel.addListener("valueChanged", function(event) {
|
||||
var key = event.getProperty();
|
||||
|
||||
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 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());
|
||||
this._appendChild(cmodel, false);
|
||||
|
||||
var model = new mindplot.model.NodeModel(newValue.get("type"),designer.getMindmap(), newValue.get("id"));
|
||||
var model = new mindplot.model.NodeModel(newValue.get("type"), designer.getMindmap(), newValue.get("id"));
|
||||
var position = newValue.get("position");
|
||||
var x = position.get("x");
|
||||
var y = position.get("y");
|
||||
model.setPosition(x, y);
|
||||
this._brixFramework.getActionDispatcher().addTopic(model, this.getId(), true);
|
||||
},
|
||||
_createBrixModel:function(){
|
||||
}
|
||||
,
|
||||
|
||||
_createBrixModel:function() {
|
||||
var model = this._brixFramework.getBrixModel().create("Map");
|
||||
model.put("type",this._type);
|
||||
model.put("id",this._id);
|
||||
model.put("text",this._type==mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE?"Central Topic":"Main Topic");
|
||||
model.put("type", this._type);
|
||||
model.put("id", this._id);
|
||||
model.put("text", this._type == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE ? "Central Topic" : "Main Topic");
|
||||
var position = this._brixFramework.getBrixModel().create("Map");
|
||||
position.put("x",0);
|
||||
position.put("y",0);
|
||||
model.put("position",position);
|
||||
position.put("x", 0);
|
||||
position.put("y", 0);
|
||||
model.put("position", position);
|
||||
var children = this._brixFramework.getBrixModel().create("List");
|
||||
model.put("children", children);
|
||||
return model;
|
||||
},
|
||||
getBrixModel:function(){
|
||||
}
|
||||
,
|
||||
getBrixModel:function() {
|
||||
return this._brixModel;
|
||||
},
|
||||
}
|
||||
,
|
||||
clone : function() {
|
||||
var result = new mindplot.model.NodeModel(this._type, this._mindmap);
|
||||
result._order = this._order;
|
||||
@ -98,7 +150,7 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
result._position = this._position;
|
||||
result._id = this._id;
|
||||
result._mindmap = this._mindmap;
|
||||
result._textShape = this._textShape;
|
||||
result._text = this._text;
|
||||
result._shapeType = this._shapeType;
|
||||
result._fontFamily = this._fontFamily;
|
||||
result._fontSize = this._fontSize;
|
||||
@ -109,15 +161,18 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
result._backgroundColor = this._backgroundColor;
|
||||
result._areChildrenShrinked = this._areChildrenShrinked;
|
||||
return result;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
areChildrenShrinked : function() {
|
||||
return this._areChildrenShrinked;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
setChildrenShrinked : function(value) {
|
||||
this._areChildrenShrinked = value;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getId : function() {
|
||||
return this._id;
|
||||
@ -135,17 +190,6 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
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() {
|
||||
return true;
|
||||
},
|
||||
@ -192,38 +236,44 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
addIcon : function(icon) {
|
||||
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
|
||||
this._icons.push(icon);
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
removeIcon : function(icon) {
|
||||
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
|
||||
this._icons.erase(icon);
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
removeLastIcon : function() {
|
||||
this._icons.pop();
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
_appendChild : function(child, updateModel) {
|
||||
this.parent(child);
|
||||
if(!$defined(updateModel) || ($defined(updateModel) && updateModel)){
|
||||
if (!$defined(updateModel) || ($defined(updateModel) && updateModel)) {
|
||||
this.getBrixModel().get("children").add(child.getBrixModel());
|
||||
}
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
_removeChild : function(child) {
|
||||
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
|
||||
this._children.erase(child);
|
||||
child._parent = null;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
setPosition : function(x, y, updateModel) {
|
||||
this.parent(x,y);
|
||||
if(!$defined(updateModel) || ($defined(updateModel) && updateModel)){
|
||||
this.parent(x, y);
|
||||
if (!$defined(updateModel) || ($defined(updateModel) && updateModel)) {
|
||||
var position = this.getBrixModel().get("position");
|
||||
position.put("x",this._position.x);
|
||||
position.put("y",this._position.y);
|
||||
position.put("x", this._position.x);
|
||||
position.put("y", this._position.y);
|
||||
}
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
setFinalPosition : function(x, y) {
|
||||
$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.y = parseInt(y);
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getFinalPosition : function() {
|
||||
return this._finalPosition;
|
||||
@ -243,7 +294,8 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
setSize : function(width, height) {
|
||||
this._size.width = width;
|
||||
this._size.height = height;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getSize : function() {
|
||||
return {width:this._size.width,height:this._size.height};
|
||||
@ -251,32 +303,39 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
|
||||
getChildren : function() {
|
||||
return this._children;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getIcons : function() {
|
||||
return this._icons;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getLinks : function() {
|
||||
return this._links;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getNotes : function() {
|
||||
return this._notes;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getParent : function() {
|
||||
return this._parent;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getMindmap : function() {
|
||||
return this._mindmap;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
setParent : function(parent) {
|
||||
$assert(parent != this, 'The same node can not be parent and child if itself.');
|
||||
this._parent = parent;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
|
||||
$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";
|
||||
}
|
||||
return result;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
_isChildNode : function(node) {
|
||||
var result = false;
|
||||
@ -340,12 +400,14 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
}
|
||||
return result;
|
||||
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
disconnect : function() {
|
||||
var mindmap = this.getMindmap();
|
||||
mindmap.disconnect(this);
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
getOrder : function() {
|
||||
return this._order;
|
||||
@ -363,66 +425,6 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
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() {
|
||||
var mindmap = this._mindmap;
|
||||
|
||||
@ -443,33 +445,10 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
|
||||
var branches = mindmap.getBranches();
|
||||
branches.erase(this);
|
||||
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
inspect : function() {
|
||||
inspect : function() {
|
||||
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) {
|
||||
$assert(topicId, 'topicId can not be null');
|
||||
$assert(iconType, 'iconType can not be null');
|
||||
this._topicsIds = topicId;
|
||||
this._objectsIds = topicId;
|
||||
this._iconType = iconType;
|
||||
},
|
||||
|
||||
execute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
|
||||
this._iconModel = iconImg.getModel();
|
||||
@ -36,7 +36,7 @@ mindplot.commands.AddIconToTopicCommand = new Class({
|
||||
},
|
||||
|
||||
undoExecute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.removeIcon(this._iconModel);
|
||||
topic._adjustShapes();
|
||||
|
@ -20,12 +20,12 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(topicId, url) {
|
||||
$assert(topicId, 'topicId can not be null');
|
||||
this._topicsIds = topicId;
|
||||
this._objectsIds = topicId;
|
||||
this._url = url;
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
execute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.addLink(this._url, commandContext._designer);
|
||||
topic._adjustShapes();
|
||||
@ -33,7 +33,7 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
|
||||
updated.delay(0);
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.removeLink();
|
||||
}.bind(this);
|
||||
|
@ -20,20 +20,20 @@ mindplot.commands.AddNoteToTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(topicId, text) {
|
||||
$assert(topicId, 'topicId can not be null');
|
||||
this._topicsIds = topicId;
|
||||
this._textShape = text;
|
||||
this._objectsIds = topicId;
|
||||
this._text = text;
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
execute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.addNote(this._textShape);
|
||||
topic.addNote(this._text);
|
||||
topic._adjustShapes();
|
||||
}.bind(this);
|
||||
updated.delay(0);
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.removeNote();
|
||||
}.bind(this);
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
mindplot.commands.DeleteCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(objectIds) {
|
||||
$assert(objectIds, "objectIds must be defined");
|
||||
this._topicsIds = objectIds;
|
||||
initialize: function(topicIds,relIds) {
|
||||
this._relIds = relIds;
|
||||
this._topicIds = topicIds;
|
||||
this._deletedTopicModels = [];
|
||||
this._parentTopicIds = [];
|
||||
this._deletedRelationships = [];
|
||||
@ -28,7 +28,7 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
},
|
||||
|
||||
execute: function(commandContext) {
|
||||
var topics = commandContext.findTopics(this._topicsIds.nodes);
|
||||
var topics = commandContext.findTopics(this._topicIds);
|
||||
if (topics.length > 0) {
|
||||
topics.forEach(
|
||||
function(topic, index) {
|
||||
@ -58,7 +58,7 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
var lines = commandContext.findRelationships(this._topicsIds.relationship);
|
||||
var lines = commandContext.findRelationships(this._relIds);
|
||||
if (lines.length > 0) {
|
||||
lines.forEach(function(line, index) {
|
||||
if (line.isInWorkspace()) {
|
||||
@ -70,7 +70,7 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
|
||||
var topics = commandContext.findTopics(this._topicsIds);
|
||||
var topics = commandContext.findTopics(this._topicIds);
|
||||
var parent = commandContext.findTopics(this._parentTopicIds);
|
||||
|
||||
this._deletedTopicModels.forEach(
|
||||
|
@ -21,7 +21,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
||||
initialize: function(topicIds, position, order, parentTopic) {
|
||||
$assert(topicIds, "topicIds must be defined");
|
||||
|
||||
this._topicsIds = topicIds;
|
||||
this._objectsIds = topicIds;
|
||||
if ($defined(parentTopic))
|
||||
this._parentId = parentTopic.getId();
|
||||
|
||||
@ -31,7 +31,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
||||
},
|
||||
execute: function(commandContext) {
|
||||
|
||||
var topic = commandContext.findTopics([this._topicsIds])[0];
|
||||
var topic = commandContext.findTopics([this._objectsIds])[0];
|
||||
|
||||
// Save old position ...
|
||||
var origParentTopic = topic.getOutgoingConnectedTopic();
|
||||
|
@ -23,14 +23,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
||||
$assert(topicsIds, "topicsIds must be defined");
|
||||
|
||||
this._value = value;
|
||||
this._topicsIds = topicsIds;
|
||||
this._objectsIds = topicsIds;
|
||||
this._commandFunc = commandFunc;
|
||||
this._oldValues = [];
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
execute: function(commandContext) {
|
||||
if (!this.applied) {
|
||||
var topics = commandContext.findTopics(this._topicsIds);
|
||||
var topics = commandContext.findTopics(this._objectsIds);
|
||||
topics.forEach(function(topic) {
|
||||
var oldValue = this._commandFunc(topic, this._value);
|
||||
this._oldValues.push(oldValue);
|
||||
@ -43,7 +43,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
if (this.applied) {
|
||||
var topics = commandContext.findTopics(this._topicsIds);
|
||||
var topics = commandContext.findTopics(this._objectsIds);
|
||||
topics.forEach(function(topic, index) {
|
||||
this._commandFunc(topic, this._oldValues[index]);
|
||||
|
||||
|
@ -22,12 +22,12 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
||||
{
|
||||
$assert(topicIds, 'topicIds can not be null');
|
||||
$assert(iconModel, 'iconModel can not be null');
|
||||
this._topicsIds = topicIds;
|
||||
this._objectsIds = topicIds;
|
||||
this._iconModel = iconModel;
|
||||
},
|
||||
execute: function(commandContext)
|
||||
{
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.removeIcon(this._iconModel);
|
||||
topic._adjustShapes();
|
||||
@ -36,7 +36,7 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
var iconType = this._iconModel.getIconType();
|
||||
var iconImg = topic.addIcon(iconType, commandContext._designer);
|
||||
|
@ -20,10 +20,10 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(topicId) {
|
||||
$assert(topicId, 'topicId can not be null');
|
||||
this._topicsIds = topicId;
|
||||
this._objectsIds = topicId;
|
||||
},
|
||||
execute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
this._url = topic._link.getUrl();
|
||||
var updated = function() {
|
||||
topic.removeLink();
|
||||
@ -31,7 +31,7 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
||||
updated.delay(0);
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.addLink(this._url, commandContext._designer);
|
||||
topic._adjustShapes();
|
||||
|
@ -21,12 +21,12 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
||||
initialize: function(topicId)
|
||||
{
|
||||
$assert(topicId, 'topicId can not be null');
|
||||
this._topicsIds = topicId;
|
||||
this._objectsIds = topicId;
|
||||
},
|
||||
execute: function(commandContext)
|
||||
{
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
this._textShape = topic._note.getText();
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
this._text = topic._note.getText();
|
||||
var updated = function() {
|
||||
topic.removeNote();
|
||||
}.bind(this);
|
||||
@ -34,9 +34,9 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.addNote(this._textShape,commandContext._designer);
|
||||
topic.addNote(this._text,commandContext._designer);
|
||||
topic._adjustShapes();
|
||||
}.bind(this);
|
||||
updated.delay(0);
|
||||
|
@ -38,7 +38,7 @@ mindplot.model.NodeModel = new Class({
|
||||
this._id = mindplot.model.NodeModel._nextUUID();
|
||||
}
|
||||
this._mindmap = mindmap;
|
||||
this._textShape = null;
|
||||
this._text = null;
|
||||
this._shapeType = null;
|
||||
this._fontFamily = null;
|
||||
this._fontSize = null;
|
||||
@ -68,7 +68,7 @@ mindplot.model.NodeModel = new Class({
|
||||
result._position = this._position;
|
||||
result._id = this._id;
|
||||
result._mindmap = this._mindmap;
|
||||
result._textShape = this._textShape;
|
||||
result._text = this._text;
|
||||
result._shapeType = this._shapeType;
|
||||
result._fontFamily = this._fontFamily;
|
||||
result._fontSize = this._fontSize;
|
||||
@ -106,11 +106,11 @@ mindplot.model.NodeModel = new Class({
|
||||
},
|
||||
|
||||
setText : function(text) {
|
||||
this._textShape = text;
|
||||
this._text = text;
|
||||
},
|
||||
|
||||
getText : function() {
|
||||
return this._textShape;
|
||||
return this._text;
|
||||
},
|
||||
|
||||
isNodeModel : function() {
|
||||
@ -322,10 +322,6 @@ mindplot.model.NodeModel = new Class({
|
||||
mindmap.disconnect(this);
|
||||
},
|
||||
|
||||
getOrder : function() {
|
||||
return this._order;
|
||||
},
|
||||
|
||||
getShapeType : function() {
|
||||
return this._shapeType;
|
||||
},
|
||||
|
@ -18,18 +18,18 @@
|
||||
|
||||
mindplot.model.NoteModel = new Class({
|
||||
initialize : function(text, topic) {
|
||||
$assert(text != null, 'note text can not be null');
|
||||
$assert(topic, 'mindmap can not be null');
|
||||
this._textShape = text;
|
||||
$assert(text, 'text text can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
this._text = text;
|
||||
this._topic = topic;
|
||||
},
|
||||
|
||||
getText:function() {
|
||||
return this._textShape;
|
||||
return this._text;
|
||||
},
|
||||
|
||||
setText : function(text) {
|
||||
this._textShape = text;
|
||||
this._text = text;
|
||||
},
|
||||
|
||||
getTopic : function() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<!--[if lt IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<![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 -->
|
||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
||||
<title>WiseMapping - Editor </title>
|
||||
|
Loading…
Reference in New Issue
Block a user