From 2dc9b65ae662b182fce26b12f0c2b03bccf63f5b Mon Sep 17 00:00:00 2001 From: Menouar AZIB <menouar.azib@akka.eu> Date: Mon, 23 Oct 2023 14:24:44 +0200 Subject: [PATCH] All refactored cmpts works well --- js/app/views/PlotComponents/PlotZoomPlug.js | 19 +++++++++++-------- js/app/views/PlotComponents/intervalSelection/DateZoomIntervalSelection.js | 2 +- js/app/views/PlotComponents/intervalSelection/IntervalSelection.js | 30 +++++++++++++++++++++++++----- js/app/views/PlotComponents/intervalSelection/NumberZoomIntervalSelection.js | 5 ++++- js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js | 1 + js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js | 4 ++++ 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/js/app/views/PlotComponents/PlotZoomPlug.js b/js/app/views/PlotComponents/PlotZoomPlug.js index e96e321..a327cad 100644 --- a/js/app/views/PlotComponents/PlotZoomPlug.js +++ b/js/app/views/PlotComponents/PlotZoomPlug.js @@ -17,8 +17,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { extend: 'Ext.util.Observable', alias: 'plugin.plotZoomPlugin', - requires: ['amdaPlotComp.intervalSelection.IntervalSelection', - 'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType', 'amdaPlotComp.plotFunction.CreatePlot'], + requires: ['amdaPlotComp.intervalSelection.IntervalSelection', 'amdaPlotComp.plotFunction.FunctionType'], //id: 'plot-zoom-plug', @@ -95,7 +94,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { this.zoomType = zoomType; this.panelId = panelId; this.interactiveId = interactiveId; - + let config = { id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(), // Plot window ID interactiveId: interactiveId, @@ -131,15 +130,19 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { break; case 'y-left': case 'y-right': + case 'xaxis_id': winType = 'amdaPlotComp.intervalSelection.NumberZoomIntervalSelection'; - const title = this.zoomType === 'y-left' ? 'Zoom on Y Left axis' : 'Zoom on Y Right axis'; + let title = ""; + if (this.zoomType === 'y-left') { + title = 'Zoom on Y Left axis'; + } else if (this.zoomType === 'y-right') { + title = 'Zoom on Y Right axis'; + } else { + title = 'Zoom on X axis'; + } config["type"] = this.zoomType; config["title"] = title; break; - case 'xaxis_id': - winType = 'amdaPlotComp.intervalSelection.NumberZoomIntervalSelection'; - title = 'Zoom on X axis'; - break; case 'plotFunction': winType = 'amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection'; break; diff --git a/js/app/views/PlotComponents/intervalSelection/DateZoomIntervalSelection.js b/js/app/views/PlotComponents/intervalSelection/DateZoomIntervalSelection.js index a82369b..5f265f8 100644 --- a/js/app/views/PlotComponents/intervalSelection/DateZoomIntervalSelection.js +++ b/js/app/views/PlotComponents/intervalSelection/DateZoomIntervalSelection.js @@ -8,7 +8,7 @@ Ext.define('amdaPlotComp.intervalSelection.DateZoomIntervalSelection', { initComponent: function () { this.callParent(arguments); - this.insertToTTCatlog = new amdaPlotComp.intervalSelection.InsertToTTCatlog({parent: this}); + this.insertToTTCatlog = new amdaPlotComp.intervalSelection.InsertToTTCatlog({ parent: this }); this.parent.add(this.insertToTTCatlog); }, diff --git a/js/app/views/PlotComponents/intervalSelection/IntervalSelection.js b/js/app/views/PlotComponents/intervalSelection/IntervalSelection.js index 2adf84e..792d570 100644 --- a/js/app/views/PlotComponents/intervalSelection/IntervalSelection.js +++ b/js/app/views/PlotComponents/intervalSelection/IntervalSelection.js @@ -1,5 +1,3 @@ - - // Define a constant for the layout style of the form const LAYOUT_STYLE = { type: 'vbox', // vertical box layout @@ -7,6 +5,7 @@ const LAYOUT_STYLE = { align: 'stretch' // each child item is stretched to fill the width of the container }; +// Width of button const width = 100; // Define the parent class @@ -39,6 +38,7 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', { // These will be used to reference the fields later in the code FIELD1_ITEM_ID: 'field1', FIELD2_ITEM_ID: 'field2', + buttonUseTime: 'button-use-time', initComponent: function () { const me = this; // Reference to this instance for use in event handlers @@ -88,19 +88,22 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', { handler: function () { me._getField1().reset(); me._getField2().reset(); + me._resetHostCmpSelection(); } - }, { + }, + { xtype: 'button', text: 'Use in Time Selection', + itemId: this.buttonUseTime, handler: function () { - alert('Button 2 clicked'); + me._setTimeInterval(); } }] }], fbar: [ { xtype: 'button', - width: 100, + width: width, text: this.buttonApply, handler: function () { me._apply(); @@ -117,6 +120,9 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', { this.callParent(arguments); }, + _resetHostCmpSelection: function () { + this.hostCmp.panelImage.resetZoom(); + }, _apply: function () { }, @@ -146,5 +152,19 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', { setField2Value: function (value) { this._getField2().setValue(value); + }, + + _setTimeInterval: function () { + const timeObj = new Object(); + timeObj.start = this.getField1Value(); + timeObj.stop = this.getField2Value(); + timeObj.interactiveId = this.interactiveId; + const plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); + plotModule.setTimeInterval(timeObj); + }, + + _removeUseTimeButton: function () { + const buttonToHide = this.parent.down('#' + this.buttonUseTime); + buttonToHide.hide(); } }); diff --git a/js/app/views/PlotComponents/intervalSelection/NumberZoomIntervalSelection.js b/js/app/views/PlotComponents/intervalSelection/NumberZoomIntervalSelection.js index dbb89cf..b081506 100644 --- a/js/app/views/PlotComponents/intervalSelection/NumberZoomIntervalSelection.js +++ b/js/app/views/PlotComponents/intervalSelection/NumberZoomIntervalSelection.js @@ -9,5 +9,8 @@ Ext.define('amdaPlotComp.intervalSelection.NumberZoomIntervalSelection', { field2Format: null, type: null, - + initComponent: function () { + this.callParent(arguments); + this._removeUseTimeButton(); + } }); diff --git a/js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js b/js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js index 2e1d93d..e452203 100644 --- a/js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js +++ b/js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js @@ -26,6 +26,7 @@ Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', { }); this.hostCmp.callInteractivePlot(request_to_send); + this._resetHostCmpSelection(); } }, diff --git a/js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js b/js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js index 9e7ad03..e6ab073 100644 --- a/js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js +++ b/js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js @@ -29,6 +29,8 @@ Ext.define('amdaPlotComp.intervalSelection.ZoomIntervalSelection', { 'min': this.getField1Value(), 'max': this.getField2Value() }); + + this._resetHostCmpSelection(); } }, @@ -39,6 +41,8 @@ Ext.define('amdaPlotComp.intervalSelection.ZoomIntervalSelection', { 'panelId': this.panelId, 'axeId': this.type }); + + this._resetHostCmpSelection(); } }); -- libgit2 0.21.2