Blame view

js/app/views/PlotComponents/plotFunction/ParamField.js 4.06 KB
48e98e36   Menouard AZIB   I have created a ...
1
2
3
/**
 * 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
 */
1f9f9178   Menouard AZIB   I have created a ...
4
5
Ext.define('amdaPlotComp.plotFunction.ParamField', {
    extend: 'Ext.form.Panel',
5b411da5   Menouard AZIB   Adding comments t...
6
7
8
    /**
     * id du composant de type numberfield qui hébérge le min sampling
     */
1f9f9178   Menouard AZIB   I have created a ...
9
    label_number_field: "NUMBERFIELD",
5b411da5   Menouard AZIB   Adding comments t...
10
11
12
    /**
     * id du composant de type numberfield qui hébérge le nombre de points
     */
1f9f9178   Menouard AZIB   I have created a ...
13
    label_number_field1: "NUMBERFIELD1",
5b411da5   Menouard AZIB   Adding comments t...
14
15
16
    /**
     * Le composant parent de celui-ci
     */
eeb3432d   Menouard AZIB   La feature 'PlotF...
17
    parent: null,
1f9f9178   Menouard AZIB   I have created a ...
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

    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);
5b411da5   Menouard AZIB   Adding comments t...
79
        //Les arguments sont les paramètres, chaque paramètre contient un id et un min Sampling
1f9f9178   Menouard AZIB   I have created a ...
80
81
82
        this.callParent(arguments);
    },

5b411da5   Menouard AZIB   Adding comments t...
83
84
85
86
    /**
     * Set parent
     * @param {*} parent_ le parent qui contient ce composant
     */
eeb3432d   Menouard AZIB   La feature 'PlotF...
87
88
89
90
    setParent: function (parent_) {
        this.parent = parent_;
    },

5b411da5   Menouard AZIB   Adding comments t...
91
92
93
94
    /**
     * Retourne les valeurs d'id, min sampling et nb_points de tout les parametres passés comme argument 
     * @returns id1@minSampling1@nb_points1@id2@minSampling2@nb_points2....
     */
eeb3432d   Menouard AZIB   La feature 'PlotF...
95
    getValues: function () {
2e75df20   Menouard AZIB   Change param_nb_p...
96
        let list = "";
5b411da5   Menouard AZIB   Adding comments t...
97
        const delimeter = "@";
2e75df20   Menouard AZIB   Change param_nb_p...
98
        let i = 0;
1f9f9178   Menouard AZIB   I have created a ...
99
100
        for (p in this.params) {
            let param = this.params[p];
eeb3432d   Menouard AZIB   La feature 'PlotF...
101
            const ui_item = this.parent.findField(this.label_number_field1 + param.id);
5b411da5   Menouard AZIB   Adding comments t...
102
            if (i > 0) list += delimeter;
1f9f9178   Menouard AZIB   I have created a ...
103
            if (ui_item !== undefined && ui_item !== null) {
5b411da5   Menouard AZIB   Adding comments t...
104
                list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue();
1f9f9178   Menouard AZIB   I have created a ...
105
            }
2e75df20   Menouard AZIB   Change param_nb_p...
106
            i++;
1f9f9178   Menouard AZIB   I have created a ...
107
        }
eeb3432d   Menouard AZIB   La feature 'PlotF...
108
        return { "param_nb_points": list };
1f9f9178   Menouard AZIB   I have created a ...
109
110
    },

5b411da5   Menouard AZIB   Adding comments t...
111
112
113
114
115
    /**
     * Mettre à jour le nb_points en fonction de la valeur de start time et stop time passés en paramètres
     * @param {*} startTime le start time issu du ZoomPlugin
     * @param {*} stopTime le stop time issu du ZoomPlugin
     */
eeb3432d   Menouard AZIB   La feature 'PlotF...
116
    setValues: function (startTime, stopTime) {
1f9f9178   Menouard AZIB   I have created a ...
117
118
119
        for (p in this.params) {
            let param = this.params[p];
            const nb_points = (stopTime - startTime) / param.MinSampling;
eeb3432d   Menouard AZIB   La feature 'PlotF...
120
            const ui_item = this.parent.findField(this.label_number_field1 + param.id);
1f9f9178   Menouard AZIB   I have created a ...
121
122
123
124
            ui_item.setValue(parseInt(nb_points));
        }
    }
});