Commit fac46f96e1d1d064db7c24f5357c7961a24f5683

Authored by Benjamin Renard
1 parent 6abb8fd7

Cleanup

Showing 1 changed file with 80 additions and 138 deletions   Show diff stats
js/app/views/PlotUI.js
... ... @@ -80,17 +80,17 @@ Ext.define('amdaUI.PlotUI', {
80 80 plotTab.doPlot();
81 81 },
82 82  
83   - /**
84   - * Check if changes were made before closing window
85   - * @return false
86   - */
87   - fclose : function() {
88   - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
89   - if (module)
90   - module.closeInteractiveSession();
91   -
92   - return this.object.isDirty();
93   - },
  83 + /**
  84 + * Check if changes were made before closing window
  85 + * @return false
  86 + */
  87 + fclose : function() {
  88 + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  89 + if (module)
  90 + module.closeInteractiveSession();
  91 +
  92 + return this.object.isDirty();
  93 + },
94 94  
95 95 /**
96 96 * update time selector of this.object from form
... ... @@ -102,7 +102,7 @@ Ext.define('amdaUI.PlotUI', {
102 102 addTT : function(newTTName,newTTid,timeSelectorId) {
103 103 var crtTimeSelector = Ext.getCmp(timeSelectorId);
104 104 if (crtTimeSelector)
105   - crtTimeSelector.addTT(newTTName,newTTid);
  105 + crtTimeSelector.addTT(newTTName,newTTid);
106 106 },
107 107  
108 108 /**
... ... @@ -119,138 +119,80 @@ Ext.define('amdaUI.PlotUI', {
119 119 plotTab.setTime(dateStart, dateStop);
120 120 },
121 121  
122   - keepOnlySelectedTabInObject: function(showWarning, onSuccess) {
123   - if (this.object.tabs().count() == 1) {
124   - if (onSuccess) {
125   - onSuccess();
126   - }
127   - return;
128   - }
129   -
130   - var me = this;
131   - var removeFunc = function() {
132   - var tabsToRemove = [];
133   - var selectedTabFound = false;
134   - me.object.tabs().each(function(tab) {
135   - if (tab.get('id') != me.object.get('active-tab-id')) {
136   - tabsToRemove.push(tab);
137   - }
138   - else {
139   - selectedTabFound = true;
140   - }
141   - });
142   - if (!selectedTabFound) {
143   - myDesktopApp.errorMsg('Cannot retrieve selected tab');
144   - return false;
145   - }
146   - if (tabsToRemove.length > 0) {
147   - me.object.tabs().remove(tabsToRemove);
148   - }
149   - return true;
150   - };
151   -
152   - if (!showWarning) {
153   - if (removeFunc()) {
154   - if (onSuccess) {
155   - onSuccess();
156   - }
157   - }
158   - return;
159   - }
160   -
161   -
162   - Ext.Msg.show( { title : 'Warning',
163   - msg: 'Active plot will be saved, but other ones will be lost.<br/>Do you want to continue?',
164   - width: 300,
165   - buttons: Ext.Msg.OKCANCEL,
166   - fn: function(btn) {
167   - if (btn == 'cancel') return;
168   -
169   - if (removeFunc()) {
170   - if (onSuccess) {
171   - onSuccess();
172   - }
173   - }
174   - return;
175   - },
176   - scope: me
177   - });
178   - },
179   -
180 122 savePlotRequest : function() {
181 123 var plotTab = this.plotTabs.getCurrentPlotTabContent();
182 124 if (plotTab)
183 125 plotTab.savePlot();
184 126 },
185 127  
186   - init : function(config) {
187   - this.plotTabs = new amdaPlotComp.PlotTabPanel({plotUI : this});
  128 + init : function(config) {
  129 + this.plotTabs = new amdaPlotComp.PlotTabPanel({plotUI : this});
188 130  
189   - this.formPanel = new Ext.form.Panel({
190   - region: 'center',
191   - layout: 'fit',
192   - bodyStyle: { background : '#dfe8f6' },
193   - defaults: {
194   - border: false
195   - },
196   - items: [
197   - this.plotTabs
198   - ],
199   - fbar: [
200   - {
201   - xtype: 'button',
202   - text: 'Plot',
203   - scope: this,
204   - handler: function(button) {
205   - this.doPlot();
206   - }
207   - },' ', {
208   - xtype: 'button',
209   - text: 'Get Data',
210   - scope: this,
211   - handler: function(button) {
212   - this.getDataProcess();
213   - }
214   - },' ', {
215   - xtype: 'button',
216   - text: 'Reset',
217   - scope: this,
218   - handler: function(button) {
219   - this.resetProcess();
220   - }
221   - },'->', '-', {
222   - xtype: 'button',
223   - text: 'Save',
224   - scope: this,
225   - handler: function(button) {
226   - this.savePlotRequest();
227   - }
228   - }
229   - ]
230   - });
  131 + this.formPanel = new Ext.form.Panel({
  132 + region: 'center',
  133 + layout: 'fit',
  134 + bodyStyle: { background : '#dfe8f6' },
  135 + defaults: {
  136 + border: false
  137 + },
  138 + items: [
  139 + this.plotTabs
  140 + ],
  141 + fbar: [
  142 + {
  143 + xtype: 'button',
  144 + text: 'Plot',
  145 + scope: this,
  146 + handler: function(button) {
  147 + this.doPlot();
  148 + }
  149 + },' ', {
  150 + xtype: 'button',
  151 + text: 'Get Data',
  152 + scope: this,
  153 + handler: function(button) {
  154 + this.getDataProcess();
  155 + }
  156 + },' ', {
  157 + xtype: 'button',
  158 + text: 'Reset',
  159 + scope: this,
  160 + handler: function(button) {
  161 + this.resetProcess();
  162 + }
  163 + },'->', '-', {
  164 + xtype: 'button',
  165 + text: 'Save',
  166 + scope: this,
  167 + handler: function(button) {
  168 + this.savePlotRequest();
  169 + }
  170 + }
  171 + ]
  172 + });
  173 +
  174 + var myConf = {
  175 + layout: 'border',
  176 + items: [
  177 + this.formPanel,
  178 + {
  179 + xtype: 'panel',
  180 + region: 'south',
  181 + title: 'Information',
  182 + collapsible: true,
  183 + collapseMode: 'header',
  184 + height: 100,
  185 + autoHide: false,
  186 + bodyStyle: 'padding:5px',
  187 + iconCls: 'icon-information',
  188 + loader: {
  189 + autoLoad: true,
  190 + url: helpDir+'plotHOWTO'
  191 + }
  192 + }
  193 + ]
  194 + };
231 195  
232   - var myConf = {
233   - layout: 'border',
234   - items: [
235   - this.formPanel,
236   - {
237   - xtype: 'panel',
238   - region: 'south',
239   - title: 'Information',
240   - collapsible: true,
241   - collapseMode: 'header',
242   - height: 100,
243   - autoHide: false,
244   - bodyStyle: 'padding:5px',
245   - iconCls: 'icon-information',
246   - loader: {
247   - autoLoad: true,
248   - url: helpDir+'plotHOWTO'
249   - }
250   - }
251   - ]
252   - };
253   -
254   - Ext.apply(this, Ext.apply(arguments, myConf));
255   - }
  196 + Ext.apply(this, Ext.apply(arguments, myConf));
  197 + }
256 198 });
... ...