Commit 2dc9b65ae662b182fce26b12f0c2b03bccf63f5b

Authored by Menouar AZIB
1 parent 7587a677

All refactored cmpts works well

js/app/views/PlotComponents/PlotZoomPlug.js
... ... @@ -17,8 +17,7 @@
17 17 Ext.define('amdaPlotComp.PlotZoomPlug', {
18 18 extend: 'Ext.util.Observable',
19 19 alias: 'plugin.plotZoomPlugin',
20   - requires: ['amdaPlotComp.intervalSelection.IntervalSelection',
21   - 'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType', 'amdaPlotComp.plotFunction.CreatePlot'],
  20 + requires: ['amdaPlotComp.intervalSelection.IntervalSelection', 'amdaPlotComp.plotFunction.FunctionType'],
22 21  
23 22 //id: 'plot-zoom-plug',
24 23  
... ... @@ -95,7 +94,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
95 94 this.zoomType = zoomType;
96 95 this.panelId = panelId;
97 96 this.interactiveId = interactiveId;
98   -
  97 +
99 98 let config = {
100 99 id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(), // Plot window ID
101 100 interactiveId: interactiveId,
... ... @@ -131,15 +130,19 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
131 130 break;
132 131 case 'y-left':
133 132 case 'y-right':
  133 + case 'xaxis_id':
134 134 winType = 'amdaPlotComp.intervalSelection.NumberZoomIntervalSelection';
135   - const title = this.zoomType === 'y-left' ? 'Zoom on Y Left axis' : 'Zoom on Y Right axis';
  135 + let title = "";
  136 + if (this.zoomType === 'y-left') {
  137 + title = 'Zoom on Y Left axis';
  138 + } else if (this.zoomType === 'y-right') {
  139 + title = 'Zoom on Y Right axis';
  140 + } else {
  141 + title = 'Zoom on X axis';
  142 + }
136 143 config["type"] = this.zoomType;
137 144 config["title"] = title;
138 145 break;
139   - case 'xaxis_id':
140   - winType = 'amdaPlotComp.intervalSelection.NumberZoomIntervalSelection';
141   - title = 'Zoom on X axis';
142   - break;
143 146 case 'plotFunction':
144 147 winType = 'amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection';
145 148 break;
... ...
js/app/views/PlotComponents/intervalSelection/DateZoomIntervalSelection.js
... ... @@ -8,7 +8,7 @@ Ext.define('amdaPlotComp.intervalSelection.DateZoomIntervalSelection', {
8 8  
9 9 initComponent: function () {
10 10 this.callParent(arguments);
11   - this.insertToTTCatlog = new amdaPlotComp.intervalSelection.InsertToTTCatlog({parent: this});
  11 + this.insertToTTCatlog = new amdaPlotComp.intervalSelection.InsertToTTCatlog({ parent: this });
12 12 this.parent.add(this.insertToTTCatlog);
13 13 },
14 14  
... ...
js/app/views/PlotComponents/intervalSelection/IntervalSelection.js
1   -
2   -
3 1 // Define a constant for the layout style of the form
4 2 const LAYOUT_STYLE = {
5 3 type: 'vbox', // vertical box layout
... ... @@ -7,6 +5,7 @@ const LAYOUT_STYLE = {
7 5 align: 'stretch' // each child item is stretched to fill the width of the container
8 6 };
9 7  
  8 +// Width of button
10 9 const width = 100;
11 10  
12 11 // Define the parent class
... ... @@ -39,6 +38,7 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', {
39 38 // These will be used to reference the fields later in the code
40 39 FIELD1_ITEM_ID: 'field1',
41 40 FIELD2_ITEM_ID: 'field2',
  41 + buttonUseTime: 'button-use-time',
42 42  
43 43 initComponent: function () {
44 44 const me = this; // Reference to this instance for use in event handlers
... ... @@ -88,19 +88,22 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', {
88 88 handler: function () {
89 89 me._getField1().reset();
90 90 me._getField2().reset();
  91 + me._resetHostCmpSelection();
91 92 }
92   - }, {
  93 + },
  94 + {
93 95 xtype: 'button',
94 96 text: 'Use in Time Selection',
  97 + itemId: this.buttonUseTime,
95 98 handler: function () {
96   - alert('Button 2 clicked');
  99 + me._setTimeInterval();
97 100 }
98 101 }]
99 102 }],
100 103 fbar: [
101 104 {
102 105 xtype: 'button',
103   - width: 100,
  106 + width: width,
104 107 text: this.buttonApply,
105 108 handler: function () {
106 109 me._apply();
... ... @@ -117,6 +120,9 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', {
117 120 this.callParent(arguments);
118 121 },
119 122  
  123 + _resetHostCmpSelection: function () {
  124 + this.hostCmp.panelImage.resetZoom();
  125 + },
120 126  
121 127 _apply: function () { },
122 128  
... ... @@ -146,5 +152,19 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', {
146 152  
147 153 setField2Value: function (value) {
148 154 this._getField2().setValue(value);
  155 + },
  156 +
  157 + _setTimeInterval: function () {
  158 + const timeObj = new Object();
  159 + timeObj.start = this.getField1Value();
  160 + timeObj.stop = this.getField2Value();
  161 + timeObj.interactiveId = this.interactiveId;
  162 + const plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  163 + plotModule.setTimeInterval(timeObj);
  164 + },
  165 +
  166 + _removeUseTimeButton: function () {
  167 + const buttonToHide = this.parent.down('#' + this.buttonUseTime);
  168 + buttonToHide.hide();
149 169 }
150 170 });
... ...
js/app/views/PlotComponents/intervalSelection/NumberZoomIntervalSelection.js
... ... @@ -9,5 +9,8 @@ Ext.define('amdaPlotComp.intervalSelection.NumberZoomIntervalSelection', {
9 9 field2Format: null,
10 10  
11 11 type: null,
12   -
  12 + initComponent: function () {
  13 + this.callParent(arguments);
  14 + this._removeUseTimeButton();
  15 + }
13 16 });
... ...
js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js
... ... @@ -26,6 +26,7 @@ Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', {
26 26 });
27 27  
28 28 this.hostCmp.callInteractivePlot(request_to_send);
  29 + this._resetHostCmpSelection();
29 30 }
30 31 },
31 32  
... ...
js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js
... ... @@ -29,6 +29,8 @@ Ext.define('amdaPlotComp.intervalSelection.ZoomIntervalSelection', {
29 29 'min': this.getField1Value(),
30 30 'max': this.getField2Value()
31 31 });
  32 +
  33 + this._resetHostCmpSelection();
32 34 }
33 35 },
34 36  
... ... @@ -39,6 +41,8 @@ Ext.define('amdaPlotComp.intervalSelection.ZoomIntervalSelection', {
39 41 'panelId': this.panelId,
40 42 'axeId': this.type
41 43 });
  44 +
  45 + this._resetHostCmpSelection();
42 46 }
43 47  
44 48 });
... ...