Commit 28c61fbd authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

store the simulation configuration in 'general' key.

parent 62574cda
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
}, },
_create: function () { _create: function () {
this.general = {};
this.nodes = {}; this.nodes = {};
this.edges = {}; this.edges = {};
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
}, },
clear: function () { clear: function () {
this.general = {};
this.edges = {}; this.edges = {};
$.each(this.nodes, $.proxy(function (node_id, node) { $.each(this.nodes, $.proxy(function (node_id, node) {
jsPlumb.remove(node); jsPlumb.remove(node);
...@@ -169,9 +171,13 @@ ...@@ -169,9 +171,13 @@
if (value === undefined) { if (value === undefined) {
// get // get
var graph = { var graph = {
"general": {},
"nodes": {}, "nodes": {},
"edges": {} "edges": {}
}; };
$.each(this.general, $.proxy(function (key, value) {
graph["general"][key] = value;
}, this));
$.each(this.nodes, $.proxy(function (node_id, node) { $.each(this.nodes, $.proxy(function (node_id, node) {
graph["nodes"][node_id] = node.data(this.options.node_data_key); graph["nodes"][node_id] = node.data(this.options.node_data_key);
}, this)); }, this));
...@@ -182,6 +188,9 @@ ...@@ -182,6 +188,9 @@
} }
this.clear(); this.clear();
$.each(value.general, $.proxy(function (key, value) {
this.general[key] = value;
}, this));
$.each(value.nodes, $.proxy(function (node_id, node) { $.each(value.nodes, $.proxy(function (node_id, node) {
this.add_node(node_id, node); this.add_node(node_id, node);
}, this)); }, this));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment