PlotFunctionIntervalSelection.js
1.82 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
Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', {
extend: 'amdaPlotComp.intervalSelection.IntervalSelection', // This class extends from amdaPlotComp.intervalSelection.IntervalSelection
requires: ['amdaPlotComp.plotFunction.FunctionType'], // This class requires the FunctionType class from amdaPlotComp.plotFunction
title: "Plot Function", // The title of the window
plotFunctionType: null, // An instance of the FunctionType class, initially set to null
/**
* Initializes the component.
* It calls the parent's initComponent method, then creates a new instance of FunctionType and adds it to the form.
*/
initComponent: function () {
this.callParent(arguments);
this.plotFunctionType = new amdaPlotComp.plotFunction.FunctionType();
this.form.add(this.plotFunctionType);
},
/**
* Applies the plot function 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 plotFunction action and resets the host component selection.
*/
_apply: function () {
if (this._notValidValues()) {
myDesktopApp.warningMsg('Please note that either the Start Time or the Stop Time has not been defined. To proceed, ensure both times are properly set.');
} else {
const request_to_send = Object.assign({}, this.plotFunctionType.getValues(), {
'action': 'plotFunction',
'interactiveId': this.interactiveId,
'panelId': this.panelId,
'starttime': this.getField1Value(),
'stoptime': this.getField2Value(),
});
this.hostCmp.callInteractivePlot(request_to_send);
this._resetHostCmpSelection();
}
},
});