ParamField.js
3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* Un composant de 'PlotFunction' qui permet d'afficher le min samplig de chaque paramètre et le nombre de points théoriques entre un start time et stop time
*/
Ext.define('amdaPlotComp.plotFunction.ParamField', {
extend: 'Ext.form.Panel',
label_number_field: "NUMBERFIELD",
label_number_field1: "NUMBERFIELD1",
parent: null,
initComponent: function () {
const items_params = [];
const minSampling = "Min Sampling (s)";
const minValue = 0;
const labelWitdh = 120;
const width = 30;
for (p in this.params) {
const param = this.params[p];
const fieldSet = {
xtype: 'fieldset',
name: 'FIELDSET' + param.id,
title: param.id,
collapsible: false,
layout: {
type: 'vbox',
align: 'stretch',
},
items: [
{
xtype: 'numberfield',
name: this.label_number_field + param.id,
labelWidth: labelWitdh,
width: width,
value: param.MinSampling,
minValue: minValue,
disabled: true,
fieldLabel: minSampling
},
{
xtype: 'numberfield',
name: this.label_number_field1 + param.id,
labelWidth: labelWitdh,
width: width,
value: 0,
minValue: minValue,
fieldLabel: "Nb Points"
}
]
};
items_params.push(fieldSet);
}
const tabParams = Ext.create('Ext.tab.Panel', {
layout: 'fit',
plain: true,
bodyStyle: 'background: none',
items: items_params
});
const config =
{
title: 'Parameters Sampling',
layout: 'fit',
bodyStyle: { background: '#dfe8f6' },
items: [tabParams]
};
Ext.apply(this, config);
this.callParent(arguments);
},
setParent: function (parent_) {
this.parent = parent_;
},
getValues: function () {
let list = "";
let i = 0;
for (p in this.params) {
let param = this.params[p];
const ui_item = this.parent.findField(this.label_number_field1 + param.id);
if (i > 0) list += "@";
if (ui_item !== undefined && ui_item !== null) {
list += param.id + "@" + param.MinSampling + "@" + ui_item.getValue();
}
i++;
}
return { "param_nb_points": list };
},
setValues: function (startTime, stopTime) {
for (p in this.params) {
let param = this.params[p];
const nb_points = (stopTime - startTime) / param.MinSampling;
const ui_item = this.parent.findField(this.label_number_field1 + param.id);
ui_item.setValue(parseInt(nb_points));
}
}
});