mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
Support multiple nodes ..
This commit is contained in:
parent
09237a13b5
commit
1abda3914a
@ -194,7 +194,6 @@ mindplot.model.INodeModel = new Class({
|
|||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
connectTo : function(parent) {
|
connectTo : function(parent) {
|
||||||
$assert(parent, "parent can not be null");
|
$assert(parent, "parent can not be null");
|
||||||
var mindmap = this.getMindmap();
|
var mindmap = this.getMindmap();
|
||||||
@ -278,19 +277,41 @@ mindplot.model.INodeModel = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
inspect : function() {
|
inspect : function() {
|
||||||
return '{ type: ' + this.getType() +
|
var result = '{ type: ' + this.getType() +
|
||||||
' , id: ' + this.getId() +
|
' , id: ' + this.getId() +
|
||||||
' , text: ' + this.getText() +
|
' , text: ' + this.getText();
|
||||||
' }';
|
|
||||||
|
var children = this.getChildren();
|
||||||
|
if (children.length > 0) {
|
||||||
|
result = result + "{(size:" + children.length;
|
||||||
|
children.forEach(function(node) {
|
||||||
|
result = result + "=> (" + node.getPropertiesKeys() + ")";
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
result = result + ' }';
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
copyTo : function(target) {
|
copyTo : function(target) {
|
||||||
var source = this;
|
var source = this;
|
||||||
|
// Copy properties ...
|
||||||
var keys = source.getPropertiesKeys();
|
var keys = source.getPropertiesKeys();
|
||||||
keys.forEach(function(key) {
|
keys.forEach(function(key) {
|
||||||
var value = source.getProperty(key);
|
var value = source.getProperty(key);
|
||||||
target.putProperty(key, value);
|
target.putProperty(key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Copy childrens ...
|
||||||
|
var children = this.getChildren();
|
||||||
|
var tmindmap = target.getMindmap();
|
||||||
|
|
||||||
|
children.forEach(function(snode) {
|
||||||
|
var tnode = tmindmap.createNode(snode.getType(), snode.getId());
|
||||||
|
snode.copyTo(tnode);
|
||||||
|
target.appendChild(tnode);
|
||||||
|
});
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user