summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-12-16 15:30:45 +0200
committerLV-426 <lv-426@taproot.org.il>2014-12-16 15:40:10 +0200
commit2797072203d9a2e3b794948ca0754704661ec245 (patch)
tree6a7e5ba3d2c6139e08c79c30d4c38cb331b5cde3 /src
parent7240992e2535ff35b2d2a75b5eeb3cba491c463d (diff)
Attr_Diff: add_link_attr_write, add_link_attr_rm
Diffstat (limited to 'src')
-rw-r--r--src/model/diff.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/model/diff.js b/src/model/diff.js
index 6d70f929..8903b161 100644
--- a/src/model/diff.js
+++ b/src/model/diff.js
@@ -58,20 +58,18 @@ define([],
* node,link types are supported
*/
function Attr_Diff(obj_spec) {
- this.__type_node = {}
- this.__type_link = {}
+ this.__type_node = {};
+ this.__type_link = {};
}
- Attr_Diff.prototype.init_attr_diff = function(type, id) {
+ Attr_Diff.prototype.init_attr_diff = function(type_name, id) {
- if ('node' != type && 'link' != type) {
- console
- .error('attempt to init attribute diff for unsupported type: '
- + type);
+ if ('node' != type_name && 'link' != type_name) {
+ console.error('attempt to init attribute diff for unsupported type: ' + type_name);
return;
}
- var type_field = '__type_' + type;
+ var type_field = '__type_' + type_name;
this[type_field][id] = {
'__attr_write' : {},
'__attr_remove' : []
@@ -106,6 +104,24 @@ define([],
return this;
}
+ Attr_Diff.prototype.add_link_attr_write = function(l_id, attr_name,
+ attr_val) {
+
+ if (undefined == this.__type_link[l_id]) {
+ this.init_attr_diff_link(l_id);
+ }
+ this.__type_link[l_id].__attr_write[attr_name] = attr_val;
+ return this;
+ }
+
+ Attr_Diff.prototype.add_link_attr_rm = function(l_id, attr_name) {
+ if (undefined == this[l_id]) {
+ this.init_attr_diff(l_id);
+ }
+ this.__type_link[l_id].__attr_remove.push(attr_name);
+ return this;
+ }
+
/**
* Visual diff object expressing any visual change to the state of a
* particular visualization type.