diff --git a/js/app/controllers/PlotModule.js b/js/app/controllers/PlotModule.js index 5f573a6..e35cfb4 100644 --- a/js/app/controllers/PlotModule.js +++ b/js/app/controllers/PlotModule.js @@ -270,11 +270,13 @@ Ext.define('amdaDesktop.PlotModule', { listeners: { beforeclose: function(win,opt) { me.multiPlotWin = null; + me.getUiContent().enableSinglePlot(true); } } }); } + this.getUiContent().enableSinglePlot(false); this.multiPlotWin.show(); }, @@ -283,6 +285,7 @@ Ext.define('amdaDesktop.PlotModule', { if (this.multiPlotWin) { this.multiPlotWin.items.items[0].refreshMultiPlot(); } + this.getUiContent().enableSinglePlot(!this.isMultiPlot()); }, isMultiPlot : function() { diff --git a/js/app/views/MultiPlotUI.js b/js/app/views/MultiPlotUI.js index 304d36e..dc33fe6 100644 --- a/js/app/views/MultiPlotUI.js +++ b/js/app/views/MultiPlotUI.js @@ -14,7 +14,6 @@ Ext.define('amdaUI.MultiPlotUI', { plotWin: null, timeSelector: null, - newInteractiveSessionCheck: null, plotSelector: null, constructor: function(config) { @@ -54,6 +53,17 @@ Ext.define('amdaUI.MultiPlotUI', { return false; } + // At least one plot must be selected + var nbSelected = 0; + this.plotSelector.items.each(function(item) { + if (item.checked) + ++nbSelected; + }); + if (nbSelected == 0) { + myDesktopApp.errorMsg('At least one Plot must be selected'); + return false; + } + // Execute multiplot request var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); plotModule.linkedNode.execute(); @@ -63,16 +73,14 @@ Ext.define('amdaUI.MultiPlotUI', { var me = this; this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiplot-time-selector', border : false, collapsible: false, height: 180} ); - this.newInteractiveSessionCheck = Ext.create('Ext.form.Checkbox', { - xtype: 'checkbox', - boxLabel: 'New Interactive Session for Selected Plot Requests' - }); this.plotSelector = Ext.create('Ext.form.CheckboxGroup', { xtype: 'checkboxgroup', flex: 1, columns: 3, minHeight: 40, - autoScroll: true + autoScroll: true, + fieldLabel: 'Select plots to synchronize', + labelAlign: 'top' }); var myConf = { layout: { @@ -82,7 +90,6 @@ Ext.define('amdaUI.MultiPlotUI', { }, items: [ this.plotSelector, - this.newInteractiveSessionCheck, this.timeSelector ], listeners: { diff --git a/js/app/views/PlotComponents/PlotTabContent.js b/js/app/views/PlotComponents/PlotTabContent.js index 55c8d45..4caa53b 100644 --- a/js/app/views/PlotComponents/PlotTabContent.js +++ b/js/app/views/PlotComponents/PlotTabContent.js @@ -195,6 +195,10 @@ Ext.define('amdaPlotComp.PlotTabContent', { this.plotNode = plotNode; }, + enableTimeSelection : function(enable) { + this.timeSelector.setDisabled(!enable); + }, + init : function(config) { this.setPlotNode(config.plotNode); this.tabIndex = config.tabIndex; diff --git a/js/app/views/PlotComponents/PlotTabPanel.js b/js/app/views/PlotComponents/PlotTabPanel.js index 525ca0b..ee930d7 100644 --- a/js/app/views/PlotComponents/PlotTabPanel.js +++ b/js/app/views/PlotComponents/PlotTabPanel.js @@ -212,6 +212,14 @@ Ext.define('amdaPlotComp.PlotTabPanel', { var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); plotModule.refreshMultiPlot(); }, + + enableTimeSelection: function(enable) + { + for (i = 0; i < this.items.getCount(); ++i) + { + this.items.getAt(i).items.getAt(0).enableTimeSelection(enable); + } + }, init : function(config) { var me = this; diff --git a/js/app/views/PlotUI.js b/js/app/views/PlotUI.js index 24b7149..a821666 100644 --- a/js/app/views/PlotUI.js +++ b/js/app/views/PlotUI.js @@ -147,6 +147,13 @@ Ext.define('amdaUI.PlotUI', { plotTab.savePlot(); } }, + + enableSinglePlot : function(enable) { + var plotButton = this.queryById('single-plot-button'); + plotButton.setDisabled(!enable); + plotButton.setTooltip(enable ? 'Plot request' : 'Multiplot is enabled'); + this.plotTabs.enableTimeSelection(enable); + }, init : function(config) { this.plotTabs = new amdaPlotComp.PlotTabPanel({plotUI : this}); @@ -165,6 +172,7 @@ Ext.define('amdaUI.PlotUI', { { xtype: 'button', text: 'Plot', + id: 'single-plot-button', scope: this, handler: function(button) { this.doPlot(); -- libgit2 0.21.2