- Features are not created inside topic. This helps on revert action.
This commit is contained in:
@@ -28,9 +28,9 @@ mindplot.model.FeatureModel = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
initialize:function (type, id) {
|
||||
initialize:function (type) {
|
||||
$assert(type, 'type can not be null');
|
||||
this._id = $defined(id) ? id : mindplot.model.FeatureModel._nextUUID();
|
||||
this._id = mindplot.model.FeatureModel._nextUUID();
|
||||
|
||||
this._type = type;
|
||||
this._attributes = {};
|
||||
|
@@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.IconModel = new Class({
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes, id) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE, id);
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE);
|
||||
this.setIconType(attributes.id);
|
||||
},
|
||||
|
||||
|
@@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.LinkModel = new Class({
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes,id) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE,id);
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE);
|
||||
this.setUrl(attributes.url);
|
||||
},
|
||||
|
||||
|
@@ -32,8 +32,8 @@ mindplot.model.NodeModel = new Class({
|
||||
this._feature = [];
|
||||
},
|
||||
|
||||
createFeature:function (type, attributes, featureId) {
|
||||
return mindplot.TopicFeature.createModel(type, attributes, featureId);
|
||||
createFeature:function (type, attributes) {
|
||||
return mindplot.TopicFeature.createModel(type, attributes);
|
||||
},
|
||||
|
||||
addFeature:function (feature) {
|
||||
@@ -47,9 +47,12 @@ mindplot.model.NodeModel = new Class({
|
||||
|
||||
removeFeature:function (feature) {
|
||||
$assert(feature, 'feature can not be null');
|
||||
var size = this._feature.length;
|
||||
this._feature = this._feature.filter(function (f) {
|
||||
return feature.getId() != f.getId();
|
||||
});
|
||||
$assert(size - 1 == this._feature.length, 'Could not be removed ...');
|
||||
|
||||
},
|
||||
|
||||
findFeatureByType:function (type) {
|
||||
@@ -61,9 +64,11 @@ mindplot.model.NodeModel = new Class({
|
||||
|
||||
findFeatureById:function (id) {
|
||||
$assert($defined(id), 'id can not be null');
|
||||
return this._feature.filter(function (feature) {
|
||||
var result = this._feature.filter(function (feature) {
|
||||
return feature.getId() == id;
|
||||
})[0];
|
||||
});
|
||||
$assert(result.length == 1, "Feature could not be found:" + id);
|
||||
return result[0]
|
||||
},
|
||||
|
||||
getPropertiesKeys:function () {
|
||||
|
@@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.NoteModel = new Class({
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes, id) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE, id);
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE);
|
||||
var noteText = attributes.text ? attributes.text : " ";
|
||||
this.setText(noteText);
|
||||
},
|
||||
|
Reference in New Issue
Block a user