Commit d4a8d4625cad537068a7fd8dcb0b633e32bc2421

Authored by Benjamin Renard
1 parent 9a89081f

Improve MultiPlotUI (#8314)

js/app/controllers/PlotModule.js
... ... @@ -270,11 +270,13 @@ Ext.define('amdaDesktop.PlotModule', {
270 270 listeners: {
271 271 beforeclose: function(win,opt) {
272 272 me.multiPlotWin = null;
  273 + me.getUiContent().enableSinglePlot(true);
273 274 }
274 275 }
275 276 });
276 277 }
277 278  
  279 + this.getUiContent().enableSinglePlot(false);
278 280 this.multiPlotWin.show();
279 281  
280 282 },
... ... @@ -283,6 +285,7 @@ Ext.define('amdaDesktop.PlotModule', {
283 285 if (this.multiPlotWin) {
284 286 this.multiPlotWin.items.items[0].refreshMultiPlot();
285 287 }
  288 + this.getUiContent().enableSinglePlot(!this.isMultiPlot());
286 289 },
287 290  
288 291 isMultiPlot : function() {
... ...
js/app/views/MultiPlotUI.js
... ... @@ -14,7 +14,6 @@ Ext.define('amdaUI.MultiPlotUI', {
14 14 plotWin: null,
15 15  
16 16 timeSelector: null,
17   - newInteractiveSessionCheck: null,
18 17 plotSelector: null,
19 18  
20 19 constructor: function(config) {
... ... @@ -54,6 +53,17 @@ Ext.define('amdaUI.MultiPlotUI', {
54 53 return false;
55 54 }
56 55  
  56 + // At least one plot must be selected
  57 + var nbSelected = 0;
  58 + this.plotSelector.items.each(function(item) {
  59 + if (item.checked)
  60 + ++nbSelected;
  61 + });
  62 + if (nbSelected == 0) {
  63 + myDesktopApp.errorMsg('At least one Plot must be selected');
  64 + return false;
  65 + }
  66 +
57 67 // Execute multiplot request
58 68 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
59 69 plotModule.linkedNode.execute();
... ... @@ -63,16 +73,14 @@ Ext.define('amdaUI.MultiPlotUI', {
63 73 var me = this;
64 74  
65 75 this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiplot-time-selector', border : false, collapsible: false, height: 180} );
66   - this.newInteractiveSessionCheck = Ext.create('Ext.form.Checkbox', {
67   - xtype: 'checkbox',
68   - boxLabel: 'New Interactive Session for Selected Plot Requests'
69   - });
70 76 this.plotSelector = Ext.create('Ext.form.CheckboxGroup', {
71 77 xtype: 'checkboxgroup',
72 78 flex: 1,
73 79 columns: 3,
74 80 minHeight: 40,
75   - autoScroll: true
  81 + autoScroll: true,
  82 + fieldLabel: 'Select plots to synchronize',
  83 + labelAlign: 'top'
76 84 });
77 85 var myConf = {
78 86 layout: {
... ... @@ -82,7 +90,6 @@ Ext.define('amdaUI.MultiPlotUI', {
82 90 },
83 91 items: [
84 92 this.plotSelector,
85   - this.newInteractiveSessionCheck,
86 93 this.timeSelector
87 94 ],
88 95 listeners: {
... ...
js/app/views/PlotComponents/PlotTabContent.js
... ... @@ -195,6 +195,10 @@ Ext.define('amdaPlotComp.PlotTabContent', {
195 195 this.plotNode = plotNode;
196 196 },
197 197  
  198 + enableTimeSelection : function(enable) {
  199 + this.timeSelector.setDisabled(!enable);
  200 + },
  201 +
198 202 init : function(config) {
199 203 this.setPlotNode(config.plotNode);
200 204 this.tabIndex = config.tabIndex;
... ...
js/app/views/PlotComponents/PlotTabPanel.js
... ... @@ -212,6 +212,14 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
212 212 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
213 213 plotModule.refreshMultiPlot();
214 214 },
  215 +
  216 + enableTimeSelection: function(enable)
  217 + {
  218 + for (i = 0; i < this.items.getCount(); ++i)
  219 + {
  220 + this.items.getAt(i).items.getAt(0).enableTimeSelection(enable);
  221 + }
  222 + },
215 223  
216 224 init : function(config) {
217 225 var me = this;
... ...
js/app/views/PlotUI.js
... ... @@ -147,6 +147,13 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
147 147 plotTab.savePlot();
148 148 }
149 149 },
  150 +
  151 + enableSinglePlot : function(enable) {
  152 + var plotButton = this.queryById('single-plot-button');
  153 + plotButton.setDisabled(!enable);
  154 + plotButton.setTooltip(enable ? 'Plot request' : 'Multiplot is enabled');
  155 + this.plotTabs.enableTimeSelection(enable);
  156 + },
150 157  
151 158 init : function(config) {
152 159 this.plotTabs = new amdaPlotComp.PlotTabPanel({plotUI : this});
... ... @@ -165,6 +172,7 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
165 172 {
166 173 xtype: 'button',
167 174 text: 'Plot',
  175 + id: 'single-plot-button',
168 176 scope: this,
169 177 handler: function(button) {
170 178 this.doPlot();
... ...