Blame view

js/app/views/PlotComponents/plotFunction/FFTCmpt.js 1.71 KB
afd835e1   Menouard AZIB   Refactoring of Pl...
1
Ext.define('amdaPlotComp.plotFunction.FFTCmpt', {
9150eb42   Menouard AZIB   Add comments to F...
2
3
4
5
6
7
8
9
    extend: 'amdaPlotComp.plotFunction.BaseComponent', // This class extends from amdaPlotComp.plotFunction.BaseComponent
    title: "FFT Arguments", // The title of this component
    id: 'fftComboBox', // The id of this component

    /**
     * Initializes the component.
     * It creates a combo box with two options, 'Frequency' and 'Period', and adds it to the component.
     */
afd835e1   Menouard AZIB   Refactoring of Pl...
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
    initComponent: function () {
        const me = this;

        // Define combo box store
        const comboStore = Ext.create('Ext.data.Store', {
            fields: ['label', 'value'],
            data: [
                { label: 'Frequency', value: 'Frequency' },
                { label: 'Period', value: 'Period' }
            ]
        });

        // Create combo box
        const fftCombo = Ext.create('Ext.form.field.ComboBox', {
            itemId: me.id, // Add itemId here
            fieldLabel: 'Abscisse',
            store: comboStore,
            queryMode: 'local',
            displayField: 'label',
            valueField: 'value',
            editable: false,
            value: 'Frequency'
        });

        // Assign items to the component
        me.items = [fftCombo];

        // Call the parent class's initComponent method
        me.callParent(arguments);
    },

9150eb42   Menouard AZIB   Add comments to F...
41
42
43
44
    /**
     * Retrieves the selected value from the combo box.
     * Returns an object with a property 'abscisse' set to the selected value.
     */
afd835e1   Menouard AZIB   Refactoring of Pl...
45
    getValues: function () {
9150eb42   Menouard AZIB   Add comments to F...
46
        const fftComboBox = this.down('#' + this.id); // Retrieve ComboBox by itemId
afd835e1   Menouard AZIB   Refactoring of Pl...
47
48
49
50
51
52
53
        const selectedValue = fftComboBox.getValue(); // Get selected value

        return {
            abscisse: selectedValue
        };
    }
});