- Features are not created inside topic. This helps on revert action.

This commit is contained in:
Paulo Gustavo Veiga
2012-09-28 23:14:37 -03:00
parent dbf8b0e28c
commit dfe07e2da0
9 changed files with 36 additions and 29 deletions

View File

@@ -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 = {};

View File

@@ -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);
},

View File

@@ -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);
},

View File

@@ -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 () {

View File

@@ -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);
},