Commit 0cefcae2cf186ab267ebe37d58b71731ff541541
1 parent
944871aa
Exists in
master
and in
106 other branches
il reste click droit
Showing
8 changed files
with
1002 additions
and
944 deletions
Show diff stats
js/app/controllers/ExplorerModule.js
... | ... | @@ -292,8 +292,14 @@ Ext.define('amdaDesktop.ExplorerModule', |
292 | 292 | } |
293 | 293 | return this.paramInfoRegistry[paramId] |
294 | 294 | } |
295 | - var patt = new RegExp("ws_"); | |
296 | - if(patt.test(paramId)){ | |
295 | + var pattParam = new RegExp("ws_"); | |
296 | + if(pattParam .test(paramId)){ | |
297 | + var regExp = /\(([\d]+)\)/; | |
298 | + var matches = regExp.exec(paramId); | |
299 | + if(matches) | |
300 | + { | |
301 | + paramId=paramId.substr(0,paramId.length-3); | |
302 | + } | |
297 | 303 | /* case of derived parameter */ |
298 | 304 | AmdaAction.getDerivedParamInfo({paramId: paramId}, function (result, e) { |
299 | 305 | var paramInfo = null |
... | ... | @@ -324,8 +330,7 @@ Ext.define('amdaDesktop.ExplorerModule', |
324 | 330 | // No available info for this parameter, do not display an error message if no success |
325 | 331 | if (result.success) { |
326 | 332 | // Store parameter info in registry |
327 | - me.paramInfoRegistry[paramId] = result | |
328 | - console.log(result); | |
333 | + me.paramInfoRegistry[paramId] = result; | |
329 | 334 | paramInfo = result |
330 | 335 | } |
331 | 336 | } else { | ... | ... |
js/app/models/DerivedParamNode.js
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | Ext.define('amdaModel.DerivedParamComponentNode', { |
12 | - extend: 'Ext.data.Model', | |
12 | + extend: 'amdaModel.InteractiveNode', | |
13 | 13 | |
14 | 14 | text: '', |
15 | 15 | |
... | ... | @@ -20,9 +20,23 @@ Ext.define('amdaModel.DerivedParamComponentNode', { |
20 | 20 | this.set('iconCls', 'icon-scalar'); |
21 | 21 | this.set('leaf',true); |
22 | 22 | this.set('isParameter',true); |
23 | - } | |
24 | -}, function () { | |
25 | - Ext.data.NodeInterface.decorate(this); | |
23 | + }, | |
24 | + localMenuItems : function(){ | |
25 | + var menuItems= | |
26 | + [{ | |
27 | + fnId : 'leaf-plotParam', | |
28 | + text : 'Plot Parameter', | |
29 | + hidden : true | |
30 | + }, { | |
31 | + fnId : 'leaf-downParam', | |
32 | + text : 'Download Parameter', | |
33 | + hidden : true | |
34 | + }] | |
35 | + return menuItems; | |
36 | + }, | |
37 | + getAllContextMenuItems: function(){ | |
38 | + return this.localMenuItems (); | |
39 | +}, | |
26 | 40 | }); |
27 | 41 | |
28 | 42 | Ext.define('amdaModel.DerivedParamNode', { |
... | ... | @@ -73,34 +87,35 @@ Ext.define('amdaModel.DerivedParamNode', { |
73 | 87 | if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3) || |
74 | 88 | (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)) { |
75 | 89 | for (var i = 0; i < this.get('dim_1') *this.get('dim_2'); ++i) { |
76 | - var ch=new amdaModel.DerivedParamComponentNode({text: this.get('text') + '(' + i + ')'}); | |
90 | + var ch=new amdaModel.DerivedParamComponentNode({text: this.get('text') + '(' + i + ')' | |
91 | + }); | |
92 | + | |
77 | 93 | ch.set('nodeType','derivedParam'); |
78 | 94 | this.appendChild(ch); |
79 | 95 | } |
80 | 96 | } |
81 | 97 | }, |
82 | - | |
83 | 98 | localMenuItems : function() { |
84 | - var menuItems = | |
85 | - [{ | |
99 | + var menuItems = | |
100 | + [{ | |
86 | 101 | fnId : 'leaf-plotParam', |
87 | - text : 'Plot Parameter', | |
88 | - hidden : true | |
89 | - }, { | |
90 | - fnId : 'leaf-downParam', | |
91 | - text : 'Download Parameter', | |
92 | - hidden : true | |
93 | - }]; | |
94 | - return menuItems; | |
95 | -}, | |
102 | + text : 'Plot Parameter', | |
103 | + hidden : true | |
104 | + }, { | |
105 | + fnId : 'leaf-downParam', | |
106 | + text : 'Download Parameter', | |
107 | + hidden : true | |
108 | + }]; | |
109 | + return menuItems; | |
110 | + }, | |
96 | 111 | |
97 | -getAllContextMenuItems: function(){ | |
112 | + getAllContextMenuItems: function(){ | |
98 | 113 | |
99 | - var menuItems = this.allMenuItems(); | |
100 | - var locMenuItems = this.localMenuItems(); | |
114 | + var menuItems = this.allMenuItems(); | |
115 | + var locMenuItems = this.localMenuItems(); | |
101 | 116 | |
102 | - return Ext.Array.merge(menuItems,locMenuItems); | |
103 | -}, | |
117 | + return Ext.Array.merge(menuItems,locMenuItems); | |
118 | + }, | |
104 | 119 | |
105 | 120 | isParameter : function(){ |
106 | 121 | return this.get('isParameter'); | ... | ... |
js/app/views/DownloadUI.js
... | ... | @@ -9,807 +9,820 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | Ext.define('amdaUI.DownloadUI', { |
12 | - extend: 'Ext.container.Container', | |
13 | - alias: 'widget.panelDownload', | |
14 | - | |
15 | - requires: [ | |
16 | - 'amdaUI.TimeSelectorUI', | |
17 | - 'amdaUI.ParamArgumentsPlug', | |
18 | - 'amdaUI.SendToSampButtonUI', | |
19 | - 'amdaModel.DownloadParam' | |
20 | - ], | |
21 | - | |
22 | - //Old kernel time formats | |
23 | - //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']], | |
24 | - //New kernel time formats | |
25 | - timeformatData : [['YYYY-MM-DDThh:mm:ss', 'YYYY-MM-DDThh:mm:ss.ms', 'ISO format with msecs'], | |
26 | - ['DD Time', 'YYYYDOYhhmmssms', 'Day-Of-Year, 1 Jan : DOY = 0'], | |
27 | - ['Timestamp', 'Seconds from 1970', 'Total of seconds from the Unix Epoch on January 1st, 1970 at UTC.']], | |
28 | - timeformatTTData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss']], | |
29 | - fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable'],['cdf', 'CDF'],['json', 'JSON']], | |
30 | - fileformatTTData : [['text', 'plain text'], ['vot','VOTable']], | |
31 | - filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']], | |
32 | - filecompressTT : [['zip', 'zip'], ['tar+gzip', 'tar+gzip'], ['none', 'none']], | |
33 | - filestructureData : [['0','All In One File'], ['1','One File Per Time Interval'], ['2','One File Per Param/Interval']], | |
34 | - | |
35 | - constructor: function(config) { | |
36 | - this.init(config); | |
37 | - this.callParent(arguments); | |
38 | - // load object into view | |
39 | - if (this.object) this.loadObject(); | |
40 | - // | |
41 | - var paramArgsPlug = this.getPlugin('download-param-arguments-plugin'); | |
42 | - if (paramArgsPlug) | |
43 | - paramArgsPlug.onApply = this.onApplyParameterArgs; | |
44 | - }, | |
45 | - | |
46 | - addTT : function(newTTName,newTTid) | |
47 | - { | |
48 | - var tabPanel = this.formPanel.down(); | |
49 | - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
50 | - | |
51 | - if (downloadSrc === 0) { | |
52 | - this.timeSelector.addTT(newTTName,newTTid); | |
53 | - } | |
54 | - else { | |
55 | - // search for an existing record in store with this unique name | |
56 | - var existingIndex = this.TTGrid.store.findExact( 'name', newTTName); | |
57 | - // if no corresponding TT found | |
58 | - if (existingIndex == -1){ | |
59 | - // adding the time table to the TTGrid of TT download | |
60 | - var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName }); | |
61 | - this.TTGrid.store.insert(this.TTGrid.store.getCount(),r); | |
62 | - } | |
63 | - } | |
64 | - }, | |
65 | - | |
66 | - addTTs : function(TTarray) { | |
67 | - // set TTTab | |
68 | - this.timeSelector.setTTTab(TTarray); | |
69 | - }, | |
70 | - | |
71 | - // Add TT in download TT module | |
72 | - addTTdownload : function(newTTName,newTTid){ | |
73 | - var tabPanel = this.formPanel.down(); | |
74 | - tabPanel.setActiveTab(1); | |
75 | - this.addTT(newTTName,newTTid); | |
76 | - | |
77 | - }, | |
78 | - | |
79 | - /** | |
80 | - * Set Start-Stop from parameter info (Local & MyData) | |
81 | - */ | |
82 | - setTimeFromData : function(obj) { | |
83 | - if (!obj.start || !obj.stop) | |
84 | - return; | |
85 | - var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | |
86 | - var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | |
87 | - | |
88 | - this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop }); | |
89 | - this.timeSelector.intervalSel.updateDuration(); | |
90 | - }, | |
91 | - | |
92 | - addParam : function(paramId, isLeaf, needArgs, components) | |
93 | - { | |
94 | - // adding the parameter to the paramGrid | |
95 | - var paramObj = { | |
96 | - paramid: paramId, | |
97 | - type: 0, | |
98 | - 'dim1-is-range': false, | |
99 | - 'dim1-min-range': 0., | |
100 | - 'dim1-max-range': 0., | |
101 | - 'dim1-index': '*', | |
102 | - 'dim2-is-range': false, | |
103 | - 'dim2-min-range': 0., | |
104 | - 'dim2-max-range': 0., | |
105 | - 'dim2-index': '*', | |
106 | - template_args: {} | |
107 | - }; | |
108 | - | |
109 | - if (components) { | |
110 | - if (components['index1']) { | |
111 | - paramObj['dim1-index'] = components['index1']; | |
112 | - ++paramObj['type']; | |
113 | - } | |
114 | - | |
115 | - if (components['index2']) { | |
116 | - paramObj['dim2-index'] = components['index2']; | |
117 | - ++paramObj['type']; | |
118 | - } | |
119 | - } | |
120 | - | |
121 | - var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
122 | - var pos = this.paramGrid.store.getCount(); | |
123 | - this.paramGrid.store.insert(pos,r); | |
124 | - this.paramGrid.getView().refresh(); | |
125 | - | |
126 | - if (needArgs) | |
127 | - this.editParameterArgs(r); | |
128 | - }, | |
129 | - | |
130 | - addParams: function(arrayParams) | |
131 | - { | |
132 | - var arrayRec = new Array(); | |
133 | - var index = 1; | |
134 | - if (arrayParams) | |
135 | - { | |
136 | - index = 0; | |
137 | - Ext.Array.each(arrayParams,function(item){ | |
138 | - if (Ext.isObject(item)) { | |
139 | - if (typeof paramId !== 'undefined') | |
140 | - { | |
141 | - // for Parameter Name in Download Module | |
142 | - var paramObj = { | |
143 | - paramid: paramId, | |
144 | - type: 0, | |
145 | - 'dim1-is-range': false, | |
146 | - 'dim1-min-range': 0., | |
147 | - 'dim1-max-range': 0., | |
148 | - 'dim1-index': item.get('dim1'), | |
149 | - 'dim2-is-range': false, | |
150 | - 'dim2-min-range': 0., | |
151 | - 'dim2-max-range': 0., | |
152 | - 'dim2-index': item.get('dim2'), | |
153 | - template_args: {} | |
154 | - }; | |
155 | - | |
156 | - var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
157 | - } | |
158 | - else | |
159 | - { | |
160 | - //for download from get Data in Plot module | |
161 | - var r = Ext.create('amdaModel.DownloadParam', item); | |
162 | - } | |
163 | - | |
164 | - } | |
165 | - else { | |
166 | - // for Download By Request in Operations menu | |
167 | - //TODO BRE - Components selection | |
168 | - var r = Ext.create('amdaModel.DownloadParam', { paramid: item }); | |
169 | - } | |
170 | - arrayRec.push(r); | |
171 | - }); | |
172 | - } | |
173 | - this.paramGrid.getStore().loadData(arrayRec); | |
174 | - }, | |
175 | - | |
176 | - // parameter name -> alias | |
177 | - updateConstruct : function(oldval,newval) { | |
178 | - var index = this.paramGrid.store.findExact('name', oldval); | |
179 | - if (index != -1) { | |
180 | - this.paramGrid.getStore().getAt(index).set('name',newval); | |
181 | - this.paramGrid.getStore().getAt(index).set('text',newval); | |
182 | - } | |
183 | - }, | |
184 | - | |
185 | - setObject : function(obj) { | |
186 | - this.object = obj; | |
187 | - this.loadObject(); | |
188 | - }, | |
189 | - | |
190 | - /** | |
191 | - * update this.object from form | |
192 | - */ | |
193 | - updateObject : function() | |
194 | - { | |
195 | - // get the basic form | |
196 | - var tabPanel = this.formPanel.down(); | |
197 | - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
198 | - var basicForm = this.formPanel.getForm(); | |
199 | - var updateStatus = true; | |
200 | - var values = basicForm.getValues(); | |
201 | - | |
202 | - // data download | |
203 | - if (downloadSrc === 0) | |
204 | - { | |
205 | - var timeformat = values.timeformat; | |
206 | - var timeSource = this.timeSelector.getActiveTimeSource(); | |
207 | - var structure = values.filestructure; | |
208 | - var sampling = values.sampling ? values.sampling : 600; | |
209 | - var refparamSampling = values.refparamsampling == 'on'; | |
210 | - var fileprefix = values.fileprefix ? values.fileprefix : ''; | |
211 | - var fileformat = values.fileformat; | |
212 | - var compression = values.compression; | |
213 | - | |
214 | - var fieldsWithoutName = basicForm.getFields().items; | |
215 | - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | |
216 | - if (!item.isValid()) { | |
217 | - if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | |
218 | - ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { | |
219 | - updateStatus = true; | |
220 | - } | |
221 | - else { | |
222 | - // set update isn't allowed | |
223 | - updateStatus = false; | |
224 | - return false; | |
225 | - } | |
226 | - } | |
227 | - }, this); | |
228 | - | |
229 | - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | |
230 | - && this.timeSelector.TTGrid.getStore().count() == 0) { | |
231 | - myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!' | |
232 | - +'<br>You must add one or choose Time Selection `by Interval`'); | |
233 | - updateStatus = false; | |
234 | - } | |
235 | - | |
236 | - if (updateStatus) | |
237 | - { | |
238 | - /// real object update | |
239 | - // update TimeTable object with the content of form | |
240 | - basicForm.updateRecord(this.object); | |
241 | - this.object.set('timesrc', timeSource); | |
242 | - // set valid intervals into TimeTable object | |
243 | - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) | |
244 | - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); | |
245 | - // set parameters | |
246 | - this.object.set('list',this.paramGrid.getStore().data.items); | |
247 | - this.object.set('structure', structure); | |
248 | - this.object.set('refparamSampling', refparamSampling); | |
249 | - this.object.set('sampling', sampling); | |
250 | - this.object.set('fileprefix',fileprefix); | |
251 | - this.object.set('timeformat',timeformat); | |
252 | - this.object.set('fileformat',fileformat); | |
253 | - this.object.set('compression',compression); | |
254 | - } | |
255 | - } | |
256 | - //TT download | |
257 | - else | |
258 | - { | |
259 | - var timeformat = values.timeformatTT; | |
260 | - var compression = values.compressionTT; | |
261 | - var fileformat = values.fileformatTT; | |
262 | - if (compression === 'none' | |
263 | - && this.TTGrid.getStore().count() > 1) { | |
264 | - myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please'); | |
265 | - updateStatus = false; | |
266 | - } | |
267 | - this.object.set('timeTables',this.TTGrid.getStore().data.items); | |
268 | - this.object.set('timeformatTT',timeformat); | |
269 | - this.object.set('fileformatTT',fileformat); | |
270 | - this.object.set('compressionTT',compression); | |
271 | - } | |
272 | - | |
273 | - this.object.set('downloadSrc',downloadSrc); | |
274 | - // return the update status | |
275 | - return updateStatus; | |
276 | - }, | |
277 | - | |
278 | - /** | |
279 | - * load this.object into form | |
280 | - */ | |
281 | - loadObject : function(){ | |
282 | - | |
283 | - if (!this.object.get('timeformat')) | |
284 | - this.object.set('timeformat', this.timeformatData[0][0]); | |
285 | - | |
286 | - if (!this.object.get('timeformatTT')) | |
287 | - this.object.set('timeformatTT', this.timeformatTTData[0][0]); | |
288 | - | |
289 | - if (!this.object.get('fileformat')) | |
290 | - this.object.set('fileformat', this.fileformatData[0][0]); | |
291 | - | |
292 | - if (!this.object.get('fileformatTT')) | |
293 | - this.object.set('fileformatTT', this.fileformatTTData[0][0]); | |
294 | - | |
295 | - if (!this.object.get('compression')) | |
296 | - this.object.set('compression', this.filecompressData[1][0]); | |
297 | - | |
298 | - if (!this.object.get('compressionTT')) | |
299 | - this.object.set('compressionTT', this.filecompressData[1][0]); | |
300 | - | |
301 | - // load object into form | |
302 | - this.formPanel.getForm().loadRecord(this.object); | |
303 | - // set object's TTs into the timeselector | |
304 | - this.addTTs(this.object.get('timeTables')); | |
305 | - // set parameters | |
306 | - this.addParams(this.object.get('list')); | |
307 | - }, | |
12 | + extend: 'Ext.container.Container', | |
13 | + alias: 'widget.panelDownload', | |
308 | 14 | |
309 | -/** | |
310 | -* download method called by 'Download' button to launch the download process | |
311 | -*/ | |
312 | - doDownload : function(sendToSamp, clientId){ | |
313 | - var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
314 | - if (downloadModule) | |
315 | - downloadModule.linkedNode.execute(sendToSamp, clientId); | |
316 | - }, | |
317 | - | |
318 | - actionItem: function(grid, cell, cellIndex, record, row, recordIndex, e){ | |
319 | - | |
320 | - var isTimeTable = record instanceof amdaModel.TTobject; | |
321 | - | |
322 | - if ( cellIndex == 3 || ( cellIndex == 2 && isTimeTable )) | |
323 | - grid.getStore().remove(record); | |
324 | - else if ( cellIndex == 2 ) { | |
325 | - this.paramGrid.getView().select(row); | |
326 | - this.editParameterArgs(record); | |
327 | - } | |
328 | - }, | |
329 | - | |
330 | - editParameterArgs: function(record) { | |
331 | - var paramArgsPlug = this.getPlugin('download-param-arguments-plugin'); | |
332 | - if (paramArgsPlug) | |
333 | - paramArgsPlug.show('download-param-arguments-plugin', record); | |
334 | - }, | |
335 | - | |
336 | - onApplyParameterArgs : function(parentUI, paramObject) { | |
337 | - parentUI.paramGrid.getView().refresh(); | |
338 | - }, | |
339 | - | |
340 | - onFileStructureChange : function(combo, newValue, oldValue){ | |
341 | - if (!this.formPanel) | |
342 | - return; | |
343 | - | |
344 | - var refParamCheck = this.formPanel.getForm().findField('refparamsampling'); | |
345 | - var samplingField = this.formPanel.getForm().findField('sampling'); | |
346 | - | |
347 | - if (samplingField && newValue !== oldValue) { | |
348 | - refParamCheck.setDisabled(newValue == 2); | |
349 | - samplingField.setDisabled((newValue == 2) || refParamCheck.getValue()); | |
350 | - } | |
351 | - }, | |
352 | - | |
353 | - onRefParamSamplingChange : function(check, newValue, oldValue){ | |
354 | - if (!this.formPanel) | |
355 | - return; | |
356 | - | |
357 | - var samplingField = this.formPanel.getForm().findField('sampling'); | |
358 | - var structureCombo = this.formPanel.getForm().findField('filestructure'); | |
359 | - | |
360 | - if (samplingField && newValue !== oldValue) | |
361 | - samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue()); | |
362 | - }, | |
363 | - | |
364 | - onSendVOTableToSamp : function (clientId, sendOpt){ | |
365 | - var me = sendOpt.scope; | |
366 | - if(me.updateObject()){ | |
367 | - me.doDownload(true, clientId); | |
368 | - } | |
369 | - }, | |
370 | - | |
371 | - /** | |
372 | - * Check if changes were made before closing window | |
373 | - * @return false | |
374 | - */ | |
375 | - fclose : function() { | |
376 | - return false; | |
377 | - }, | |
378 | - | |
379 | - init : function (config){ | |
380 | - var me = this; | |
381 | - | |
382 | - this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector',flex: 1}); | |
383 | - | |
384 | - this.paramGrid = Ext.create('Ext.grid.Panel', { | |
385 | - flex: 2, | |
386 | - store : Ext.create('Ext.data.Store', { model: 'amdaModel.DownloadParam'} ), | |
387 | - columns: [ | |
388 | - { xtype: 'rownumberer', width: 20 }, | |
389 | - { | |
390 | - header: "Parameter Name", | |
391 | - dataIndex: 'name', | |
392 | - flex:1, | |
393 | - sortable: false, | |
394 | - menuDisabled : true , | |
395 | - renderer: function (val, meta, rec) { | |
396 | - return rec.getParamFullName(); | |
397 | - } | |
398 | - }, | |
399 | - { | |
400 | - menuDisabled : true, width: 30, renderer: function(){ | |
401 | - return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>'; | |
402 | - } | |
403 | - }, | |
404 | - { | |
405 | - menuDisabled : true, width: 30, renderer: function(){ | |
406 | - return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
407 | - } | |
408 | - } | |
409 | - ], | |
410 | - //TODO - BRE - Wait the fix for drag&drop issue | |
411 | - listeners : | |
412 | - { | |
413 | - render : function(o,op) | |
414 | - { | |
415 | - var me = this; | |
416 | - var el = me.body.dom; | |
417 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
418 | - ddGroup: 'explorerTree', | |
419 | - notifyEnter : function(ddSource, e, data) { }, | |
420 | - notifyOver : function(ddSource, e, data) | |
421 | - { | |
422 | - if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) | |
423 | - { | |
424 | - this.valid = false; | |
425 | - return this.dropNotAllowed; | |
426 | - } | |
427 | - if (((data.records[0].data.nodeType == 'localParam') || | |
428 | - (data.records[0].data.nodeType == 'remoteParam') || | |
429 | - (data.records[0].data.nodeType == 'remoteSimuParam') || | |
430 | - (data.records[0].data.nodeType == 'derivedParam') || | |
431 | - (data.records[0].data.nodeType == 'myDataParam') || | |
432 | - (data.records[0].data.nodeType == 'alias'))&& | |
433 | - (data.records[0].isLeaf() || data.records[0].data.isParameter) && | |
434 | - !data.records[0].data.disable) | |
435 | - { | |
436 | - this.valid = true; | |
437 | - return this.dropAllowed; | |
438 | - } | |
439 | - | |
440 | - this.valid = false; | |
441 | - return this.dropNotAllowed; | |
442 | - }, | |
443 | - notifyDrop : function(ddSource, e, data) | |
444 | - { | |
445 | - if (!this.valid) | |
446 | - return false; | |
447 | - var idToSent; | |
448 | - var components = null; | |
449 | - switch (data.records[0].data.nodeType) | |
450 | - { | |
451 | - case 'localParam' : | |
452 | - case 'remoteParam': | |
453 | - case 'remoteSimuParam': | |
454 | - idToSent = data.records[0].get('id'); | |
455 | - if (data.records[0].get('alias')!= "" ) | |
456 | - idToSent = "#"+data.records[0].get('alias'); | |
457 | - var component_info = data.records[0].get('component_info'); | |
458 | - if (component_info && component_info.parentId) | |
459 | - { | |
460 | - if ( component_info.index1 || component_info.index2 ) | |
461 | - { | |
462 | - idToSent = component_info.parentId; | |
463 | - components = []; | |
464 | - if (component_info.index1) | |
465 | - components['index1'] = component_info.index1; | |
466 | - if (component_info.index2) | |
467 | - components['index2'] = component_info.index2; | |
468 | - } | |
469 | - if ( data.records[0].get('needsArgs') ) | |
470 | - { | |
471 | - idToSent = component_info.parentId; | |
472 | - if (component_info.index1) | |
473 | - { | |
474 | - components = []; | |
475 | - components['index1'] = component_info.index1; | |
476 | - } | |
477 | - } | |
478 | - } | |
479 | - break; | |
480 | - case 'alias' : | |
481 | - idToSent = "#"+data.records[0].get('text'); | |
482 | - break; | |
483 | - case 'derivedParam' : | |
484 | - idToSent = "ws_"+data.records[0].get('text'); | |
485 | - break; | |
486 | - case 'myDataParam' : | |
487 | - idToSent = "wsd_"+data.records[0].get('text'); | |
488 | - break; | |
489 | - default : | |
490 | - return false; | |
491 | - } | |
492 | - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
493 | - if (downModule) | |
494 | - downModule.addParam(idToSent,data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | |
495 | - return true; | |
496 | - } | |
497 | - }); | |
498 | - } | |
499 | - } | |
500 | - }); | |
501 | - | |
502 | - this.paramGrid.on('cellclick', this.actionItem, this); | |
503 | - | |
504 | - this.TTGrid = Ext.create('Ext.grid.Panel', { | |
505 | - flex: 2, | |
506 | - store : Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}), | |
507 | - columns: [ | |
508 | - { xtype: 'rownumberer', width: 20 }, | |
509 | - { header: "TimeTable/Catalog Name", dataIndex: 'name', flex:1, sortable: false, menuDisabled: true}, | |
510 | - { | |
511 | - menuDisabled : true, width: 30, renderer: function(){ | |
512 | - return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
513 | - } | |
514 | - } | |
515 | - ], | |
516 | - listeners : | |
517 | - { | |
518 | - render : function(o,op) | |
519 | - { | |
520 | - var me = this; | |
521 | - var el = me.body.dom; | |
522 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
523 | - ddGroup: 'explorerTree', | |
524 | - notifyEnter : function(ddSource, e, data) | |
525 | - { | |
526 | - | |
527 | - }, | |
528 | - notifyOver : function(ddSource, e, data) | |
529 | - { | |
530 | - var nodeType = data.records[0].get('nodeType'); | |
531 | - | |
532 | - if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') || | |
533 | - (nodeType == 'catalog' || nodeType == 'sharedCatalog') && | |
534 | - (data.records[0].get('leaf'))) | |
535 | - { | |
536 | - this.valid = true; | |
537 | - return this.dropAllowed; | |
538 | - } | |
539 | - this.valid = false; | |
540 | - return this.dropNotAllowed; | |
541 | - }, | |
542 | - notifyDrop : function(ddSource, e, data) | |
543 | - { | |
544 | - if (!this.valid) | |
545 | - return false; | |
546 | - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
547 | - if (downModule) | |
548 | - downModule.getUiContent().addTTdownload(data.records[0].get('text'),data.records[0].get('id')); | |
549 | - return true; | |
550 | - } | |
551 | - }); | |
552 | - } | |
553 | - } | |
554 | - }); | |
555 | - | |
556 | - this.TTGrid.on('cellclick', this.actionItem, this); | |
557 | - | |
558 | - var store = new Ext.data.ArrayStore({ | |
559 | - fields: ['id', 'name', 'qtip'], | |
560 | - data: this.timeformatData | |
561 | - }); | |
562 | - | |
563 | - this.paramPanel = { | |
564 | - xtype: 'container', | |
565 | - title: 'Parameters', | |
566 | - layout: { | |
567 | - type: 'hbox', | |
568 | - align : 'stretch', | |
569 | - defaultMargins: {top: 10, left:10, bottom: 5, right:10} | |
570 | - }, | |
571 | - items: [ | |
572 | - { | |
573 | - xtype: 'container', | |
574 | - flex: 2, | |
575 | - layout: { | |
576 | - type: 'vbox', | |
577 | - align : 'stretch' | |
578 | - }, | |
579 | - items: [ | |
580 | - { | |
581 | - xtype: 'textfield', | |
582 | - fieldLabel: 'Request Name', | |
583 | - disabled: true, | |
584 | - name : 'name' | |
585 | - }, | |
586 | - { | |
587 | - xtype: 'splitter', | |
588 | - flex: 0.05 | |
589 | - }, | |
590 | - this.paramGrid | |
591 | - ] | |
592 | - }, | |
593 | - { | |
594 | - xtype: 'container', | |
595 | - flex: 2, | |
596 | - defaults : { | |
597 | - xtype : 'combo', | |
598 | - labelWidth: 90, | |
599 | - queryMode: 'local', | |
600 | - editable: false | |
601 | - }, | |
602 | - layout: { | |
603 | - type: 'vbox', | |
604 | - align: 'stretch' | |
605 | - }, | |
606 | - items: [ | |
607 | - { | |
608 | - fieldLabel: 'Time Format', | |
609 | - name: 'timeformat', | |
610 | - valueField: 'id', | |
611 | - displayField: 'name', | |
612 | - queryMode: 'local', | |
613 | - store: store, | |
614 | - listConfig: { | |
615 | - tpl: [ | |
616 | - '<tpl for=".">', | |
617 | - '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>', | |
618 | - '</tpl>' | |
619 | - ] | |
620 | - }, | |
621 | - value: store.first() | |
622 | - }, | |
623 | - { | |
624 | - fieldLabel: 'File Structure', | |
625 | - name: 'filestructure', | |
626 | - store: this.filestructureData, | |
627 | - value: this.filestructureData[2], | |
628 | - listeners : { | |
629 | - change : { fn : this.onFileStructureChange }, | |
630 | - scope: this | |
631 | - } | |
632 | - }, | |
633 | - { | |
634 | - xtype: 'checkbox', boxLabel: 'Header in a separate file', | |
635 | - boxLabelAlign: 'before', | |
636 | - name: 'separateInfoFile', checked: false | |
637 | - | |
638 | - }, | |
639 | - { | |
640 | - xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling', | |
641 | - boxLabelAlign: 'before', | |
642 | - name: 'refparamsampling', checked: false, disabled: true, | |
643 | - listeners : { | |
644 | - change : { fn : this.onRefParamSamplingChange }, | |
645 | - scope : this | |
646 | - } | |
647 | - }, | |
648 | - { | |
649 | - xtype: 'numberfield', name: 'sampling', | |
650 | - fieldLabel: 'Sampling Time', value: 600, | |
651 | - hideTrigger: true, editable: true, | |
652 | - disabled: true | |
653 | - }, | |
654 | - { | |
655 | - xtype : 'checkbox', boxLabel: 'Scientific floating-point formatting', | |
656 | - boxLabelAlign: 'before', | |
657 | - name: 'scientificformat', checked: false | |
658 | - }, | |
659 | - { | |
660 | - xtype: 'textfield', name: 'fileprefix', | |
661 | - fieldLabel: 'File Prefix', | |
662 | - disabled: false, editable: true | |
663 | - }, | |
664 | - { | |
665 | - fieldLabel: 'File Format', | |
666 | - name: 'fileformat', | |
667 | - store: this.fileformatData, | |
668 | - value: this.fileformatData[0] | |
669 | - }, | |
670 | - { | |
671 | - fieldLabel: 'Compression', | |
672 | - name: 'compression', | |
673 | - store: this.filecompressData, | |
674 | - value: this.filecompressData[0] | |
675 | - }, | |
676 | - this.timeSelector | |
677 | - ] | |
678 | - } | |
679 | - ]}; | |
680 | - | |
681 | - this.ttPanel = | |
682 | - { | |
683 | - xtype: 'container', | |
684 | - title: 'Time Tables / Catalogs', | |
685 | - layout: { | |
686 | - type: 'hbox', | |
687 | - align : 'stretch', | |
688 | - defaultMargins: { top: 10, left:10, bottom: 5, right:10 } | |
689 | - }, | |
690 | - items: [ | |
691 | - this.TTGrid, | |
692 | - { | |
693 | - xtype: 'container', | |
694 | - flex: 2, | |
695 | - defaults : { | |
696 | - xtype : 'combo', | |
697 | - labelWidth: 90, | |
698 | - queryMode: 'local', | |
699 | - editable: false | |
700 | - }, | |
701 | - layout: { | |
702 | - type: 'vbox', | |
703 | - align : 'stretch' | |
704 | - }, | |
705 | - items: [{ | |
706 | - fieldLabel:'Time Format', | |
707 | - name:'timeformatTT', | |
708 | - store: this.timeformatTTData, | |
709 | - value: this.timeformatTTData[0] | |
710 | - }, | |
711 | - { | |
712 | - fieldLabel: 'File Format ', | |
713 | - name: 'fileformatTT', | |
714 | - store: this.fileformatTTData, | |
715 | - value: this.fileformatTTData[0] | |
716 | - }, | |
717 | - { | |
718 | - fieldLabel: 'Compression ', | |
719 | - name: 'compressionTT', | |
720 | - store: this.filecompressTT, | |
721 | - value: this.filecompressTT[0] | |
722 | - } | |
723 | - ]} | |
724 | - ] | |
725 | - }; | |
726 | - | |
727 | - this.formPanel = new Ext.form.Panel({ | |
728 | - layout: 'fit', | |
729 | - region: 'center', | |
730 | - bodyStyle: { background : '#dfe8f6' }, | |
731 | - buttonAlign: 'left', | |
732 | - trackResetOnLoad: true, //reset to the last loaded record | |
733 | - defaults: { | |
734 | - border: false | |
735 | - }, | |
736 | - items: [{ | |
737 | - xtype: 'tabpanel', | |
738 | - activeTab : 0, | |
739 | - bodyStyle: { background : '#dfe8f6' }, | |
740 | - items: [ | |
741 | - this.paramPanel, | |
742 | - this.ttPanel | |
743 | - ], | |
744 | - listeners: { | |
745 | - 'tabchange' : function (tabPanel, tab) { | |
746 | - var sampAvailable = (tab.title == me.paramPanel.title); | |
747 | - me.down('sendToSampButton').setDisabled(!sampAvailable); | |
748 | - } | |
749 | - } | |
750 | - }], | |
751 | - fbar: [ | |
752 | - { | |
753 | - text: 'Download', | |
754 | - scope : this, | |
755 | - handler: function(button){ | |
756 | - // if the return is true (object had been updated) | |
757 | - if(this.updateObject()){ | |
758 | - // launch the download process | |
759 | - this.doDownload(); | |
760 | - } | |
761 | - } | |
762 | - }, | |
763 | - { | |
764 | - text: 'Reset', | |
765 | - scope : this, | |
766 | - handler: function(){ | |
767 | - this.formPanel.getForm().reset(); | |
768 | - var tabPanel = this.formPanel.down(); | |
769 | - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
770 | - if (downloadSrc === 0) { | |
771 | - // reset parameters and Time Tables in Get Data | |
772 | - this.paramGrid.store.removeAll(); | |
773 | - this.timeSelector.TTGrid.store.removeAll(); | |
774 | - } | |
775 | - else { | |
776 | - // reset Time Tables in Get time Table | |
777 | - this.TTGrid.store.removeAll(); | |
778 | - } | |
779 | - } | |
780 | - }, | |
781 | - '->', | |
782 | - { | |
783 | - xtype : 'sendToSampButton', | |
784 | - type : 'votable', | |
785 | - onSendToSamp : this.onSendVOTableToSamp, | |
786 | - sendOpt : {scope : this} | |
787 | - }] | |
788 | - }); | |
789 | - | |
790 | - var myConf = { | |
791 | - layout: 'border', | |
792 | - items: [ | |
793 | - this.formPanel, | |
794 | - { | |
795 | - xtype: 'panel', | |
796 | - region: 'south', | |
797 | - title: 'Information', | |
798 | - collapsible: true, | |
799 | - collapseMode: 'header', | |
800 | - height: 100, | |
801 | - autoHide: false, | |
802 | - bodyStyle: 'padding:5px', | |
803 | - iconCls: 'icon-information', | |
804 | - loader: { | |
805 | - autoLoad: true, | |
806 | - url: helpDir + 'downloadHOWTO' | |
807 | - } | |
808 | - } | |
809 | - ], | |
810 | - plugins: [ {ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}] | |
811 | - }; | |
812 | - | |
813 | - Ext.apply (this, Ext.apply(arguments, myConf)); | |
814 | - } | |
15 | + requires: [ | |
16 | + 'amdaUI.TimeSelectorUI', | |
17 | + 'amdaUI.ParamArgumentsPlug', | |
18 | + 'amdaUI.SendToSampButtonUI', | |
19 | + 'amdaModel.DownloadParam' | |
20 | + ], | |
21 | + | |
22 | + //Old kernel time formats | |
23 | + //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']], | |
24 | + //New kernel time formats | |
25 | + timeformatData: [['YYYY-MM-DDThh:mm:ss', 'YYYY-MM-DDThh:mm:ss.ms', 'ISO format with msecs'], | |
26 | + ['DD Time', 'YYYYDOYhhmmssms', 'Day-Of-Year, 1 Jan : DOY = 0'], | |
27 | + ['Timestamp', 'Seconds from 1970', 'Total of seconds from the Unix Epoch on January 1st, 1970 at UTC.']], | |
28 | + timeformatTTData: [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss']], | |
29 | + fileformatData: [['ASCII', 'ASCII'], ['vot', 'VOTable'], ['cdf', 'CDF'], ['json', 'JSON']], | |
30 | + fileformatTTData: [['text', 'plain text'], ['vot', 'VOTable']], | |
31 | + filecompressData: [['zip', 'zip'], ['tar+gzip', 'tar+gzip']], | |
32 | + filecompressTT: [['zip', 'zip'], ['tar+gzip', 'tar+gzip'], ['none', 'none']], | |
33 | + filestructureData: [['0', 'All In One File'], ['1', 'One File Per Time Interval'], ['2', 'One File Per Param/Interval']], | |
34 | + | |
35 | + constructor: function (config) { | |
36 | + this.init(config); | |
37 | + this.callParent(arguments); | |
38 | + // load object into view | |
39 | + if (this.object) | |
40 | + this.loadObject(); | |
41 | + // | |
42 | + var paramArgsPlug = this.getPlugin('download-param-arguments-plugin'); | |
43 | + if (paramArgsPlug) | |
44 | + paramArgsPlug.onApply = this.onApplyParameterArgs; | |
45 | + }, | |
46 | + | |
47 | + addTT: function (newTTName, newTTid) | |
48 | + { | |
49 | + var tabPanel = this.formPanel.down(); | |
50 | + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
51 | + | |
52 | + if (downloadSrc === 0) { | |
53 | + this.timeSelector.addTT(newTTName, newTTid); | |
54 | + } else { | |
55 | + // search for an existing record in store with this unique name | |
56 | + var existingIndex = this.TTGrid.store.findExact('name', newTTName); | |
57 | + // if no corresponding TT found | |
58 | + if (existingIndex == -1) { | |
59 | + // adding the time table to the TTGrid of TT download | |
60 | + var r = Ext.create('amdaModel.TTobject', {id: newTTid, name: newTTName}); | |
61 | + this.TTGrid.store.insert(this.TTGrid.store.getCount(), r); | |
62 | + } | |
63 | + } | |
64 | + }, | |
65 | + | |
66 | + addTTs: function (TTarray) { | |
67 | + // set TTTab | |
68 | + this.timeSelector.setTTTab(TTarray); | |
69 | + }, | |
70 | + | |
71 | + // Add TT in download TT module | |
72 | + addTTdownload: function (newTTName, newTTid) { | |
73 | + var tabPanel = this.formPanel.down(); | |
74 | + tabPanel.setActiveTab(1); | |
75 | + this.addTT(newTTName, newTTid); | |
76 | + | |
77 | + }, | |
78 | + | |
79 | + /** | |
80 | + * Set Start-Stop from parameter info (Local & MyData) | |
81 | + */ | |
82 | + setTimeFromData: function (obj) { | |
83 | + if (!obj.start || !obj.stop) | |
84 | + return; | |
85 | + var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | |
86 | + var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | |
87 | + | |
88 | + this.down('form').getForm().setValues({startDate: dateStart, stopDate: dateStop}); | |
89 | + this.timeSelector.intervalSel.updateDuration(); | |
90 | + }, | |
91 | + | |
92 | + addParam: function (paramId, isLeaf, needArgs, components) | |
93 | + { | |
94 | + // adding the parameter to the paramGrid | |
95 | + var paramObj = { | |
96 | + paramid: paramId, | |
97 | + type: 0, | |
98 | + 'dim1-is-range': false, | |
99 | + 'dim1-min-range': 0., | |
100 | + 'dim1-max-range': 0., | |
101 | + 'dim1-index': '*', | |
102 | + 'dim2-is-range': false, | |
103 | + 'dim2-min-range': 0., | |
104 | + 'dim2-max-range': 0., | |
105 | + 'dim2-index': '*', | |
106 | + template_args: {} | |
107 | + }; | |
108 | + | |
109 | + if (components) { | |
110 | + if (components['index1']) { | |
111 | + paramObj['dim1-index'] = components['index1']; | |
112 | + ++paramObj['type']; | |
113 | + } | |
114 | + | |
115 | + if (components['index2']) { | |
116 | + paramObj['dim2-index'] = components['index2']; | |
117 | + ++paramObj['type']; | |
118 | + } | |
119 | + } | |
120 | + | |
121 | + var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
122 | + var pos = this.paramGrid.store.getCount(); | |
123 | + this.paramGrid.store.insert(pos, r); | |
124 | + this.paramGrid.getView().refresh(); | |
125 | + | |
126 | + if (needArgs) | |
127 | + this.editParameterArgs(r); | |
128 | + }, | |
129 | + | |
130 | + addParams: function (arrayParams) | |
131 | + { | |
132 | + var arrayRec = new Array(); | |
133 | + var index = 1; | |
134 | + if (arrayParams) | |
135 | + { | |
136 | + index = 0; | |
137 | + Ext.Array.each(arrayParams, function (item) { | |
138 | + if (Ext.isObject(item)) { | |
139 | + if (typeof paramId !== 'undefined') | |
140 | + { | |
141 | + // for Parameter Name in Download Module | |
142 | + var paramObj = { | |
143 | + paramid: paramId, | |
144 | + type: 0, | |
145 | + 'dim1-is-range': false, | |
146 | + 'dim1-min-range': 0., | |
147 | + 'dim1-max-range': 0., | |
148 | + 'dim1-index': item.get('dim1'), | |
149 | + 'dim2-is-range': false, | |
150 | + 'dim2-min-range': 0., | |
151 | + 'dim2-max-range': 0., | |
152 | + 'dim2-index': item.get('dim2'), | |
153 | + template_args: {} | |
154 | + }; | |
155 | + | |
156 | + var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
157 | + } else | |
158 | + { | |
159 | + //for download from get Data in Plot module | |
160 | + var r = Ext.create('amdaModel.DownloadParam', item); | |
161 | + } | |
162 | + | |
163 | + } else { | |
164 | + // for Download By Request in Operations menu | |
165 | + //TODO BRE - Components selection | |
166 | + var r = Ext.create('amdaModel.DownloadParam', {paramid: item}); | |
167 | + } | |
168 | + arrayRec.push(r); | |
169 | + }); | |
170 | + } | |
171 | + this.paramGrid.getStore().loadData(arrayRec); | |
172 | + }, | |
173 | + | |
174 | + // parameter name -> alias | |
175 | + updateConstruct: function (oldval, newval) { | |
176 | + var index = this.paramGrid.store.findExact('name', oldval); | |
177 | + if (index != -1) { | |
178 | + this.paramGrid.getStore().getAt(index).set('name', newval); | |
179 | + this.paramGrid.getStore().getAt(index).set('text', newval); | |
180 | + } | |
181 | + }, | |
182 | + | |
183 | + setObject: function (obj) { | |
184 | + this.object = obj; | |
185 | + this.loadObject(); | |
186 | + }, | |
187 | + | |
188 | + /** | |
189 | + * update this.object from form | |
190 | + */ | |
191 | + updateObject: function () | |
192 | + { | |
193 | + // get the basic form | |
194 | + var tabPanel = this.formPanel.down(); | |
195 | + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
196 | + var basicForm = this.formPanel.getForm(); | |
197 | + var updateStatus = true; | |
198 | + var values = basicForm.getValues(); | |
199 | + | |
200 | + // data download | |
201 | + if (downloadSrc === 0) | |
202 | + { | |
203 | + var timeformat = values.timeformat; | |
204 | + var timeSource = this.timeSelector.getActiveTimeSource(); | |
205 | + var structure = values.filestructure; | |
206 | + var sampling = values.sampling ? values.sampling : 600; | |
207 | + var refparamSampling = values.refparamsampling == 'on'; | |
208 | + var fileprefix = values.fileprefix ? values.fileprefix : ''; | |
209 | + var fileformat = values.fileformat; | |
210 | + var compression = values.compression; | |
211 | + | |
212 | + var fieldsWithoutName = basicForm.getFields().items; | |
213 | + Ext.Array.each(fieldsWithoutName, function (item, index, allItems) { | |
214 | + if (!item.isValid()) { | |
215 | + if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | |
216 | + ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { | |
217 | + updateStatus = true; | |
218 | + } else { | |
219 | + // set update isn't allowed | |
220 | + updateStatus = false; | |
221 | + return false; | |
222 | + } | |
223 | + } | |
224 | + }, this); | |
225 | + | |
226 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | |
227 | + && this.timeSelector.TTGrid.getStore().count() == 0) { | |
228 | + myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!' | |
229 | + + '<br>You must add one or choose Time Selection `by Interval`'); | |
230 | + updateStatus = false; | |
231 | + } | |
232 | + | |
233 | + if (updateStatus) | |
234 | + { | |
235 | + /// real object update | |
236 | + // update TimeTable object with the content of form | |
237 | + basicForm.updateRecord(this.object); | |
238 | + this.object.set('timesrc', timeSource); | |
239 | + // set valid intervals into TimeTable object | |
240 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) | |
241 | + this.object.set('timeTables', this.timeSelector.TTGrid.getStore().data.items); | |
242 | + // set parameters | |
243 | + this.object.set('list', this.paramGrid.getStore().data.items); | |
244 | + this.object.set('structure', structure); | |
245 | + this.object.set('refparamSampling', refparamSampling); | |
246 | + this.object.set('sampling', sampling); | |
247 | + this.object.set('fileprefix', fileprefix); | |
248 | + this.object.set('timeformat', timeformat); | |
249 | + this.object.set('fileformat', fileformat); | |
250 | + this.object.set('compression', compression); | |
251 | + } | |
252 | + } | |
253 | + //TT download | |
254 | + else | |
255 | + { | |
256 | + var timeformat = values.timeformatTT; | |
257 | + var compression = values.compressionTT; | |
258 | + var fileformat = values.fileformatTT; | |
259 | + if (compression === 'none' | |
260 | + && this.TTGrid.getStore().count() > 1) { | |
261 | + myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please'); | |
262 | + updateStatus = false; | |
263 | + } | |
264 | + this.object.set('timeTables', this.TTGrid.getStore().data.items); | |
265 | + this.object.set('timeformatTT', timeformat); | |
266 | + this.object.set('fileformatTT', fileformat); | |
267 | + this.object.set('compressionTT', compression); | |
268 | + } | |
269 | + | |
270 | + this.object.set('downloadSrc', downloadSrc); | |
271 | + // return the update status | |
272 | + return updateStatus; | |
273 | + }, | |
274 | + | |
275 | + /** | |
276 | + * load this.object into form | |
277 | + */ | |
278 | + loadObject: function () { | |
279 | + | |
280 | + if (!this.object.get('timeformat')) | |
281 | + this.object.set('timeformat', this.timeformatData[0][0]); | |
282 | + | |
283 | + if (!this.object.get('timeformatTT')) | |
284 | + this.object.set('timeformatTT', this.timeformatTTData[0][0]); | |
285 | + | |
286 | + if (!this.object.get('fileformat')) | |
287 | + this.object.set('fileformat', this.fileformatData[0][0]); | |
288 | + | |
289 | + if (!this.object.get('fileformatTT')) | |
290 | + this.object.set('fileformatTT', this.fileformatTTData[0][0]); | |
291 | + | |
292 | + if (!this.object.get('compression')) | |
293 | + this.object.set('compression', this.filecompressData[1][0]); | |
294 | + | |
295 | + if (!this.object.get('compressionTT')) | |
296 | + this.object.set('compressionTT', this.filecompressData[1][0]); | |
297 | + | |
298 | + // load object into form | |
299 | + this.formPanel.getForm().loadRecord(this.object); | |
300 | + // set object's TTs into the timeselector | |
301 | + this.addTTs(this.object.get('timeTables')); | |
302 | + // set parameters | |
303 | + this.addParams(this.object.get('list')); | |
304 | + }, | |
305 | + | |
306 | + /** | |
307 | + * download method called by 'Download' button to launch the download process | |
308 | + */ | |
309 | + doDownload: function (sendToSamp, clientId) { | |
310 | + var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
311 | + if (downloadModule) | |
312 | + downloadModule.linkedNode.execute(sendToSamp, clientId); | |
313 | + }, | |
314 | + | |
315 | + actionItem: function (grid, cell, cellIndex, record, row, recordIndex, e) { | |
316 | + | |
317 | + var isTimeTable = record instanceof amdaModel.TTobject; | |
318 | + | |
319 | + if (cellIndex == 3 || (cellIndex == 2 && isTimeTable)) | |
320 | + grid.getStore().remove(record); | |
321 | + else if (cellIndex == 2) { | |
322 | + this.paramGrid.getView().select(row); | |
323 | + this.editParameterArgs(record); | |
324 | + } | |
325 | + }, | |
326 | + | |
327 | + editParameterArgs: function (record) { | |
328 | + var paramArgsPlug = this.getPlugin('download-param-arguments-plugin'); | |
329 | + if (paramArgsPlug) | |
330 | + paramArgsPlug.show('download-param-arguments-plugin', record); | |
331 | + }, | |
332 | + | |
333 | + onApplyParameterArgs: function (parentUI, paramObject) { | |
334 | + parentUI.paramGrid.getView().refresh(); | |
335 | + }, | |
336 | + | |
337 | + onFileStructureChange: function (combo, newValue, oldValue) { | |
338 | + if (!this.formPanel) | |
339 | + return; | |
340 | + | |
341 | + var refParamCheck = this.formPanel.getForm().findField('refparamsampling'); | |
342 | + var samplingField = this.formPanel.getForm().findField('sampling'); | |
343 | + | |
344 | + if (samplingField && newValue !== oldValue) { | |
345 | + refParamCheck.setDisabled(newValue == 2); | |
346 | + samplingField.setDisabled((newValue == 2) || refParamCheck.getValue()); | |
347 | + } | |
348 | + }, | |
349 | + | |
350 | + onRefParamSamplingChange: function (check, newValue, oldValue) { | |
351 | + if (!this.formPanel) | |
352 | + return; | |
353 | + | |
354 | + var samplingField = this.formPanel.getForm().findField('sampling'); | |
355 | + var structureCombo = this.formPanel.getForm().findField('filestructure'); | |
356 | + | |
357 | + if (samplingField && newValue !== oldValue) | |
358 | + samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue()); | |
359 | + }, | |
360 | + | |
361 | + onSendVOTableToSamp: function (clientId, sendOpt) { | |
362 | + var me = sendOpt.scope; | |
363 | + if (me.updateObject()) { | |
364 | + me.doDownload(true, clientId); | |
365 | + } | |
366 | + }, | |
367 | + | |
368 | + /** | |
369 | + * Check if changes were made before closing window | |
370 | + * @return false | |
371 | + */ | |
372 | + fclose: function () { | |
373 | + return false; | |
374 | + }, | |
375 | + | |
376 | + init: function (config) { | |
377 | + var me = this; | |
378 | + | |
379 | + this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector', flex: 1}); | |
380 | + | |
381 | + this.paramGrid = Ext.create('Ext.grid.Panel', { | |
382 | + flex: 2, | |
383 | + store: Ext.create('Ext.data.Store', {model: 'amdaModel.DownloadParam'}), | |
384 | + columns: [ | |
385 | + {xtype: 'rownumberer', width: 20}, | |
386 | + { | |
387 | + header: "Parameter Name", | |
388 | + dataIndex: 'name', | |
389 | + flex: 1, | |
390 | + sortable: false, | |
391 | + menuDisabled: true, | |
392 | + renderer: function (val, meta, rec) { | |
393 | + return rec.getParamFullName(); | |
394 | + } | |
395 | + }, | |
396 | + { | |
397 | + menuDisabled: true, width: 30, renderer: function () { | |
398 | + return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>'; | |
399 | + } | |
400 | + }, | |
401 | + { | |
402 | + menuDisabled: true, width: 30, renderer: function () { | |
403 | + return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
404 | + } | |
405 | + } | |
406 | + ], | |
407 | + //TODO - BRE - Wait the fix for drag&drop issue | |
408 | + listeners: | |
409 | + { | |
410 | + render: function (o, op) | |
411 | + { | |
412 | + var me = this; | |
413 | + var el = me.body.dom; | |
414 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
415 | + ddGroup: 'explorerTree', | |
416 | + notifyEnter: function (ddSource, e, data) { }, | |
417 | + notifyOver: function (ddSource, e, data) | |
418 | + { | |
419 | + if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) | |
420 | + { | |
421 | + this.valid = false; | |
422 | + return this.dropNotAllowed; | |
423 | + } | |
424 | + if (((data.records[0].data.nodeType == 'localParam') || | |
425 | + (data.records[0].data.nodeType == 'remoteParam') || | |
426 | + (data.records[0].data.nodeType == 'remoteSimuParam') || | |
427 | + (data.records[0].data.nodeType == 'derivedParam') || | |
428 | + (data.records[0].data.nodeType == 'myDataParam') || | |
429 | + (data.records[0].data.nodeType == 'alias')) && | |
430 | + (data.records[0].isLeaf() || data.records[0].data.isParameter) && | |
431 | + !data.records[0].data.disable) | |
432 | + { | |
433 | + this.valid = true; | |
434 | + return this.dropAllowed; | |
435 | + } | |
436 | + | |
437 | + this.valid = false; | |
438 | + return this.dropNotAllowed; | |
439 | + }, | |
440 | + notifyDrop: function (ddSource, e, data) | |
441 | + { | |
442 | + if (!this.valid) | |
443 | + return false; | |
444 | + var idToSent; | |
445 | + var components = null; | |
446 | + switch (data.records[0].data.nodeType) | |
447 | + { | |
448 | + case 'localParam' : | |
449 | + case 'remoteParam': | |
450 | + case 'remoteSimuParam': | |
451 | + idToSent = data.records[0].get('id'); | |
452 | + if (data.records[0].get('alias') != "") | |
453 | + idToSent = "#" + data.records[0].get('alias'); | |
454 | + var component_info = data.records[0].get('component_info'); | |
455 | + if (component_info && component_info.parentId) | |
456 | + { | |
457 | + if (component_info.index1 || component_info.index2) | |
458 | + { | |
459 | + idToSent = component_info.parentId; | |
460 | + components = []; | |
461 | + if (component_info.index1) | |
462 | + components['index1'] = component_info.index1; | |
463 | + if (component_info.index2) | |
464 | + components['index2'] = component_info.index2; | |
465 | + } | |
466 | + if (data.records[0].get('needsArgs')) | |
467 | + { | |
468 | + idToSent = component_info.parentId; | |
469 | + if (component_info.index1) | |
470 | + { | |
471 | + components = []; | |
472 | + components['index1'] = component_info.index1; | |
473 | + } | |
474 | + } | |
475 | + } | |
476 | + break; | |
477 | + case 'alias' : | |
478 | + idToSent = "#" + data.records[0].get('text'); | |
479 | + break; | |
480 | + case 'derivedParam' : | |
481 | + if (data.records[0].modelName == 'amdaModel.DerivedParamComponentNode') | |
482 | + { | |
483 | + paramId = data.records[0].get('text'); | |
484 | + var parentId = paramId.substr(0, paramId.length - 3); | |
485 | + idToSent = "ws_" + parentId; | |
486 | + var regExp = /\(([\d]+)\)/; | |
487 | + var component_index = regExp.exec(paramId); | |
488 | + if (component_index) | |
489 | + { | |
490 | + components = []; | |
491 | + components['index1'] = component_index[1]; | |
492 | + } | |
493 | + break; | |
494 | + } else | |
495 | + { | |
496 | + idToSent = "ws_" + data.records[0].get('text'); | |
497 | + console.log(data.records[0]); | |
498 | + } | |
499 | + break; | |
500 | + case 'myDataParam' : | |
501 | + idToSent = "ws_" + data.records[0].get('text'); | |
502 | + break; | |
503 | + default : | |
504 | + return false; | |
505 | + } | |
506 | + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
507 | + if (downModule) | |
508 | + downModule.addParam(idToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | |
509 | + return true; | |
510 | + } | |
511 | + }); | |
512 | + } | |
513 | + } | |
514 | + }); | |
515 | + | |
516 | + this.paramGrid.on('cellclick', this.actionItem, this); | |
517 | + | |
518 | + this.TTGrid = Ext.create('Ext.grid.Panel', { | |
519 | + flex: 2, | |
520 | + store: Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}), | |
521 | + columns: [ | |
522 | + {xtype: 'rownumberer', width: 20}, | |
523 | + {header: "TimeTable/Catalog Name", dataIndex: 'name', flex: 1, sortable: false, menuDisabled: true}, | |
524 | + { | |
525 | + menuDisabled: true, width: 30, renderer: function () { | |
526 | + return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
527 | + } | |
528 | + } | |
529 | + ], | |
530 | + listeners: | |
531 | + { | |
532 | + render: function (o, op) | |
533 | + { | |
534 | + var me = this; | |
535 | + var el = me.body.dom; | |
536 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
537 | + ddGroup: 'explorerTree', | |
538 | + notifyEnter: function (ddSource, e, data) | |
539 | + { | |
540 | + | |
541 | + }, | |
542 | + notifyOver: function (ddSource, e, data) | |
543 | + { | |
544 | + var nodeType = data.records[0].get('nodeType'); | |
545 | + | |
546 | + if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') || | |
547 | + (nodeType == 'catalog' || nodeType == 'sharedCatalog') && | |
548 | + (data.records[0].get('leaf'))) | |
549 | + { | |
550 | + this.valid = true; | |
551 | + return this.dropAllowed; | |
552 | + } | |
553 | + this.valid = false; | |
554 | + return this.dropNotAllowed; | |
555 | + }, | |
556 | + notifyDrop: function (ddSource, e, data) | |
557 | + { | |
558 | + if (!this.valid) | |
559 | + return false; | |
560 | + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
561 | + if (downModule) | |
562 | + downModule.getUiContent().addTTdownload(data.records[0].get('text'), data.records[0].get('id')); | |
563 | + return true; | |
564 | + } | |
565 | + }); | |
566 | + } | |
567 | + } | |
568 | + }); | |
569 | + | |
570 | + this.TTGrid.on('cellclick', this.actionItem, this); | |
571 | + | |
572 | + var store = new Ext.data.ArrayStore({ | |
573 | + fields: ['id', 'name', 'qtip'], | |
574 | + data: this.timeformatData | |
575 | + }); | |
576 | + | |
577 | + this.paramPanel = { | |
578 | + xtype: 'container', | |
579 | + title: 'Parameters', | |
580 | + layout: { | |
581 | + type: 'hbox', | |
582 | + align: 'stretch', | |
583 | + defaultMargins: {top: 10, left: 10, bottom: 5, right: 10} | |
584 | + }, | |
585 | + items: [ | |
586 | + { | |
587 | + xtype: 'container', | |
588 | + flex: 2, | |
589 | + layout: { | |
590 | + type: 'vbox', | |
591 | + align: 'stretch' | |
592 | + }, | |
593 | + items: [ | |
594 | + { | |
595 | + xtype: 'textfield', | |
596 | + fieldLabel: 'Request Name', | |
597 | + disabled: true, | |
598 | + name: 'name' | |
599 | + }, | |
600 | + { | |
601 | + xtype: 'splitter', | |
602 | + flex: 0.05 | |
603 | + }, | |
604 | + this.paramGrid | |
605 | + ] | |
606 | + }, | |
607 | + { | |
608 | + xtype: 'container', | |
609 | + flex: 2, | |
610 | + defaults: { | |
611 | + xtype: 'combo', | |
612 | + labelWidth: 90, | |
613 | + queryMode: 'local', | |
614 | + editable: false | |
615 | + }, | |
616 | + layout: { | |
617 | + type: 'vbox', | |
618 | + align: 'stretch' | |
619 | + }, | |
620 | + items: [ | |
621 | + { | |
622 | + fieldLabel: 'Time Format', | |
623 | + name: 'timeformat', | |
624 | + valueField: 'id', | |
625 | + displayField: 'name', | |
626 | + queryMode: 'local', | |
627 | + store: store, | |
628 | + listConfig: { | |
629 | + tpl: [ | |
630 | + '<tpl for=".">', | |
631 | + '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>', | |
632 | + '</tpl>' | |
633 | + ] | |
634 | + }, | |
635 | + value: store.first() | |
636 | + }, | |
637 | + { | |
638 | + fieldLabel: 'File Structure', | |
639 | + name: 'filestructure', | |
640 | + store: this.filestructureData, | |
641 | + value: this.filestructureData[2], | |
642 | + listeners: { | |
643 | + change: {fn: this.onFileStructureChange}, | |
644 | + scope: this | |
645 | + } | |
646 | + }, | |
647 | + { | |
648 | + xtype: 'checkbox', boxLabel: 'Header in a separate file', | |
649 | + boxLabelAlign: 'before', | |
650 | + name: 'separateInfoFile', checked: false | |
651 | + | |
652 | + }, | |
653 | + { | |
654 | + xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling', | |
655 | + boxLabelAlign: 'before', | |
656 | + name: 'refparamsampling', checked: false, disabled: true, | |
657 | + listeners: { | |
658 | + change: {fn: this.onRefParamSamplingChange}, | |
659 | + scope: this | |
660 | + } | |
661 | + }, | |
662 | + { | |
663 | + xtype: 'numberfield', name: 'sampling', | |
664 | + fieldLabel: 'Sampling Time', value: 600, | |
665 | + hideTrigger: true, editable: true, | |
666 | + disabled: true | |
667 | + }, | |
668 | + { | |
669 | + xtype: 'checkbox', boxLabel: 'Scientific floating-point formatting', | |
670 | + boxLabelAlign: 'before', | |
671 | + name: 'scientificformat', checked: false | |
672 | + }, | |
673 | + { | |
674 | + xtype: 'textfield', name: 'fileprefix', | |
675 | + fieldLabel: 'File Prefix', | |
676 | + disabled: false, editable: true | |
677 | + }, | |
678 | + { | |
679 | + fieldLabel: 'File Format', | |
680 | + name: 'fileformat', | |
681 | + store: this.fileformatData, | |
682 | + value: this.fileformatData[0] | |
683 | + }, | |
684 | + { | |
685 | + fieldLabel: 'Compression', | |
686 | + name: 'compression', | |
687 | + store: this.filecompressData, | |
688 | + value: this.filecompressData[0] | |
689 | + }, | |
690 | + this.timeSelector | |
691 | + ] | |
692 | + } | |
693 | + ]}; | |
694 | + | |
695 | + this.ttPanel = | |
696 | + { | |
697 | + xtype: 'container', | |
698 | + title: 'Time Tables / Catalogs', | |
699 | + layout: { | |
700 | + type: 'hbox', | |
701 | + align: 'stretch', | |
702 | + defaultMargins: {top: 10, left: 10, bottom: 5, right: 10} | |
703 | + }, | |
704 | + items: [ | |
705 | + this.TTGrid, | |
706 | + { | |
707 | + xtype: 'container', | |
708 | + flex: 2, | |
709 | + defaults: { | |
710 | + xtype: 'combo', | |
711 | + labelWidth: 90, | |
712 | + queryMode: 'local', | |
713 | + editable: false | |
714 | + }, | |
715 | + layout: { | |
716 | + type: 'vbox', | |
717 | + align: 'stretch' | |
718 | + }, | |
719 | + items: [{ | |
720 | + fieldLabel: 'Time Format', | |
721 | + name: 'timeformatTT', | |
722 | + store: this.timeformatTTData, | |
723 | + value: this.timeformatTTData[0] | |
724 | + }, | |
725 | + { | |
726 | + fieldLabel: 'File Format ', | |
727 | + name: 'fileformatTT', | |
728 | + store: this.fileformatTTData, | |
729 | + value: this.fileformatTTData[0] | |
730 | + }, | |
731 | + { | |
732 | + fieldLabel: 'Compression ', | |
733 | + name: 'compressionTT', | |
734 | + store: this.filecompressTT, | |
735 | + value: this.filecompressTT[0] | |
736 | + } | |
737 | + ]} | |
738 | + ] | |
739 | + }; | |
740 | + | |
741 | + this.formPanel = new Ext.form.Panel({ | |
742 | + layout: 'fit', | |
743 | + region: 'center', | |
744 | + bodyStyle: {background: '#dfe8f6'}, | |
745 | + buttonAlign: 'left', | |
746 | + trackResetOnLoad: true, //reset to the last loaded record | |
747 | + defaults: { | |
748 | + border: false | |
749 | + }, | |
750 | + items: [{ | |
751 | + xtype: 'tabpanel', | |
752 | + activeTab: 0, | |
753 | + bodyStyle: {background: '#dfe8f6'}, | |
754 | + items: [ | |
755 | + this.paramPanel, | |
756 | + this.ttPanel | |
757 | + ], | |
758 | + listeners: { | |
759 | + 'tabchange': function (tabPanel, tab) { | |
760 | + var sampAvailable = (tab.title == me.paramPanel.title); | |
761 | + me.down('sendToSampButton').setDisabled(!sampAvailable); | |
762 | + } | |
763 | + } | |
764 | + }], | |
765 | + fbar: [ | |
766 | + { | |
767 | + text: 'Download', | |
768 | + scope: this, | |
769 | + handler: function (button) { | |
770 | + // if the return is true (object had been updated) | |
771 | + if (this.updateObject()) { | |
772 | + // launch the download process | |
773 | + this.doDownload(); | |
774 | + } | |
775 | + } | |
776 | + }, | |
777 | + { | |
778 | + text: 'Reset', | |
779 | + scope: this, | |
780 | + handler: function () { | |
781 | + this.formPanel.getForm().reset(); | |
782 | + var tabPanel = this.formPanel.down(); | |
783 | + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
784 | + if (downloadSrc === 0) { | |
785 | + // reset parameters and Time Tables in Get Data | |
786 | + this.paramGrid.store.removeAll(); | |
787 | + this.timeSelector.TTGrid.store.removeAll(); | |
788 | + } else { | |
789 | + // reset Time Tables in Get time Table | |
790 | + this.TTGrid.store.removeAll(); | |
791 | + } | |
792 | + } | |
793 | + }, | |
794 | + '->', | |
795 | + { | |
796 | + xtype: 'sendToSampButton', | |
797 | + type: 'votable', | |
798 | + onSendToSamp: this.onSendVOTableToSamp, | |
799 | + sendOpt: {scope: this} | |
800 | + }] | |
801 | + }); | |
802 | + | |
803 | + var myConf = { | |
804 | + layout: 'border', | |
805 | + items: [ | |
806 | + this.formPanel, | |
807 | + { | |
808 | + xtype: 'panel', | |
809 | + region: 'south', | |
810 | + title: 'Information', | |
811 | + collapsible: true, | |
812 | + collapseMode: 'header', | |
813 | + height: 100, | |
814 | + autoHide: false, | |
815 | + bodyStyle: 'padding:5px', | |
816 | + iconCls: 'icon-information', | |
817 | + loader: { | |
818 | + autoLoad: true, | |
819 | + url: helpDir + 'downloadHOWTO' | |
820 | + } | |
821 | + } | |
822 | + ], | |
823 | + plugins: [{ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}] | |
824 | + }; | |
825 | + | |
826 | + Ext.apply(this, Ext.apply(arguments, myConf)); | |
827 | + } | |
815 | 828 | }); | ... | ... |
js/app/views/ParamArgumentsUI.js
... | ... | @@ -64,15 +64,13 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
64 | 64 | rebuildAll: function(paramInfoResult , uiScope) { |
65 | 65 | //Rebuild arguments selection |
66 | 66 | this.rebuildArguments(paramInfoResult, uiScope); |
67 | - | |
68 | 67 | //Set parameter type (scalar, vector or Tab2D) |
69 | 68 | this.paramRequestObject.set('type', this.paramType); |
70 | - | |
71 | 69 | //Add default template args values |
72 | 70 | var templateArgsValues = this.paramRequestObject.get('template_args'); |
73 | 71 | if (!templateArgsValues) |
74 | 72 | templateArgsValues = {}; |
75 | - if (paramInfoResult.template && paramInfoResult.template.arguments) { | |
73 | + if (paramInfoResult.template && paramInfoResult.template.arguments) { | |
76 | 74 | //Add default template args definition if needed |
77 | 75 | Ext.Object.each(paramInfoResult.template.arguments, function (argKey, argDef) { |
78 | 76 | if (!templateArgsValues[argKey]) | ... | ... |
js/app/views/PlotComponents/PlotParamForm.js
... | ... | @@ -101,7 +101,6 @@ Ext.define('amdaPlotComp.PlotParamForm', { |
101 | 101 | drawingOptionsForm.crtTree = this.crtTree; |
102 | 102 | if (drawingOptionsForm.setObject) |
103 | 103 | drawingOptionsForm.setObject(this.object); |
104 | - | |
105 | 104 | if (this.paramArgs && paramId) |
106 | 105 | this.paramArgs.editParameter(this.object, this, function (uiScope) { |
107 | 106 | uiScope.crtTree.refresh(); |
... | ... | @@ -125,7 +124,6 @@ Ext.define('amdaPlotComp.PlotParamForm', { |
125 | 124 | }); |
126 | 125 | |
127 | 126 | //ToDoparamArgsPlug |
128 | - | |
129 | 127 | var paramInfoFieldSet = this.addStandardFieldSet('Arguments', '', [this.paramArgs]); |
130 | 128 | paramInfoFieldSet.collapsed = false; |
131 | 129 | ... | ... |
js/app/views/PlotComponents/PlotStandardForm.js
... | ... | @@ -308,25 +308,24 @@ Ext.define('amdaPlotComp.PlotStandardForm', { |
308 | 308 | }, |
309 | 309 | notifyDrop: function(ddSource, e, data) { |
310 | 310 | var selectedRecord = ddSource.dragData.records[0]; |
311 | - | |
312 | 311 | switch (selectedRecord.$className) |
313 | 312 | { |
314 | 313 | case 'amdaModel.LocalParamNode' : |
315 | - case 'amdaModel.RemoteParamNode' : | |
316 | - case 'amdaModel.RemoteSimuParamNode' : | |
314 | + case 'amdaModel.RemoteParamNode' : | |
315 | + case 'amdaModel.RemoteSimuParamNode' : | |
317 | 316 | if (!selectedRecord.get('isParameter') || selectedRecord.get('disable')) |
318 | 317 | return false; |
319 | 318 | if (selectedRecord.get('alias') != "" ) |
320 | 319 | field.setValue("#"+selectedRecord.get('alias')); |
321 | - else | |
322 | - field.setValue(selectedRecord.get('id')); | |
320 | + else | |
321 | + field.setValue(selectedRecord.get('id')); | |
323 | 322 | return true; |
324 | - case 'amdaModel.AliasNode' : | |
323 | + case 'amdaModel.AliasNode' : | |
325 | 324 | if (!selectedRecord.isLeaf()) |
326 | 325 | return false; |
327 | 326 | field.setValue("#"+selectedRecord.get('text')); |
328 | 327 | return true; |
329 | - case 'amdaModel.DerivedParamNode' : | |
328 | + case 'amdaModel.DerivedParamNode' : | |
330 | 329 | if (!selectedRecord.isLeaf()) |
331 | 330 | return false; |
332 | 331 | field.setValue("ws_"+selectedRecord.get('text')); |
... | ... | @@ -336,7 +335,7 @@ Ext.define('amdaPlotComp.PlotStandardForm', { |
336 | 335 | return false; |
337 | 336 | field.setValue("wsd_"+selectedRecord.get('text')); |
338 | 337 | return true; |
339 | - default : | |
338 | + default : | |
340 | 339 | return false; |
341 | 340 | } |
342 | 341 | return true; | ... | ... |
js/app/views/PlotComponents/PlotTree.js
... | ... | @@ -607,108 +607,122 @@ Ext.define('amdaPlotComp.PlotTree', { |
607 | 607 | return false; |
608 | 608 | }, |
609 | 609 | |
610 | - dropParamToCreate : function(targetNode, position, paramId, paramComponents, isVector, plotOnly) | |
611 | - { | |
612 | - var panelObject = null; | |
613 | - if (targetNode == null) | |
614 | - { | |
615 | - //create new panel | |
616 | - panelObject = this.tabObject.createNewPanel(); | |
617 | - } | |
618 | - else | |
619 | - { | |
620 | - switch (targetNode.$className) | |
621 | - { | |
622 | - case 'amdaPlotObj.PlotParamsTreeNode' : | |
623 | - case 'amdaPlotObj.PlotPanelTreeNode' : | |
624 | - case 'amdaPlotObj.PlotAxesTreeNode' : | |
625 | - panelObject = targetNode.object; | |
626 | - break; | |
627 | - case 'amdaPlotObj.PlotTimeAxisTreeNode' : | |
628 | - case 'amdaPlotObj.PlotEpochAxisTreeNode' : | |
629 | - case 'amdaPlotObj.PlotXAxisTreeNode' : | |
630 | - case 'amdaPlotObj.PlotYLeftAxisTreeNode' : | |
631 | - case 'amdaPlotObj.PlotYRightAxisTreeNode' : | |
632 | - case 'amdaPlotObj.PlotColorAxisTreeNode' : | |
633 | - case 'amdaPlotObj.PlotParamTreeNode' : | |
634 | - panelObject = targetNode.parentNode.object; | |
635 | - break; | |
636 | - default: | |
637 | - //create new panel | |
638 | - panelObject = this.tabObject.createNewPanel(); | |
639 | - } | |
640 | - } | |
610 | + dropParamToCreate: function (targetNode, position, paramId, paramComponents, isVector, plotOnly) | |
611 | + { | |
612 | + var panelObject = null; | |
613 | + if (targetNode == null) | |
614 | + { | |
615 | + //create new panel | |
616 | + panelObject = this.tabObject.createNewPanel(); | |
617 | + } else | |
618 | + { | |
619 | + switch (targetNode.$className) | |
620 | + { | |
621 | + case 'amdaPlotObj.PlotParamsTreeNode' : | |
622 | + case 'amdaPlotObj.PlotPanelTreeNode' : | |
623 | + case 'amdaPlotObj.PlotAxesTreeNode' : | |
624 | + panelObject = targetNode.object; | |
625 | + break; | |
626 | + case 'amdaPlotObj.PlotTimeAxisTreeNode' : | |
627 | + case 'amdaPlotObj.PlotEpochAxisTreeNode' : | |
628 | + case 'amdaPlotObj.PlotXAxisTreeNode' : | |
629 | + case 'amdaPlotObj.PlotYLeftAxisTreeNode' : | |
630 | + case 'amdaPlotObj.PlotYRightAxisTreeNode' : | |
631 | + case 'amdaPlotObj.PlotColorAxisTreeNode' : | |
632 | + case 'amdaPlotObj.PlotParamTreeNode' : | |
633 | + panelObject = targetNode.parentNode.object; | |
634 | + break; | |
635 | + default: | |
636 | + //create new panel | |
637 | + panelObject = this.tabObject.createNewPanel(); | |
638 | + } | |
639 | + } | |
641 | 640 | |
642 | - //Create param object | |
643 | - var me = this; | |
644 | - panelObject.createNewParam(paramId, paramComponents, isVector, plotOnly, function (newParamObject) { | |
645 | - //Rebuild params node | |
646 | - me.buildPanelsNode(newParamObject.getId()); | |
647 | - //BRE newParamObject | |
648 | - }); | |
649 | - }, | |
650 | - | |
651 | - dropRecord : function(record,targetNode,position) | |
652 | - { | |
653 | - var selModel = this.getSelectionModel(); | |
654 | - | |
655 | - //select the target node if defined | |
656 | - if (targetNode) | |
657 | - selModel.select(targetNode); | |
658 | - else | |
659 | - selModel.deselectAll(); | |
660 | - | |
661 | - switch (record.$className) | |
662 | - { | |
663 | - case 'amdaModel.LocalParamNode' : | |
664 | - case 'amdaModel.RemoteParamNode' : | |
665 | - case 'amdaModel.RemoteSimuParamNode' : | |
666 | - if (!record.get('isParameter') || record.get('disable')) | |
667 | - return false; | |
668 | - | |
669 | - if (record.get('alias') != "" ) | |
670 | - this.dropParamToCreate(targetNode, position, "#"+record.get('alias')); | |
671 | - else { | |
672 | - var isVector = record.get('iconCls') == 'icon-vector'; | |
673 | - var component_info = record.get('component_info'); | |
674 | - var param_id = record.get('id'); | |
675 | - var plot_only = record.get('notyet'); | |
676 | - var components = null; | |
677 | - if (component_info && component_info.parentId) { | |
678 | - //It's a component | |
679 | - param_id = component_info.parentId; | |
680 | - components = []; | |
681 | - if (component_info.index1) | |
682 | - components['index1'] = component_info.index1; | |
683 | - if (component_info.index2) | |
684 | - components['index2'] = component_info.index2; | |
685 | - } | |
686 | - this.dropParamToCreate(targetNode, position, param_id, components, isVector, plot_only); | |
687 | - } | |
688 | - return true; | |
689 | - case 'amdaModel.AliasNode' : | |
690 | - if (!record.isLeaf()) | |
691 | - return false; | |
692 | - this.dropParamToCreate(targetNode, position, "#"+record.get('text')); | |
693 | - return true; | |
694 | - case 'amdaModel.DerivedParamNode' : | |
695 | - case 'amdaModel.DerivedParamComponentNode': | |
696 | - if (!record.get('isParameter')) | |
697 | - return false; | |
698 | - //targetNode, position, paramId, paramComponents, isVector, plotOnly | |
699 | - this.dropParamToCreate(targetNode, position, "ws_"+record.get('text')); | |
700 | - return true; | |
701 | - case 'amdaModel.MyDataParamNode' : | |
702 | - if (!record.isLeaf()) | |
703 | - return false; | |
704 | - this.dropParamToCreate(targetNode, position, "wsd_"+record.get('text')); | |
705 | - return true; | |
706 | - case 'amdaPlotObj.PlotParamTreeNode' : | |
707 | - return this.moveParam(record,targetNode,position); | |
708 | - case 'amdaPlotObj.PlotPanelTreeNode' : | |
709 | - return this.movePanel(record,targetNode,position); | |
710 | - default : | |
711 | - return false; | |
641 | + //Create param object | |
642 | + var me = this; | |
643 | + panelObject.createNewParam(paramId, paramComponents, isVector, plotOnly, function (newParamObject) { | |
644 | + //Rebuild params node | |
645 | + me.buildPanelsNode(newParamObject.getId()); | |
646 | + //BRE newParamObject | |
647 | + }); | |
648 | + }, | |
649 | + | |
650 | + dropRecord: function (record, targetNode, position) | |
651 | + { | |
652 | + var selModel = this.getSelectionModel(); | |
653 | + | |
654 | + //select the target node if defined | |
655 | + if (targetNode) | |
656 | + selModel.select(targetNode); | |
657 | + else | |
658 | + selModel.deselectAll(); | |
659 | + | |
660 | + switch (record.$className) | |
661 | + { | |
662 | + case 'amdaModel.LocalParamNode' : | |
663 | + case 'amdaModel.RemoteParamNode' : | |
664 | + case 'amdaModel.RemoteSimuParamNode' : | |
665 | + if (!record.get('isParameter') || record.get('disable')) | |
666 | + return false; | |
667 | + | |
668 | + if (record.get('alias') != "") | |
669 | + this.dropParamToCreate(targetNode, position, "#" + record.get('alias')); | |
670 | + else { | |
671 | + var isVector = record.get('iconCls') == 'icon-vector'; | |
672 | + var component_info = record.get('component_info'); | |
673 | + var param_id = record.get('id'); | |
674 | + var plot_only = record.get('notyet'); | |
675 | + var components = null; | |
676 | + if (component_info && component_info.parentId) { | |
677 | + //It's a component | |
678 | + param_id = component_info.parentId; | |
679 | + components = []; | |
680 | + if (component_info.index1) | |
681 | + components['index1'] = component_info.index1; | |
682 | + if (component_info.index2) | |
683 | + components['index2'] = component_info.index2; | |
684 | + } | |
685 | + this.dropParamToCreate(targetNode, position, param_id, components, isVector, plot_only); | |
686 | + } | |
687 | + return true; | |
688 | + case 'amdaModel.AliasNode' : | |
689 | + if (!record.isLeaf()) | |
690 | + return false; | |
691 | + this.dropParamToCreate(targetNode, position, "#" + record.get('text')); | |
692 | + return true; | |
693 | + case 'amdaModel.DerivedParamNode' : | |
694 | + if (!record.get('isParameter')) | |
695 | + return false; | |
696 | + //targetNode, position, paramId, paramComponents, isVector, plotOnly | |
697 | + this.dropParamToCreate(targetNode, position, "ws_" + record.get('text')); | |
698 | + return true; | |
699 | + case 'amdaModel.DerivedParamComponentNode': | |
700 | + if (!record.get('isParameter')) | |
701 | + return false; | |
702 | + //targetNode, position, paramId, paramComponents, isVector, plotOnly | |
703 | + paramId=record.get('text'); | |
704 | + var parentId = paramId.substr(0, paramId.length - 3); | |
705 | + idToSent = "ws_" + parentId; | |
706 | + var regExp = /\(([\d]+)\)/; | |
707 | + var component_index = regExp.exec(paramId); | |
708 | + if (component_index) | |
709 | + { | |
710 | + components = []; | |
711 | + components['index1'] = component_index[1]; | |
712 | + } | |
713 | + this.dropParamToCreate(targetNode, position,idToSent, components); | |
714 | + return true; | |
715 | + case 'amdaModel.MyDataParamNode' : | |
716 | + if (!record.isLeaf()) | |
717 | + return false; | |
718 | + this.dropParamToCreate(targetNode, position, "wsd_" + record.get('text')); | |
719 | + return true; | |
720 | + case 'amdaPlotObj.PlotParamTreeNode' : | |
721 | + return this.moveParam(record, targetNode, position); | |
722 | + case 'amdaPlotObj.PlotPanelTreeNode' : | |
723 | + return this.movePanel(record, targetNode, position); | |
724 | + default : | |
725 | + return false; | |
712 | 726 | } |
713 | 727 | return false; |
714 | 728 | }, | ... | ... |
js/app/views/StatisticsUI.js
... | ... | @@ -347,8 +347,24 @@ Ext.define('amdaUI.StatisticsUI', |
347 | 347 | nameToSent = "#"+data.records[0].get('text'); |
348 | 348 | break; |
349 | 349 | case 'derivedParam' : |
350 | - nameToSent = "ws_"+data.records[0].get('text'); | |
351 | - break; | |
350 | + if(data.records[0].modelName=='amdaModel.DerivedParamComponentNode') | |
351 | + { | |
352 | + paramId=data.records[0].get('text'); | |
353 | + var parentId=paramId.substr(0,paramId.length-3); | |
354 | + nameToSent = "ws_"+parentId; | |
355 | + var regExp = /\(([\d]+)\)/; | |
356 | + var component_index = regExp.exec(paramId); | |
357 | + if(component_index ) | |
358 | + { | |
359 | + components = []; | |
360 | + components['index1'] =component_index[1]; | |
361 | + } | |
362 | + break; | |
363 | + }else | |
364 | + { | |
365 | + nameToSent = "ws_"+data.records[0].get('text'); | |
366 | + } | |
367 | + break; | |
352 | 368 | case 'myDataParam' : |
353 | 369 | nameToSent = "wsd_"+data.records[0].get('text'); |
354 | 370 | break; | ... | ... |