Commit 318c47ac authored by Jérome Perrin's avatar Jérome Perrin

Make name and id of new elements configurable

parent 6b935735
......@@ -133,7 +133,7 @@
autoOpen: false,
width: 350,
modal: true,
title: title || "",
title: node_dict[node_id]._class + " " + title || "",
buttons: {
Cancel: function () {
$(this).dialog("close");
......@@ -196,7 +196,7 @@
var element_type = element._class.replace('.', '-');
element.element_id = that.generateElementId();
if (!element.id) {
element.id = that.generateNodeId(element_type);
element.id = that.generateNodeId(element_type, configuration[element_type]);
}
priv.super_newElement(element, configuration[element_type]);
$("#" + element.element_id).on('click', function () {
......
......@@ -37,12 +37,12 @@
return priv.node_container[node_id].element_id;
};
that.generateNodeId = function (element_type) {
that.generateNodeId = function (element_type, option) {
var n = 1;
while ((element_type + '_' + n) in priv.node_container) {
while (((option['short_id'] || element_type) + n) in priv.node_container) {
n += 1;
}
return element_type + '_' + n;
return (option['short_id'] || element_type) + n;
};
that.generateElementId = function () {
......@@ -427,6 +427,7 @@
};
that.newElement = function (element, option) {
element.name = element.name || option.name;
priv.addElementToContainer(element);
var render_element, style_string = "",
coordinate = element.coordinate,
......
......@@ -13,6 +13,7 @@ class Simulation(ShiftsSimulation):
conf['Dream-LineClearance'] = {
"_class": "Dream.LineClearance",
"name": "Clearance",
"short_id": "C",
"property_list": conf['Dream-Queue']['property_list']}
batch_source_entity = copy(schema["entity"])
......@@ -20,6 +21,7 @@ class Simulation(ShiftsSimulation):
conf['Dream-BatchSource'] = {
"_class": "Dream.BatchSource",
"name": "Source",
"short_id": "S",
"property_list": [schema['interarrivalTime'],
batch_source_entity,
schema['batchNumberOfUnits']]
......@@ -33,22 +35,26 @@ class Simulation(ShiftsSimulation):
conf['Dream-BatchDecompositionStartTime'] = {
"_class": "Dream.BatchDecompositionStartTime",
"name": "Decomposition",
"short_id": "D",
"property_list": [zeroProcessingTime, schema['numberOfSubBatches'] ]
}
conf['Dream-BatchReassembly'] = {
"_class": "Dream.BatchReassembly",
"name": "Reassembly",
"short_id": "R",
"property_list": [zeroProcessingTime, schema['numberOfSubBatches'] ]
}
conf['Dream-BatchScrapMachine'] = {
"_class": "Dream.BatchScrapMachine",
"name": "Station",
"short_id": "St",
"property_list": conf['Dream-Machine']['property_list']
}
conf['Dream-EventGenerator'] = {
"_class": "Dream.EventGenerator",
"name": "Attainment",
"short_id": "A",
"property_list": [schema['start'], schema['stop'], schema['duration'],
schema['interval'], schema['method'], schema['argumentDict']]
}
......
......@@ -246,6 +246,7 @@ class Simulation(object):
schema["interarrivalTime"],
schema["entity"]
],
"short_id": "S",
"_class": 'Dream.Source'
},
"Dream-Machine": {
......@@ -253,6 +254,7 @@ class Simulation(object):
schema["processingTime"],
schema["failures"]
],
"short_id": "M",
"_class": 'Dream.Machine'
},
"Dream-Queue": {
......@@ -261,12 +263,15 @@ class Simulation(object):
schema["isDummy"],
schema["schedulingRule"]
],
"short_id": "Q",
"_class": 'Dream.Queue'
},
"Dream-Exit": {
"short_id": "E",
"_class": 'Dream.Exit'
},
"Dream-Repairman": {
"short_id": "R",
"property_list": [schema["capacity"]],
"_class": 'Dream.Repairman'
},
......
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