Blame view

js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js 1.9 KB
1591d4c2   Menouard AZIB   Basic functionali...
1
2
3
4
5
6
Ext.define('amdaPlotComp.intervalSelection.ZoomIntervalSelection', {
    extend: 'amdaPlotComp.intervalSelection.IntervalSelection', // This class extends from amdaPlotComp.intervalSelection.IntervalSelection

    buttonApply: "Apply Zoom",
    type: null,

7b6efa6c   Menouard AZIB   Add comments to Z...
7
8
9
10
    /**
     * Initializes the component.
     * Adds an 'Undo Zoom' button to the bottom toolbar of the form.
     */
1591d4c2   Menouard AZIB   Basic functionali...
11
    initComponent: function () {
9ea5aa6b   Menouard AZIB   Add comments to I...
12
        const self = this;
1591d4c2   Menouard AZIB   Basic functionali...
13
        this.callParent(arguments);
9ea5aa6b   Menouard AZIB   Add comments to I...
14
        this.form.getDockedItems('toolbar[dock="bottom"]')[0].add({
1591d4c2   Menouard AZIB   Basic functionali...
15
            xtype: 'button',
aba2eb97   Menouard AZIB   Add InsertToTTCat...
16
            width: width,
1591d4c2   Menouard AZIB   Basic functionali...
17
18
            text: 'Undo Zoom',
            handler: function () {
9ea5aa6b   Menouard AZIB   Add comments to I...
19
                self._undoZoom();
1591d4c2   Menouard AZIB   Basic functionali...
20
21
22
23
            }
        });
    },

7b6efa6c   Menouard AZIB   Add comments to Z...
24
25
26
27
28
    /**
     * Applies the zoom based on the values of the fields.
     * If the values are not valid, it shows a warning message.
     * Otherwise, it calls the interactive plot with the zoom action and resets the host component selection.
     */
1591d4c2   Menouard AZIB   Basic functionali...
29
30
31
32
33
34
35
36
37
38
39
40
    _apply: function () {
        if (this._notValidValues()) {
            myDesktopApp.warningMsg('The Input Values are not defined');
        } else {
            this.hostCmp.callInteractivePlot({
                'action': 'zoom',
                'interactiveId': this.interactiveId,
                'panelId': this.panelId,
                'axeId': this.type,
                'min': this.getField1Value(),
                'max': this.getField2Value()
            });
2dc9b65a   Menouard AZIB   All refactored cm...
41
42

            this._resetHostCmpSelection();
1591d4c2   Menouard AZIB   Basic functionali...
43
44
45
        }
    },

7b6efa6c   Menouard AZIB   Add comments to Z...
46
47
48
49
    /**
     * Undoes the zoom.
     * It calls the interactive plot with the undozoom action and resets the host component selection.
     */
1591d4c2   Menouard AZIB   Basic functionali...
50
51
52
53
54
55
56
    _undoZoom: function () {
        this.hostCmp.callInteractivePlot({
            'action': 'undozoom',
            'interactiveId': this.interactiveId,
            'panelId': this.panelId,
            'axeId': this.type
        });
2dc9b65a   Menouard AZIB   All refactored cm...
57
58

        this._resetHostCmpSelection();
1591d4c2   Menouard AZIB   Basic functionali...
59
60
61
    }

});