Commit e48e1586 authored by Sebastien Robin's avatar Sebastien Robin

gui prototype: correctly define repairmans in data structure

parent d2859e60
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"use strict"; "use strict";
jsPlumb.bind("ready", function() { jsPlumb.bind("ready", function() {
var graph_data = {}, dream_instance, available_people = {}, people_list, var graph_data = {}, dream_instance, available_people = {}, people_list,
i, i_length, updateWorkerCount; i, i_length, updateWorkerCount, json_plumb_configuration = {};
graph_data.throughput = 0; graph_data.throughput = 0;
graph_data.box_list = [ graph_data.box_list = [
{id: 'window1', title: 'attach1', throughput: 30, target_list: ['window2'], coordinate: {top: 5, left: 5}}, {id: 'window1', title: 'attach1', throughput: 30, target_list: ['window2'], coordinate: {top: 5, left: 5}},
...@@ -17,7 +17,14 @@ ...@@ -17,7 +17,14 @@
{id: 'window10', title: 'tests', throughput: 28, target_list: ['window11'], coordinate: {top: 20, left: 45}}, {id: 'window10', title: 'tests', throughput: 28, target_list: ['window11'], coordinate: {top: 20, left: 45}},
{id: 'window11', title: 'packaging', throughput: 27, coordinate: {top: 20, left: 55}}, {id: 'window11', title: 'packaging', throughput: 27, coordinate: {top: 20, left: 55}},
]; ];
/*json_plumb_configuration["Dream.Queue"] = {
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["M1"]
};*/
//dream_instance = DREAM.newDream(graph_data); //dream_instance = DREAM.newDream(graph_data);
//dream_instance.start(); //dream_instance.start();
var main_div_offset = $("#main").offset(); var main_div_offset = $("#main").offset();
......
...@@ -64,13 +64,15 @@ ...@@ -64,13 +64,15 @@
var updateConnectionData = function(connection, remove) { var updateConnectionData = function(connection, remove) {
console.log("updateConnectionData is being called"); console.log("updateConnectionData is being called");
var i, core_length=priv.graph_data.coreObject.length, var i, core_length=priv.graph_data.coreObject.length,
element; source_element, destination_element;
for (i=0; i<core_length; i++) { source_element = priv.element_container[connection.sourceId];
element = priv.graph_data.coreObject[i]; destination_element = priv.element_container[connection.targetId];
if (element.id === connection.sourceId) { console.log('destination_element._class', destination_element._class);
element.successorList = element.successorList || []; if (destination_element._class === "Dream.Repairman") {
element.successorList.push(connection.targetId); source_element.repairman = destination_element.id;
}; } else {
source_element.successorList = source_element.successorList || [];
source_element.successorList.push(connection.targetId);
} }
priv.updateJsonOutput(); priv.updateJsonOutput();
}; };
...@@ -95,6 +97,7 @@ ...@@ -95,6 +97,7 @@
name: element.id, name: element.id,
capacity: "1", capacity: "1",
}; };
priv.element_container[element.id] = element_data;
priv.graph_data.modelResource.push(element_data); priv.graph_data.modelResource.push(element_data);
priv.updateJsonOutput(); priv.updateJsonOutput();
}; };
...@@ -104,20 +107,9 @@ ...@@ -104,20 +107,9 @@
var element_data = {_class: element.class, var element_data = {_class: element.class,
id: element.id, id: element.id,
name: element.id}; name: element.id};
priv.element_container[element.id] = element_data;
priv.graph_data.coreObject.push(element_data); priv.graph_data.coreObject.push(element_data);
priv.updateJsonOutput(); priv.updateJsonOutput();
/*{"_class": "Dream.Source",
"id": "S1",
"name": "Raw Material",
"interarrivalTime":
{
"distributionType": "Fixed",
"mean": "0.5"
},
"entity": "Part",
"successorList": ["DummyQ"]
}, */
}; };
Object.defineProperty(that, "start", { Object.defineProperty(that, "start", {
...@@ -125,10 +117,17 @@ ...@@ -125,10 +117,17 @@
enumerable: false, enumerable: false,
writable: false, writable: false,
value: function () { value: function () {
//priv.setModel(); priv.element_container = {};
priv.element_list = [];
priv.graph_data = {coreObject: [], priv.graph_data = {coreObject: [],
modelResource: [], modelResource: [],
_class: "Dream.Simulation",
general: {
"_class": "Dream.Configuration",
"numberOfReplications": "1",
"maxSimTime": "1440",
"trace": "Yes",
"confidenceLevel": "0.95"
},
}; };
priv.initJsPlumb(); priv.initJsPlumb();
//priv.initDialog(); //priv.initDialog();
...@@ -155,7 +154,6 @@ ...@@ -155,7 +154,6 @@
render_element.append('<div class="window" id="' + render_element.append('<div class="window" id="' +
element.id + '" ' + style_string + '">' element.id + '" ' + style_string + '">'
+ element.id + '</div>'); + element.id + '</div>');
priv.element_list.push(element);
// Initial DEMO code : make all the window divs draggable // Initial DEMO code : make all the window divs draggable
jsPlumb.draggable(jsPlumb.getSelector(".window"), { grid: [20, 20] }); jsPlumb.draggable(jsPlumb.getSelector(".window"), { grid: [20, 20] });
...@@ -237,4 +235,4 @@ ...@@ -237,4 +235,4 @@
value: JsonPlumbNamespace value: JsonPlumbNamespace
}); });
}(window, jQuery, jsPlumb, console, _)); }(window, jQuery, jsPlumb, console, _));
\ No newline at end of file
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