Commit 3ab0bee943cae0a43c2285205a2cef06e11ad150

Authored by Elena.Budnik
1 parent 96cdc664

aprams with args processing

js/app/controllers/ExplorerModule.js
... ... @@ -7,337 +7,337 @@
7 7 * @author CDA
8 8 */
9 9  
10   -Ext.define('amdaDesktop.ExplorerModule', {
11   -
12   - extend: 'amdaDesktop.AmdaModule',
  10 +Ext.define('amdaDesktop.ExplorerModule',
  11 +{
  12 + extend: 'amdaDesktop.AmdaModule',
13 13  
14   - requires : [
15   - 'amdaUI.ExplorerUI',
16   - 'amdaUI.AliasUI',
17   - // Node Models
18   - 'amdaModel.BkgJobNode',
19   - 'amdaModel.DerivedParamNode',
20   - 'amdaModel.LocalParamNode',
21   - 'amdaModel.RemoteParamNode',
22   - 'amdaModel.RemoteSimuParamNode',
23   - 'amdaModel.AliasNode',
24   - 'amdaModel.TimeTableNode',
25   - 'amdaModel.CatalogNode',
26   - 'amdaModel.StatisticsNode', // singleton; not shown in the tree
27   - 'amdaModel.sharedTimeTableNode',
28   - 'amdaModel.sharedCatalogNode',
29   - 'amdaModel.MyDataParamNode',
30   - 'amdaModel.MyDataNode',
31   - 'amdaModel.PlotNode',
32   - 'amdaModel.DownloadNode', // singleton; not shown in the tree
33   - 'amdaModel.SearchNode',
34   - // Object Models
35   - 'amdaModel.Parameter',
36   - 'amdaModel.Search',
37   -
38   - 'amdaModel.Download',
39   - 'amdaModel.TimeTable',
40   - 'amdaModel.Catalog',
41   - 'amdaModel.Statistics',
42   - 'amdaModel.FileObject',
43   - 'amdaModel.FileParamObject',
44   - 'amdaModel.FilterInfo'
45   - ],
  14 + requires : [
  15 + 'amdaUI.ExplorerUI',
  16 + 'amdaUI.AliasUI',
  17 + // Node Models
  18 + 'amdaModel.BkgJobNode',
  19 + 'amdaModel.DerivedParamNode',
  20 + 'amdaModel.LocalParamNode',
  21 + 'amdaModel.RemoteParamNode',
  22 + 'amdaModel.RemoteSimuParamNode',
  23 + 'amdaModel.AliasNode',
  24 + 'amdaModel.TimeTableNode',
  25 + 'amdaModel.CatalogNode',
  26 + 'amdaModel.StatisticsNode', // singleton; not shown in the tree
  27 + 'amdaModel.sharedTimeTableNode',
  28 + 'amdaModel.sharedCatalogNode',
  29 + 'amdaModel.MyDataParamNode',
  30 + 'amdaModel.MyDataNode',
  31 + 'amdaModel.PlotNode',
  32 + 'amdaModel.DownloadNode', // singleton; not shown in the tree
  33 + 'amdaModel.SearchNode',
  34 + // Object Models
  35 + 'amdaModel.Parameter',
  36 + 'amdaModel.Search',
  37 + 'amdaModel.Download',
  38 + 'amdaModel.TimeTable',
  39 + 'amdaModel.Catalog',
  40 + 'amdaModel.Statistics',
  41 + 'amdaModel.FileObject',
  42 + 'amdaModel.FileParamObject',
  43 + 'amdaModel.FilterInfo'
  44 + ],
46 45  
47   - contentId : 'explorerUI',
  46 + contentId : 'explorerUI',
48 47  
49   - filter : null,
50   - filtersStore : null,
  48 + filter : null,
  49 + filtersStore : null,
51 50  
52   - paramInfoRegistry : {},
  51 + paramInfoRegistry : {},
53 52  
54   - constructor : function(config){
55   - this.callParent(arguments);
56   - if (!this.filtersStore) {
57   - this.filtersStore = Ext.create('Ext.data.Store', {
58   - model: 'amdaModel.FilterList'
59   - });
60   - this.filtersStore.load();
61   - // amdaDesktop.ExplorerModule.filtersStore = this.filtersStore;
62   - }
63   - },
  53 + constructor : function(config)
  54 + {
  55 + this.callParent(arguments);
  56 + if (!this.filtersStore)
  57 + {
  58 + this.filtersStore = Ext.create('Ext.data.Store', {
  59 + model: 'amdaModel.FilterList'
  60 + });
  61 + this.filtersStore.load();
  62 + // amdaDesktop.ExplorerModule.filtersStore = this.filtersStore;
  63 + }
  64 + },
64 65  
65   - createWindow : function() {
66   - var desktop = this.app.getDesktop();
  66 + createWindow : function()
  67 + {
  68 + var desktop = this.app.getDesktop();
67 69  
68   - var win = desktop.getWindow(this.id);
69   - if (!win) {
70   - win = desktop.createWindow( {
71   - id : this.id,
72   - title : this.title,
73   - width : 340,
74   - height : 500,
75   - iconCls : this.icon,
76   - animCollapse : false,
77   - border : false,
  70 + var win = desktop.getWindow(this.id);
  71 + if (!win) {
  72 + win = desktop.createWindow( {
  73 + id : this.id,
  74 + title : this.title,
  75 + width : 340,
  76 + height : 500,
  77 + iconCls : this.icon,
  78 + animCollapse : false,
  79 + border : false,
78 80 // constrainHeader : true,
79   - closable: false,
80   - stateful : true,
81   - stateId : this.id,
82   - stateEvents: ['move','show','resize'],
83   - constrain: true,
84   - layout :
85   - {
86   - type : 'border',
87   - align : 'stretch'
88   - },
89   - x : 5,
90   - y : 5,
91   - items : [
92   - {
93   - xtype: 'panelExplorer',
94   - id : this.contentId,
95   - region: 'center'
96   - },
97   - {
98   - xtype: 'panel',
99   - id : 'LogPanel',
100   - region: 'south',
101   - height : 150,
102   - split : true,
103   - layout: {
104   - type: 'vbox',
105   - align : 'stretch',
106   - autoSize : true
107   - },
108   - autoScroll : true,
109   - stateful : true,
110   - stateId : 'LogPanel',
111   - buttons : [{
112   - scope: this,
113   - text : 'Clear',
114   - handler: function(){
115   - win.items.get('LogPanel').removeAll();
116   - this.addLogMessage('<b>Log</b>');
117   - }
118   - }]
119   - }
120   - ]
121   - });
122   -
123   -
124   - }
125   -
126   - win.on({
127   - activate: {
128   - fn : function()
129   - {
130   - myDesktopApp.getLoadedModule(this.id, true, function (module) {
131   - // on activation when there's a pinedModule 'null'
132   - if (module.pinedModule===null) {
133   - // get the ZIndex manager
134   - var manager = myDesktopApp.desktop.getDesktopZIndexManager();
135   - // ordering to send back this window
136   - manager.sendToBack(win);
137   - }
138   - });
139   -
140   - },
141   - scope: this
142   - }
143   - });
  81 + closable: false,
  82 + stateful : true,
  83 + stateId : this.id,
  84 + stateEvents: ['move','show','resize'],
  85 + constrain: true,
  86 + layout :
  87 + {
  88 + type : 'border',
  89 + align : 'stretch'
  90 + },
  91 + x : 5,
  92 + y : 5,
  93 + items : [
  94 + {
  95 + xtype: 'panelExplorer',
  96 + id : this.contentId,
  97 + region: 'center'
  98 + },
  99 + {
  100 + xtype: 'panel',
  101 + id : 'LogPanel',
  102 + region: 'south',
  103 + height : 150,
  104 + split : true,
  105 + layout: {
  106 + type: 'vbox',
  107 + align : 'stretch',
  108 + autoSize : true
  109 + },
  110 + autoScroll : true,
  111 + stateful : true,
  112 + stateId : 'LogPanel',
  113 + buttons : [{
  114 + scope: this,
  115 + text : 'Clear',
  116 + handler: function(){
  117 + win.items.get('LogPanel').removeAll();
  118 + this.addLogMessage('<b>Log</b>');
  119 + }
  120 + }]
  121 + }
  122 + ]
  123 + });
  124 + }
144 125  
145   - win.on({
146   - show :
147   - {
148   - fn : function(o)
149   - {
150   - //set current filter
151   - this.setCrtFilter();
152   - //resize the explorer in relation with the desktop size
153   - if (win.y + win.height > myDesktopApp.desktop.el.getHeight())
154   - win.setHeight(myDesktopApp.desktop.el.getHeight() - win.y);
155   - },
156   - scope : this
157   - }
158   - });
  126 + win.on({
  127 + activate: {
  128 + fn : function()
  129 + {
  130 + myDesktopApp.getLoadedModule(this.id, true, function (module) {
  131 + // on activation when there's a pinedModule 'null'
  132 + if (module.pinedModule===null) {
  133 + // get the ZIndex manager
  134 + var manager = myDesktopApp.desktop.getDesktopZIndexManager();
  135 + // ordering to send back this window
  136 + manager.sendToBack(win);
  137 + }
  138 + });
  139 + },
  140 + scope: this
  141 + }
  142 + });
159 143  
160   - win.addCls('window-active');
161   - win.show();
162   - this.addLogMessage('<b>Log</b>');
163   - return win;
  144 + win.on({
  145 + show :
  146 + {
  147 + fn : function(o)
  148 + {
  149 + //set current filter
  150 + this.setCrtFilter();
  151 + //resize the explorer in relation with the desktop size
  152 + if (win.y + win.height > myDesktopApp.desktop.el.getHeight())
  153 + win.setHeight(myDesktopApp.desktop.el.getHeight() - win.y);
  154 + },
  155 + scope : this
  156 + }
  157 + });
164 158  
165   - },
  159 + win.addCls('window-active');
  160 + win.show();
  161 + this.addLogMessage('<b>Log</b>');
  162 + return win;
  163 + },
166 164  
167   - pinedModule : null,
  165 + pinedModule : null,
168 166  
169   - /**
170   - * Getter of pinedModule
171   - * @return {amdaDesktop.InteractiveModule} The pined module
172   - */
173   - getPinedModule : function()
174   - {
175   - // get the pined Module
176   - return this.pinedModule;
177   - },
  167 + /**
  168 + * Getter of pinedModule
  169 + * @return {amdaDesktop.InteractiveModule} The pined module
  170 + */
  171 + getPinedModule : function()
  172 + {
  173 + // get the pined Module
  174 + return this.pinedModule;
  175 + },
178 176  
179   - /**
180   - * Setter of pinedModule
181   - * @param {amdaDesktop.InteractiveModule} The pined module
182   - */
183   - setPinedModule : function(amdaModule)
184   - {
185   - // set the pined Module
186   - this.pinedModule = amdaModule;
187   - },
  177 + /**
  178 + * Setter of pinedModule
  179 + * @param {amdaDesktop.InteractiveModule} The pined module
  180 + */
  181 + setPinedModule : function(amdaModule)
  182 + {
  183 + // set the pined Module
  184 + this.pinedModule = amdaModule;
  185 + },
188 186  
189   - /**
190   - * Module Attachment Method
191   - * @param {amdaDesktop.InteractiveModule} The module to attach
192   - */
193   - pinMechanism : function(amdaModule)
194   - {
195   - // if there is an old pined module
196   - if (this.getPinedModule()!=null) {
197   - // get old pined module :
198   - var oldPinedModule = this.getPinedModule();
199   - // call uncolor method on the old pined Module
200   - myDesktopApp.getLoadedModule(oldPinedModule).uncolorHeaderModule();
201   - }
202   - // set pined module
203   - this.setPinedModule(amdaModule);
204   - // call color method on pined Module
205   - myDesktopApp.getLoadedModule(amdaModule).colorHeaderModule();
206   - },
  187 + /**
  188 + * Module Attachment Method
  189 + * @param {amdaDesktop.InteractiveModule} The module to attach
  190 + */
  191 + pinMechanism : function(amdaModule)
  192 + {
  193 + // if there is an old pined module
  194 + if (this.getPinedModule()!=null) {
  195 + // get old pined module :
  196 + var oldPinedModule = this.getPinedModule();
  197 + // call uncolor method on the old pined Module
  198 + myDesktopApp.getLoadedModule(oldPinedModule).uncolorHeaderModule();
  199 + }
  200 + // set pined module
  201 + this.setPinedModule(amdaModule);
  202 + // call color method on pined Module
  203 + myDesktopApp.getLoadedModule(amdaModule).colorHeaderModule();
  204 + },
207 205  
208 206  
209   - addLogMessage : function(message)
210   - {
211   - var height = 40;
212   - var msg = Ext.create('Ext.Component', {
213   - height: height,
214   - html: message,
215   - style: { color : '#555555'}
216   - });
217   - var desktop = myDesktopApp.getDesktop();
218   - var win = desktop.getWindow(this.id);
219   - var panel = win.items.get('LogPanel');
220   - panel.add(msg);
221   - },
  207 + addLogMessage : function(message)
  208 + {
  209 + var height = 40;
  210 + var msg = Ext.create('Ext.Component', {
  211 + height: height,
  212 + html: message,
  213 + style: { color : '#555555'}
  214 + });
  215 + var desktop = myDesktopApp.getDesktop();
  216 + var win = desktop.getWindow(this.id);
  217 + var panel = win.items.get('LogPanel');
  218 + panel.add(msg);
  219 + },
222 220  
223   - //
224   - setCrtFilter : function()
225   - {
226   - var me = this;
227   - //get current filter to apply
228   - AmdaAction.getCrtFilterResult(function (result, e)
229   - {
230   - var t = e.getTransaction();
231   - if (e.status)
232   - {
233   - if (result)
234   - {
235   - //apply current filter
236   - this.filter = result;
237   -
238   - // add saved filter to Explorer List
239   - if (!this.filtersStore.getById(this.filter.id))
240   - this.filtersStore.add({id : this.filter.id, name : this.filter.name});
241   -
242   - //apply filter to the tree
243   - var desktop = myDesktopApp.getDesktop();
244   - var win = desktop.getWindow(this.id);
245   - if (win)
246   - {
247   - var explorerUI = win.query('#'+this.contentId);
248   - explorerUI[0].updateFilter();
249   - }
250   - }
251   - else
252   - Ext.Msg.show( {
253   - title : 'Filter',
254   - msg : 'Cannot apply filter',
255   - modal : true,
256   - icon : Ext.Msg.ERROR,
257   - buttons : Ext.Msg.OK
258   - });
259   - }
260   - else
261   - {
262   - // FAILURE
263   - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
264   - }
265   - },this);
266   - },
  221 + //
  222 + setCrtFilter : function()
  223 + {
  224 + var me = this;
  225 + //get current filter to apply
  226 + AmdaAction.getCrtFilterResult(function (result, e)
  227 + {
  228 + var t = e.getTransaction();
  229 + if (e.status)
  230 + {
  231 + if (result)
  232 + {
  233 + //apply current filter
  234 + this.filter = result;
  235 + // add saved filter to Explorer List
  236 + if (!this.filtersStore.getById(this.filter.id))
  237 + this.filtersStore.add({id : this.filter.id, name : this.filter.name});
  238 +
  239 + //apply filter to the tree
  240 + var desktop = myDesktopApp.getDesktop();
  241 + var win = desktop.getWindow(this.id);
  242 + if (win)
  243 + {
  244 + var explorerUI = win.query('#'+this.contentId);
  245 + explorerUI[0].updateFilter();
  246 + }
  247 + }
  248 + else
  249 + Ext.Msg.show( {
  250 + title : 'Filter',
  251 + msg : 'Cannot apply filter',
  252 + modal : true,
  253 + icon : Ext.Msg.ERROR,
  254 + buttons : Ext.Msg.OK
  255 + });
  256 + }
  257 + else
  258 + {
  259 + // FAILURE
  260 + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  261 + }
  262 + },this);
  263 + },
267 264  
268   - resetFilter : function()
269   - {
270   - AmdaAction.resetFilter(
271   - function (result, e)
272   - {
273   - var t = e.getTransaction();
274   - if (e.status)
275   - {
276   - if (result)
277   - {
278   - this.setCrtFilter();
279   -
280   - //update filter win
281   - var desktop = myDesktopApp.getDesktop();
282   - var win = desktop.getWindow(myDesktopApp.dynamicModules.filters.id);
283   - if (win)
284   - {
285   - var filterUI = win.query('panelFilters');
286   - filterUI[0].reloadFilter();
287   - }
288   - }
289   - else
290   - Ext.Msg.show( {
291   - title : 'Filter',
292   - msg : 'Cannot reset filter',
293   - modal : true,
294   - icon : Ext.Msg.ERROR,
295   - buttons : Ext.Msg.OK
296   - });
297   - }
298   - else
299   - {
300   - // FAILURE
301   - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
302   - }
303   - },this);
304   - },
  265 + resetFilter : function()
  266 + {
  267 + AmdaAction.resetFilter( function (result, e)
  268 + {
  269 + var t = e.getTransaction();
  270 + if (e.status)
  271 + {
  272 + if (result)
  273 + {
  274 + this.setCrtFilter();
  275 + //update filter win
  276 + var desktop = myDesktopApp.getDesktop();
  277 + var win = desktop.getWindow(myDesktopApp.dynamicModules.filters.id);
  278 + if (win)
  279 + {
  280 + var filterUI = win.query('panelFilters');
  281 + filterUI[0].reloadFilter();
  282 + }
  283 + }
  284 + else
  285 + Ext.Msg.show( {
  286 + title : 'Filter',
  287 + msg : 'Cannot reset filter',
  288 + modal : true,
  289 + icon : Ext.Msg.ERROR,
  290 + buttons : Ext.Msg.OK
  291 + });
  292 + }
  293 + else
  294 + {
  295 + // FAILURE
  296 + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  297 + }
  298 + },this);
  299 + },
305 300  
306   - getParamInfo : function(paramId, onReady) {
307   - if (this.paramInfoRegistry[paramId]) {
308   - if (onReady)
309   - onReady(this.paramInfoRegistry[paramId]);
310   - return this.paramInfoRegistry[paramId];
311   - }
312   -
313   - var me = this;
314   - AmdaAction.getParamInfo({"paramId" : paramId}, function (result, e) {
315   - var paramInfo = null;
316   - if (e.status === true)
317   - {
318   - if (!result.success)
319   - {
320   - //No available info for this parameter. Do not display an error message
321   - /*if (result.message && result.message != '')
322   - Ext.Msg.show({title:'Get parameter arguments error ', msg: result.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
323   - else
324   - Ext.Msg.show({title:'Get parameter arguments error', msg: 'Unknown error', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});*/
325   - }
326   - else
327   - {
328   - //Store parameter info in registry
329   - me.paramInfoRegistry[paramId] = result;
330   - paramInfo = result;
331   - }
332   - }
333   - else
334   - {
335   - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
336   - }
  301 + getParamInfo : function(paramId, onReady)
  302 + {
  303 + if (this.paramInfoRegistry[paramId])
  304 + {
  305 + if (onReady)
  306 + onReady(this.paramInfoRegistry[paramId]);
  307 + return this.paramInfoRegistry[paramId];
  308 + }
  309 +
  310 + var me = this;
  311 + AmdaAction.getParamInfo({"paramId" : paramId}, function (result, e)
  312 + {
  313 + var paramInfo = null;
  314 + if (e.status === true)
  315 + {
  316 + if (!result.success)
  317 + {
  318 + //No available info for this parameter. Do not display an error message
  319 + /*if (result.message && result.message != '')
  320 + Ext.Msg.show({title:'Get parameter arguments error ', msg: result.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  321 + else
  322 + Ext.Msg.show({title:'Get parameter arguments error', msg: 'Unknown error', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});*/
  323 + }
  324 + else
  325 + {
  326 + //Store parameter info in registry
  327 + me.paramInfoRegistry[paramId] = result;
  328 + paramInfo = result;
  329 + }
  330 + }
  331 + else
  332 + {
  333 + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  334 + }
337 335  
338   - if (onReady)
339   - onReady(paramInfo);
340   - });
341   - return null;
342   - }
  336 + if (onReady)
  337 + onReady(paramInfo);
  338 + });
  339 +
  340 + return null;
  341 + }
  342 +
343 343 });
... ...
js/app/views/DownloadUI.js
... ... @@ -395,11 +395,11 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
395 395 var el = me.body.dom;
396 396 var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
397 397 ddGroup: 'explorerTree',
398   - notifyEnter : function(ddSource, e, data)
399   - { },
  398 + notifyEnter : function(ddSource, e, data) { },
400 399 notifyOver : function(ddSource, e, data)
401 400 {
402   - if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) {
  401 + if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet'))
  402 + {
403 403 this.valid = false;
404 404 return this.dropNotAllowed;
405 405 }
... ... @@ -433,16 +433,28 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
433 433 idToSent = data.records[0].get('id');
434 434 if (data.records[0].get('alias')!= "" )
435 435 idToSent = "#"+data.records[0].get('alias');
436   -// var component_info = data.records[0].get('component_info');
437   -// if (component_info && component_info.parentId) {
438   -// //It's a component
439   -// idToSent = component_info.parentId;
440   -// components = [];
441   -// if (component_info.index1)
442   -// components['index1'] = component_info.index1;
443   -// if (component_info.index2)
444   -// components['index2'] = component_info.index2;
445   -// }
  436 + var component_info = data.records[0].get('component_info');
  437 + if (component_info && component_info.parentId)
  438 + {
  439 + if ( component_info.index1 && component_info.index2 )
  440 + {
  441 + idToSent = component_info.parentId;
  442 + components = [];
  443 + if (component_info.index1)
  444 + components['index1'] = component_info.index1;
  445 + if (component_info.index2)
  446 + components['index2'] = component_info.index2;
  447 + }
  448 + if ( data.records[0].get('needsArgs') )
  449 + {
  450 + idToSent = component_info.parentId;
  451 + if (component_info.index1)
  452 + {
  453 + components = [];
  454 + components['index1'] = component_info.index1;
  455 + }
  456 + }
  457 + }
446 458 break;
447 459 case 'alias' :
448 460 idToSent = "#"+data.records[0].get('text');
... ...
js/app/views/ParameterUI.js
... ... @@ -5,258 +5,277 @@
5 5 * @extends Ext.container.Container
6 6 * @brief Parameter Module UI definition (View)
7 7 * @author
8   - * @version $Id: ParameterUI.js 2257 2014-04-02 12:21:27Z elena $
9   - ********************************************************************************
10   - * FT Id : Date : Name - Description
11   - *******************************************************************************
12   - *
  8 + * @version $Id: ParameterUI.js 2257 2014-04-02 12:21:27Z elena $
13 9 */
14 10  
15   -Ext.define('amdaUI.ParameterUI', {
  11 +Ext.define('amdaUI.ParameterUI',
  12 +{
16 13 extend: 'Ext.container.Container',
17   -
  14 +
18 15 alias: 'widget.panelParam',
19 16  
20 17 requires: [
21   - 'amdaUI.AliasUI',
22   - 'amdaUI.CalculatorUI',
23   - 'extensions.SelectableTextArea',
24   - 'amdaUI.ParamArgumentsPlug'
25   - ],
  18 + 'amdaUI.AliasUI',
  19 + 'amdaUI.CalculatorUI',
  20 + 'extensions.SelectableTextArea',
  21 + 'amdaUI.ParamArgumentsPlug'
  22 + ],
26 23  
27   - constructor: function(config) {
28   - this.init(config);
29   - this.callParent(arguments);
30   - // load object into form
31   - this.formPanel.getForm().loadRecord(this.object);
32   - var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin');
33   - if (paramArgsPlug)
34   - paramArgsPlug.onApply = this.onApplyParameterArgs;
35   - },
  24 + constructor: function(config)
  25 + {
  26 + this.init(config);
  27 + this.callParent(arguments);
  28 + // load object into form
  29 + this.formPanel.getForm().loadRecord(this.object);
  30 + var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin');
  31 +
  32 + if (paramArgsPlug)
  33 + paramArgsPlug.onApply = this.onApplyParameterArgs;
  34 + },
36 35  
37   - addParamInEditor : function(param) {
38   - var selection = this.constructionField.getSelection();
39   - this.constructionField.setValue(selection.beforeText + param + selection.afterText);
40   - this.constructionField.focus();
41   - this.constructionField.setCaretPosition(this.constructionField.getValue().length);
42   - },
  36 + addParamInEditor : function(param)
  37 + {
  38 + var selection = this.constructionField.getSelection();
  39 + this.constructionField.setValue(selection.beforeText + param + selection.afterText);
  40 + this.constructionField.focus();
  41 + this.constructionField.setCaretPosition(this.constructionField.getValue().length);
  42 + },
43 43  
44   - onApplyParameterArgs : function(uiScope, paramRequestObject) {
45   - var fullParam = paramRequestObject.getParamFullName();
46   - uiScope.addParamInEditor(fullParam);
47   - },
  44 + onApplyParameterArgs : function(uiScope, paramRequestObject)
  45 + {
  46 + var fullParam = paramRequestObject.getParamFullName();
  47 + uiScope.addParamInEditor(fullParam);
  48 + },
48 49  
49   - addParam : function(newParamName, isLeaf, needArgs, components) {
50   - if (!isLeaf || needArgs || components)
51   - this.editParameterArgs(newParamName, components);
52   - else
53   - this.addParamInEditor(newParamName);
54   - },
  50 + addParam : function(newParamName, isLeaf, needArgs, components)
  51 + {
  52 + if (!isLeaf || needArgs || components)
  53 + this.editParameterArgs(newParamName, components);
  54 + else
  55 + this.addParamInEditor(newParamName);
  56 + },
55 57  
56   - editParameterArgs: function(name, components) {
57   - var paramObj = {
58   - paramid: name,
59   - type: 0,
60   - 'dim1-is-range': false,
61   - 'dim1-min-range': 0.,
62   - 'dim1-max-range': 0.,
63   - 'dim1-index': '*',
64   - 'dim2-is-range': false,
65   - 'dim2-min-range': 0.,
66   - 'dim2-max-range': 0.,
67   - 'dim2-index': '*',
68   - template_args: {}
69   - };
70   -
71   - if (components) {
72   - if (components['index1']) {
73   - paramObj['dim1-index'] = components['index1'];
74   - ++paramObj['type'];
75   - }
76   -
77   - if (components['index2']) {
78   - paramObj['dim2-index'] = components['index2'];
79   - ++paramObj['type'];
80   - }
81   - }
82   -
  58 + editParameterArgs: function(name, components)
  59 + {
  60 + var paramObj = {
  61 + paramid: name,
  62 + type: 0,
  63 + 'dim1-is-range': false,
  64 + 'dim1-min-range': 0.,
  65 + 'dim1-max-range': 0.,
  66 + 'dim1-index': '*',
  67 + 'dim2-is-range': false,
  68 + 'dim2-min-range': 0.,
  69 + 'dim2-max-range': 0.,
  70 + 'dim2-index': '*',
  71 + template_args: {}
  72 + };
  73 +
  74 + if (components)
  75 + {
  76 + if (components['index1']) {
  77 + paramObj['dim1-index'] = components['index1'];
  78 + ++paramObj['type'];
  79 + }
  80 +
  81 + if (components['index2']) {
  82 + paramObj['dim2-index'] = components['index2'];
  83 + ++paramObj['type'];
  84 + }
  85 + }
  86 +
83 87 var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin');
  88 +
84 89 if (paramArgsPlug) {
85 90 var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj);
86 91 paramArgsPlug.show('derived-param-arguments-plugin', workinRequestParamObject);
87 92 }
88 93 },
89 94  
90   - setObject : function (object) {
91   - this.object = object;
92   - // load object into form
93   - this.formPanel.getForm().loadRecord(this.object);
94   - },
  95 + setObject : function (object)
  96 + {
  97 + this.object = object;
  98 + // load object into form
  99 + this.formPanel.getForm().loadRecord(this.object);
  100 + },
95 101  
96   -/**
97   -* update this.object from form
98   -*/
99   - updateObject : function(){
100   - // get the basic form
101   - var basicForm = this.formPanel.getForm();
102   - var updateStatus = true;
  102 + /**
  103 + * update this.object from form
  104 + */
  105 + updateObject : function()
  106 + {
  107 + // get the basic form
  108 + var basicForm = this.formPanel.getForm();
  109 + var updateStatus = true;
103 110  
104   - var fieldsWithoutName = basicForm.getFields().items;
105   - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){
106   - if(item !== this.fieldName) {
107   - if (!item.isValid()) {
108   - // set update isn't allowed
109   - updateStatus = false;
  111 + var fieldsWithoutName = basicForm.getFields().items;
  112 + Ext.Array.each(fieldsWithoutName, function(item, index,allItems)
  113 + {
  114 + if(item !== this.fieldName)
  115 + {
  116 + if (!item.isValid()) {
  117 + // set update isn't allowed
  118 + updateStatus = false;
  119 + }
  120 + }
  121 + }, this);
  122 + // if the update is allowed
  123 + if (updateStatus) {
  124 + /// real object update
  125 + // update TimeTable object with the content of form
  126 + basicForm.updateRecord(this.object);
110 127 }
111   - }
112   - }, this);
113   - // if the update is allowed
114   - if (updateStatus) {
115   - /// real object update
116   - // update TimeTable object with the content of form
117   - basicForm.updateRecord(this.object);
118   - }
119   - // return the update status
120   - return updateStatus;
121   - },
  128 + // return the update status
  129 + return updateStatus;
  130 + },
122 131  
123   - updateConstruct : function(oldval,newval) {
  132 + updateConstruct : function(oldval,newval)
  133 + {
124 134 // update constructionField (Construct parameter) in window parameter
125 135 var expression = this.constructionField.value;
126 136 oldval = oldval.replace(/[(]/g,"\\(");
127 137 oldval = oldval.replace(/[)]/g,"\\)");
128 138 var reg=new RegExp(oldval, "g");
129   - expression = expression.replace(reg, newval);
130   - this.constructionField.setValue(expression);
  139 + expression = expression.replace(reg, newval);
  140 + this.constructionField.setValue(expression);
131 141 },
132 142  
133 143 /**
134 144 * Parameter compilation
135 145 */
136   - compilParam : function($action) {
  146 + compilParam : function($action)
  147 + {
137 148 var obj = {
138   - paramId : 'ws_'+this.object.get('name')
139   - };
140   - AmdaAction.compilParam(obj, function (result, e) {
141   - if (!result || !result.success)
142   - {
143   - if (result.message)
144   - myDesktopApp.warningMsg(result.message);
145   - else
146   - myDesktopApp.warningMsg('Unknown error during parameter compilation');
147   - return;
148   - }
149   - });
  149 + paramId : 'ws_'+this.object.get('name')
  150 + };
  151 + AmdaAction.compilParam(obj, function (result, e) {
  152 + if (!result || !result.success)
  153 + {
  154 + if (result.message)
  155 + myDesktopApp.warningMsg(result.message);
  156 + else
  157 + myDesktopApp.warningMsg('Unknown error during parameter compilation');
  158 + return;
  159 + }
  160 + });
150 161 },
151 162  
152   - /**
153   - * save method called by Save button
154   - */
155   - saveProcess : function(toRename){
156   -
157   - if(this.object.dirty) {
158   - // Parameter Module
159   - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
160   - // if the name has been modified this is a creation
161   - if (this.object.isModified('name')){
162   - // if object already has an id : it's a 'rename' of an existing TimeTable
163   - if (this.object.get('id')){
164   - // the context Node is the parent node of current edited one
165   - var contextNode = paramModule.linkedNode.parentNode;
166   - // link a new node to the TimeTableModule
167   - paramModule.createLinkedNode();
168   - // set the contextNode
169   - paramModule.linkedNode.set('contextNode',contextNode);
170   - // create a new object linked
171   - paramModule.createObject(this.object.getJsonValues());
172   - var paramobj = paramModule.linkedNode.get('object');
173   - //synchronize objects
174   - this.object = paramobj;
175   - if (toRename) paramModule.linkedNode.toRename = true;
176   - }
177   - paramModule.linkedNode.create({scope : this, callback : this.compilParam});
178   - paramModule.linkedNode.set('iconCls', 'icon-scalar');
179   - paramModule.linkedNode.set('isParameter', true);
180   -
181   - // fire creation event
182   - // this.object.fireEvent('create');
183   - } else {
184   - paramModule.linkedNode.set('contextNode',paramModule.contextNode);
185   - paramModule.linkedNode.update({scope : this, callback : this.compilParam});
186   - // this.object.fireEvent('modify');
187   - }
188   - }
189   - },
  163 + /**
  164 + * save method called by Save button
  165 + */
  166 + saveProcess : function(toRename)
  167 + {
  168 + if(this.object.dirty)
  169 + {
  170 + // Parameter Module
  171 + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
  172 + // if the name has been modified this is a creation
  173 + if (this.object.isModified('name'))
  174 + {
  175 + // if object already has an id : it's a 'rename' of an existing TimeTable
  176 + if (this.object.get('id'))
  177 + {
  178 + // the context Node is the parent node of current edited one
  179 + var contextNode = paramModule.linkedNode.parentNode;
  180 + // link a new node to the TimeTableModule
  181 + paramModule.createLinkedNode();
  182 + // set the contextNode
  183 + paramModule.linkedNode.set('contextNode',contextNode);
  184 + // create a new object linked
  185 + paramModule.createObject(this.object.getJsonValues());
  186 + var paramobj = paramModule.linkedNode.get('object');
  187 + //synchronize objects
  188 + this.object = paramobj;
  189 + if (toRename) paramModule.linkedNode.toRename = true;
  190 + }
  191 + paramModule.linkedNode.create({scope : this, callback : this.compilParam});
  192 + paramModule.linkedNode.set('iconCls', 'icon-scalar');
  193 + paramModule.linkedNode.set('isParameter', true);
  194 + } else
  195 + {
  196 + paramModule.linkedNode.set('contextNode',paramModule.contextNode);
  197 + paramModule.linkedNode.update({scope : this, callback : this.compilParam});
  198 + }
  199 + }
  200 + },
190 201  
191   - /**
192   - * overwrite metod called by Save button
193   - */
194   - overwriteProcess : function(btn){
195   - if (btn == 'cancel') return;
196   -
197   - this.fieldName.clearInvalid();
198   - this.saveProcess(true);
199   - },
  202 + /**
  203 + * overwrite metod called by Save button
  204 + */
  205 + overwriteProcess : function(btn)
  206 + {
  207 + if (btn == 'cancel') return;
  208 +
  209 + this.fieldName.clearInvalid();
  210 + this.saveProcess(true);
  211 + },
200 212  
201   - /**
202   - * Check if brackets are balanced
203   - */
204   - isBalanced : function(str){
205   - str = (""+str).replace(/[^()\[\]{}]/g, "");
206   - var bracket = {
207   - "]": "[",
208   - "}": "{",
209   - ")": "("
210   - },
211   - openBrackets = [],
212   - isClean = true,
213   - i = 0,
214   - len = str.length;
  213 + /**
  214 + * Check if brackets are balanced
  215 + */
  216 + isBalanced : function(str)
  217 + {
  218 + str = (""+str).replace(/[^()\[\]{}]/g, "");
  219 + var bracket = {
  220 + "]": "[",
  221 + "}": "{",
  222 + ")": "("
  223 + },
  224 + openBrackets = [],
  225 + isClean = true,
  226 + i = 0,
  227 + len = str.length;
215 228  
216   - for(; isClean && i<len; i++ ){
217   - if( bracket[ str[ i ] ] ){
218   - isClean = ( openBrackets.pop() === bracket[ str[ i ] ] );
219   - }else{
220   - openBrackets.push(str[i]);
221   - }
222   - }
223   - if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced';
224   -
225   - return true;
226   - },
  229 + for(; isClean && i<len; i++ )
  230 + {
  231 + if( bracket[ str[ i ] ] ){
  232 + isClean = ( openBrackets.pop() === bracket[ str[ i ] ] );
  233 + } else {
  234 + openBrackets.push(str[i]);
  235 + }
  236 + }
  237 + if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced';
  238 +
  239 + return true;
  240 + },
  241 +
227 242 /**
228 243 * Check if changes were made before closing window
229 244 * @return true if changes
230 245 */
231   - fclose : function() {
  246 + fclose : function()
  247 + {
232 248 var isDirty = this.formPanel.getForm().isDirty();
233 249 return isDirty;
234 250 },
235 251  
236   - init: function(config) {
237   -
  252 + init: function(config)
  253 + {
238 254 this.fieldName = new Ext.form.field.Text({
239   - labelAlign: 'top', itemId: 'formParamName',
240   - fieldLabel: 'Parameter Name*',
241   - name : 'name',
242   - allowBlank : false, //blankText : 'Name is required',
243   - emptyText: 'Please only low case here!',
244   - width: 150,
245   - validateOnChange: false,
246   - validateOnBlur: false,
247   - enableKeyEvents: true,
248   - validFlag: false,
249   - validator : function() {
250   - return this.validFlag;
251   - },
252   - stripCharsRe: /(^\s+|\s+$)/g,
253   - listeners : {
254   - keyUp : function(field, e, opt) {
255   - this.setValue(this.getValue().toLowerCase());
256   - }
257   - }
  255 + labelAlign: 'top', itemId: 'formParamName',
  256 + fieldLabel: 'Parameter Name*',
  257 + name : 'name',
  258 + allowBlank : false, //blankText : 'Name is required',
  259 + emptyText: 'Please only low case here!',
  260 + width: 150,
  261 + validateOnChange: false,
  262 + validateOnBlur: false,
  263 + enableKeyEvents: true,
  264 + validFlag: false,
  265 + validator : function()
  266 + {
  267 + return this.validFlag;
  268 + },
  269 + stripCharsRe: /(^\s+|\s+$)/g,
  270 + listeners :
  271 + {
  272 + keyUp : function(field, e, opt)
  273 + {
  274 + this.setValue(this.getValue().toLowerCase());
  275 + }
  276 + }
258 277 });
259   -
  278 +
260 279 this.constructionField = new extensions.SelectableTextArea({
261 280 labelAlign: 'top',
262 281 itemId: 'formParamConstructParameter',
... ... @@ -266,92 +285,106 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;, {
266 285 flex: 0.9,
267 286 validateOnChange: false,
268 287 validateOnBlur: false,
269   - validator : this.isBalanced,
  288 + validator : this.isBalanced,
270 289 // ToDo - BRE - Wait the fix for drag&drop issue
271 290 listeners :
272 291 {
273   - render : function(o,op)
274   - {
275   - var me = this;
276   - var meEl = me.bodyEl;
277   - var dropTarget = Ext.create('Ext.dd.DropTarget', meEl, {
278   - ddGroup: 'explorerTree',
279   - notifyEnter : function(ddSource, e, data)
280   - {
281   - },
282   - notifyOver : function(ddSource, e, data)
283   - {
284   - if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) {
285   - this.valid = false;
286   - return this.dropNotAllowed;
287   - }
288   - if (((data.records[0].data.nodeType == 'localParam') ||
289   - (data.records[0].data.nodeType == 'remoteParam') ||
290   - (data.records[0].data.nodeType == 'remoteSimuParam') ||
291   - (data.records[0].data.nodeType == 'derivedParam') ||
292   - (data.records[0].data.nodeType == 'myDataParam') ||
293   - (data.records[0].data.nodeType == 'alias')) &&
294   - //(data.records[0].data.leaf) &&
295   - !(data.records[0].data.disable))
296   - {
297   - this.valid = true;
298   - return this.dropAllowed;
299   - }
300   - this.valid = false;
301   - return this.dropNotAllowed;
302   - },
303   - notifyDrop : function(ddSource, e, data)
304   - {
305   - if (!this.valid)
306   - return false;
307   - var nameToSent;
308   - var components = null;
309   - switch (data.records[0].data.nodeType)
310   - {
311   - case 'localParam' :
312   - case 'remoteParam' :
313   - case 'remoteSimuParam' :
314   - nameToSent = data.records[0].get('id');
315   - if (data.records[0].get('alias')!= "" )
316   - var nameToSent = "#"+data.records[0].get('alias');
317   -// var component_info = data.records[0].get('component_info');
318   -// if (component_info && component_info.parentId) {
319   -// //It's a component
320   -// nameToSent = component_info.parentId;
321   -// components = [];
322   -// if (component_info.index1)
323   -// components['index1'] = component_info.index1;
324   -// if (component_info.index2)
325   -// components['index2'] = component_info.index2;
326   -// }
327   - break;
328   - case 'alias' :
329   - nameToSent = "#"+data.records[0].get('text');
330   - break;
331   - case 'derivedParam' :
332   - nameToSent = "ws_"+data.records[0].get('text');
333   - break;
334   - case 'myDataParam' :
335   - var name = data.records[0].get('text');
336   - nameToSent = "wsd_"+name;
337   - var size = data.records[0].get('size');
338   - if (size && size > 1) {
339   - nameToSent += "(0)";
340   - myDesktopApp.warningMsg("parameter "+name+" is array of size: "
341   - +size+"<br/>Please put index");
342   - }
343   - break;
344   - default :
345   - return false;
346   - }
347   - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
348   - if (paramModule) {
349   - paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
350   - }
351   - return true;
352   - }
353   - });
354   - }
  292 + render : function(o,op)
  293 + {
  294 + var me = this;
  295 + var meEl = me.bodyEl;
  296 + var dropTarget = Ext.create('Ext.dd.DropTarget', meEl,
  297 + {
  298 + ddGroup: 'explorerTree',
  299 + notifyEnter : function(ddSource, e, data) {},
  300 + notifyOver : function(ddSource, e, data)
  301 + {
  302 + if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet'))
  303 + {
  304 + this.valid = false;
  305 + return this.dropNotAllowed;
  306 + }
  307 +
  308 + if (((data.records[0].data.nodeType == 'localParam') ||
  309 + (data.records[0].data.nodeType == 'remoteParam') ||
  310 + (data.records[0].data.nodeType == 'remoteSimuParam') ||
  311 + (data.records[0].data.nodeType == 'derivedParam') ||
  312 + (data.records[0].data.nodeType == 'myDataParam') ||
  313 + (data.records[0].data.nodeType == 'alias')) &&
  314 + //(data.records[0].data.leaf) &&
  315 + !(data.records[0].data.disable))
  316 + {
  317 + this.valid = true;
  318 + return this.dropAllowed;
  319 + }
  320 + this.valid = false;
  321 + return this.dropNotAllowed;
  322 + },
  323 + notifyDrop : function(ddSource, e, data)
  324 + {
  325 + if (!this.valid)
  326 + return false;
  327 + var nameToSent;
  328 + var components = null;
  329 + switch (data.records[0].data.nodeType)
  330 + {
  331 + case 'localParam' :
  332 + case 'remoteParam' :
  333 + case 'remoteSimuParam' :
  334 + nameToSent = data.records[0].get('id');
  335 + if (data.records[0].get('alias')!= "" )
  336 + var nameToSent = "#"+data.records[0].get('alias');
  337 + var component_info = data.records[0].get('component_info');
  338 + if (component_info && component_info.parentId)
  339 + {
  340 + if ( component_info.index1 && component_info.index2 )
  341 + {
  342 + nameToSent = component_info.parentId;
  343 + components = [];
  344 + if (component_info.index1)
  345 + components['index1'] = component_info.index1;
  346 + if (component_info.index2)
  347 + components['index2'] = component_info.index2;
  348 + }
  349 + if ( data.records[0].get('needsArgs') )
  350 + {
  351 + nameToSent = component_info.parentId;
  352 + if (component_info.index1)
  353 + {
  354 + components = [];
  355 + components['index1'] = component_info.index1;
  356 + }
  357 + }
  358 + }
  359 + break;
  360 + case 'alias' :
  361 + nameToSent = "#"+data.records[0].get('text');
  362 + break;
  363 + case 'derivedParam' :
  364 + nameToSent = "ws_"+data.records[0].get('text');
  365 + break;
  366 + case 'myDataParam' :
  367 + var name = data.records[0].get('text');
  368 + nameToSent = "wsd_"+name;
  369 + var size = data.records[0].get('size');
  370 + if (size && size > 1)
  371 + {
  372 + nameToSent += "(0)";
  373 + myDesktopApp.warningMsg("parameter "+name+" is array of size: "
  374 + +size+"<br/>Please put index");
  375 + }
  376 + break;
  377 + default :
  378 + return false;
  379 + }
  380 + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
  381 + if (paramModule) {
  382 + paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  383 + }
  384 + return true;
  385 + }
  386 + });
  387 + }
355 388 }
356 389 //TODO: ?validator on formula structure?
357 390 // listener : {
... ... @@ -369,131 +402,138 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;, {
369 402 region: 'center',
370 403 trackResetOnLoad: true, //reset to the last loaded record
371 404 layout: {
372   - type: 'vbox',
373   - defaultMargins: {top: 10, left:10, bottom:5, right:5},
374   - align: 'stretch'
  405 + type: 'vbox',
  406 + defaultMargins: {top: 10, left:10, bottom:5, right:5},
  407 + align: 'stretch'
375 408 },
376 409 defaults: {
377   - border: false
  410 + border: false
378 411 },
379 412 items: [
380 413 {
381   - flex: 1,
382   - xtype: 'container',
383   - border: false,
384   - layout: {
385   - type: 'table',
386   - columns: 3
387   - },
388   - defaultType: 'textfield',
389   - defaults: {
390   - labelAlign: 'top'
391   - },
392   - items: [
393   - this.fieldName,
394   - {
395   - xtype:'component', width: 20
396   - },{
397   - itemId: 'formParamTimeStep', fieldLabel: 'Time Step (sec)*', labelAlign: 'top',
398   - allowBlank : false, blankText : 'Time Step is required',
399   - name : 'timestep',
400   - regex : new RegExp('^[0-9]+$'),
401   - regexText : 'Time Step has to be a numeric value',
402   - width: 150, validateOnChange: false,
403   - validateOnBlur: false
404   - },{
405   - xtype: 'textfield',
406   - itemId: 'formParamUnit',
407   - fieldLabel: 'Units',
408   - name : 'units',
409   - width: 150
410   - },{
411   - xtype:'component', width: 20
412   - },{
413   - xtype: 'textfield',
414   - itemId: 'formParamYTitle',
415   - fieldLabel: 'Y Title for Plot',
416   - name : 'ytitle',
417   - width: 150
418   - },{
419   - xtype: 'textfield',
420   - itemId: 'formParamDescription',
421   - name: 'description',
422   - xtype: 'textarea', fieldLabel:'Description',
423   - width: 320, height: 75,
424   - colspan: 3
425   - }]
426   - },
427   - this.constructionField
  414 + flex: 1,
  415 + xtype: 'container',
  416 + border: false,
  417 + layout: {
  418 + type: 'table',
  419 + columns: 3
  420 + },
  421 + defaultType: 'textfield',
  422 + defaults: {
  423 + labelAlign: 'top'
  424 + },
  425 + items: [
  426 + this.fieldName,
  427 + {
  428 + xtype:'component', width: 20
  429 + },
  430 + {
  431 + itemId: 'formParamTimeStep', fieldLabel: 'Time Step (sec)*', labelAlign: 'top',
  432 + allowBlank : false, blankText : 'Time Step is required',
  433 + name : 'timestep',
  434 + regex : new RegExp('^[0-9]+$'),
  435 + regexText : 'Time Step has to be a numeric value',
  436 + width: 150, validateOnChange: false,
  437 + validateOnBlur: false
  438 + },
  439 + {
  440 + xtype: 'textfield',
  441 + itemId: 'formParamUnit',
  442 + fieldLabel: 'Units',
  443 + name : 'units',
  444 + width: 150
  445 + },
  446 + {
  447 + xtype:'component', width: 20
  448 + },
  449 + {
  450 + xtype: 'textfield',
  451 + itemId: 'formParamYTitle',
  452 + fieldLabel: 'Y Title for Plot',
  453 + name : 'ytitle',
  454 + width: 150
  455 + },
  456 + {
  457 + xtype: 'textfield',
  458 + itemId: 'formParamDescription',
  459 + name: 'description',
  460 + xtype: 'textarea', fieldLabel:'Description',
  461 + width: 320, height: 75,
  462 + colspan: 3
  463 + }]
  464 + },
  465 + this.constructionField
428 466 ],
429 467 fbar: [
430 468 {
431   - text: 'Save',
432   - scope : this,
433   - handler: function(){
434   - if (this.updateObject()){
435   - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
436   - if (!paramModule)
437   - return;
438   - var me = this;
439   - paramModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) {
440   - if (!res)
441   - {
442   - me.fieldName.validFlag = 'Error during object validation';
443   - myDesktopApp.errorMsg(me.fieldName.validFlag);
444   - me.fieldName.validate();
445   - return;
446   - }
  469 + text: 'Save',
  470 + scope : this,
  471 + handler: function(){
  472 + if (this.updateObject())
  473 + {
  474 + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
  475 + if (!paramModule)
  476 + return;
  477 + var me = this;
  478 + paramModule.linkedNode.isValidName(this.fieldName.getValue(), function (res)
  479 + {
  480 + if (!res)
  481 + {
  482 + me.fieldName.validFlag = 'Error during object validation';
  483 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  484 + me.fieldName.validate();
  485 + return;
  486 + }
447 487  
448   - if (!res.valid)
449   - {
450   - if (res.error)
451   - {
452   - if (res.error.search('subtree') != -1) {
453   - Ext.MessageBox.show({title:'Warning',
454   - msg: res.error+'<br/>Do you want to overwrite it?',
455   - width: 300,
456   - buttons: Ext.MessageBox.OKCANCEL,
457   - fn : me.overwriteProcess,
458   - icon: Ext.MessageBox.WARNING,
459   - scope : me
460   - });
461   - me.fieldName.validFlag = true;
462   - }
463   - else
464   - me.fieldName.validFlag = res.error;
465   - }
466   - else
467   - {
468   - me.fieldName.validFlag = 'Invalid object name';
469   - myDesktopApp.errorMsg(me.fieldName.validFlag);
470   - }
471   - me.fieldName.validate();
472   - return;
473   - }
474   -
475   - me.fieldName.validFlag = true;
476   - me.fieldName.validate();
477   - me.saveProcess(false);
478   - });
479   -
480   - }
481   - }
  488 + if (!res.valid)
  489 + {
  490 + if (res.error)
  491 + {
  492 + if (res.error.search('subtree') != -1) {
  493 + Ext.MessageBox.show({title:'Warning',
  494 + msg: res.error+'<br/>Do you want to overwrite it?',
  495 + width: 300,
  496 + buttons: Ext.MessageBox.OKCANCEL,
  497 + fn : me.overwriteProcess,
  498 + icon: Ext.MessageBox.WARNING,
  499 + scope : me
  500 + });
  501 + me.fieldName.validFlag = true;
  502 + }
  503 + else
  504 + me.fieldName.validFlag = res.error;
  505 + }
  506 + else
  507 + {
  508 + me.fieldName.validFlag = 'Invalid object name';
  509 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  510 + }
  511 + me.fieldName.validate();
  512 + return;
  513 + }
  514 +
  515 + me.fieldName.validFlag = true;
  516 + me.fieldName.validate();
  517 + me.saveProcess(false);
  518 + });
  519 + }
  520 + }
482 521 },
483 522 {
484   - text: 'Reset',
485   - scope: this,
486   - handler: function(){
487   - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
488   - paramModule.createLinkedNode();
489   - paramModule.createObject();
490   - this.setObject(paramModule.getLinkedNode().get('object'));
491   - /* reset with keeping old object
492   - this.formPanel.getForm().reset();
493   - */
494   - }
  523 + text: 'Reset',
  524 + scope: this,
  525 + handler: function()
  526 + {
  527 + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
  528 + paramModule.createLinkedNode();
  529 + paramModule.createObject();
  530 + this.setObject(paramModule.getLinkedNode().get('object'));
  531 + /* reset with keeping old object
  532 + this.formPanel.getForm().reset();
  533 + */
  534 + }
495 535 }
496   - ]
  536 + ]
497 537 });
498 538  
499 539 var myConf = {
... ... @@ -501,21 +541,24 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;, {
501 541 border: false,
502 542 defaults: { layout: 'fit', border: false },
503 543 items: [
504   - this.formPanel,
505   - {
506   - xtype: 'panel', region: 'south',
507   - title: 'Information',
508   - collapsible: true,
509   - height: 100,
510   - autoHide: false,
511   - iconCls: 'icon-information',
512   - bodyStyle: 'padding:5px',
513   - loader: {
514   - autoLoad: true,
515   - url: helpDir+'myParameterHOWTO'
516   - }
  544 + this.formPanel,
  545 + {
  546 + xtype: 'panel', region: 'south',
  547 + title: 'Information',
  548 + collapsible: true,
  549 + height: 100,
  550 + autoHide: false,
  551 + iconCls: 'icon-information',
  552 + bodyStyle: 'padding:5px',
  553 + loader: {
  554 + autoLoad: true,
  555 + url: helpDir+'myParameterHOWTO'
  556 + }
517 557 } ],
518   - plugins: [ {ptype: 'calculator', myBtns:[], context: 'Parameter' }, {ptype: 'paramArgumentsPlugin', pluginId: 'derived-param-arguments-plugin'}]
  558 + plugins: [
  559 + {ptype: 'calculator', myBtns:[], context: 'Parameter' },
  560 + {ptype: 'paramArgumentsPlugin', pluginId: 'derived-param-arguments-plugin'}
  561 + ]
519 562 };
520 563  
521 564 Ext.apply(this, Ext.apply(arguments, myConf));
... ...
js/app/views/SearchUI.js
... ... @@ -8,7 +8,8 @@
8 8 * @version $Id: SearchUI.js 2467 2014-07-10 16:06:26Z myriam $
9 9 */
10 10  
11   -Ext.define('amdaUI.SearchUI', {
  11 +Ext.define('amdaUI.SearchUI',
  12 +{
12 13 extend: 'Ext.container.Container',
13 14 alias: 'widget.panelSearch',
14 15  
... ... @@ -19,560 +20,601 @@ Ext.define(&#39;amdaUI.SearchUI&#39;, {
19 20 'amdaUI.ParamArgumentsPlug'
20 21 ],
21 22  
22   - constructor: function(config) {
23   -
24   - this.init(config);
25   - this.callParent(arguments);
26   - // load object into view
27   - this.loadObject();
28   -
29   - var searchArgsPlug = this.getPlugin('search-param-components-plugin');
30   - if (searchArgsPlug)
31   - searchArgsPlug.onApply = this.onApplyParameterArgs;
  23 + constructor: function(config)
  24 + {
  25 + this.init(config);
  26 + this.callParent(arguments);
  27 + // load object into view
  28 + this.loadObject();
  29 +
  30 + var searchArgsPlug = this.getPlugin('search-param-components-plugin');
  31 + if (searchArgsPlug)
  32 + searchArgsPlug.onApply = this.onApplyParameterArgs;
32 33 },
33 34  
34   - addTT : function(newTTName,newTTid){
35   - this.timeSelector.addTT(newTTName,newTTid);
  35 + addTT : function(newTTName,newTTid)
  36 + {
  37 + this.timeSelector.addTT(newTTName,newTTid);
36 38 },
37 39  
38   - addTTs : function(TTarray) {
39   - // set TTTab
40   - this.timeSelector.setTTTab(TTarray);
41   - },
42   - addParam : function(newParamName, isLeaf, needArgs, components) {
43   - if (!isLeaf || needArgs || components)
44   - this.editParameterArgs(newParamName, components);
45   - else
46   - this.addParamInEditor(newParamName);
47   - },
  40 + addTTs : function(TTarray)
  41 + {
  42 + // set TTTab
  43 + this.timeSelector.setTTTab(TTarray);
  44 + },
  45 +
  46 + addParam : function(newParamName, isLeaf, needArgs, components)
  47 + {
  48 + if (!isLeaf || needArgs || components)
  49 + this.editParameterArgs(newParamName, components);
  50 + else
  51 + this.addParamInEditor(newParamName);
  52 + },
48 53  
49   - addParamInEditor : function(param) {
50   - var selection = this.constructionField.getSelection();
51   - this.constructionField.setValue(selection.beforeText + param + selection.afterText);
52   - this.constructionField.focus();
53   - this.constructionField.setCaretPosition(this.constructionField.getValue().length);
54   - },
  54 + addParamInEditor : function(param)
  55 + {
  56 + var selection = this.constructionField.getSelection();
  57 + this.constructionField.setValue(selection.beforeText + param + selection.afterText);
  58 + this.constructionField.focus();
  59 + this.constructionField.setCaretPosition(this.constructionField.getValue().length);
  60 + },
55 61  
56   - onApplyParameterArgs : function(uiScope, paramRequestObject) {
57   - var fullParam = paramRequestObject.getParamFullName();
58   - uiScope.addParamInEditor(fullParam);
59   - },
  62 + onApplyParameterArgs : function(uiScope, paramRequestObject)
  63 + {
  64 + var fullParam = paramRequestObject.getParamFullName();
  65 + uiScope.addParamInEditor(fullParam);
  66 + },
60 67  
61   - editParameterArgs: function(name, components) {
62   - var paramObj = {
63   - paramid: name,
64   - type: 0,
65   - 'dim1-is-range': false,
66   - 'dim1-min-range': 0.,
67   - 'dim1-max-range': 0.,
68   - 'dim1-index': '*',
69   - 'dim2-is-range': false,
70   - 'dim2-min-range': 0.,
71   - 'dim2-max-range': 0.,
72   - 'dim2-index': '*',
73   - template_args: {}
74   - };
  68 + editParameterArgs: function(name, components)
  69 + {
  70 + var paramObj = {
  71 + paramid: name,
  72 + type: 0,
  73 + 'dim1-is-range': false,
  74 + 'dim1-min-range': 0.,
  75 + 'dim1-max-range': 0.,
  76 + 'dim1-index': '*',
  77 + 'dim2-is-range': false,
  78 + 'dim2-min-range': 0.,
  79 + 'dim2-max-range': 0.,
  80 + 'dim2-index': '*',
  81 + template_args: {}
  82 + };
75 83  
76   - if (components) {
77   - if (components['index1']) {
78   - paramObj['dim1-index'] = components['index1'];
79   - ++paramObj['type'];
80   - }
81   -
82   - if (components['index2']) {
83   - paramObj['dim2-index'] = components['index2'];
84   - ++paramObj['type'];
85   - }
86   - }
  84 + if (components) {
  85 + if (components['index1']) {
  86 + paramObj['dim1-index'] = components['index1'];
  87 + ++paramObj['type'];
  88 + }
  89 +
  90 + if (components['index2']) {
  91 + paramObj['dim2-index'] = components['index2'];
  92 + ++paramObj['type'];
  93 + }
  94 + }
87 95  
88   - var paramArgsPlug = this.getPlugin('search-param-components-plugin');
89   - if (paramArgsPlug) {
90   - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj);
91   - paramArgsPlug.show('search-param-components-plugin', workinRequestParamObject);
92   - }
93   - },
  96 + var paramArgsPlug = this.getPlugin('search-param-components-plugin');
  97 + if (paramArgsPlug) {
  98 + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj);
  99 + paramArgsPlug.show('search-param-components-plugin', workinRequestParamObject);
  100 + }
  101 + },
94 102  
95   - /**
96   - * Set Start-Stop from parameter info (Local & MyData)
97   - */
98   - setTimeFromData : function(obj) {
99   -
100   - var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
101   - var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
102   -
103   - this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop });
104   - },
  103 + /**
  104 + * Set Start-Stop from parameter info (Local & MyData)
  105 + */
  106 + setTimeFromData : function(obj)
  107 + {
  108 + var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
  109 + var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
  110 +
  111 + this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop });
  112 + },
105 113  
106   - setObject : function(obj) {
107   - this.object = obj;
108   - this.loadObject();
109   - },
  114 + setObject : function(obj)
  115 + {
  116 + this.object = obj;
  117 + this.loadObject();
  118 + },
110 119  
111 120 /**
112 121 * update this.object from form
113 122 */
114   - updateObject : function(){
115   - // get the basic form
116   - var basicForm = this.formPanel.getForm();
117   - // get the timeSource selected
118   - var timeSource = this.timeSelector.getActiveTimeSource();
119   - var updateStatus = true;
  123 + updateObject : function()
  124 + {
  125 + // get the basic form
  126 + var basicForm = this.formPanel.getForm();
  127 + // get the timeSource selected
  128 + var timeSource = this.timeSelector.getActiveTimeSource();
  129 + var updateStatus = true;
120 130  
121   - var fieldsWithoutName = basicForm.getFields().items;
122   - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){
123   - if(item !== this.fieldName) {
124   - if (!item.isValid()) {
125   - if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) &&
126   - ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) {
127   - updateStatus = true;
128   - }
129   - else {
130   - // set update isn't allowed
131   - updateStatus = false;
132   - return false;
133   - }
134   - }
135   - }
136   - }, this);
  131 + var fieldsWithoutName = basicForm.getFields().items;
  132 + Ext.Array.each(fieldsWithoutName, function(item, index,allItems)
  133 + {
  134 + if(item !== this.fieldName)
  135 + {
  136 + if (!item.isValid())
  137 + {
  138 + if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) &&
  139 + ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) {
  140 + updateStatus = true;
  141 + }
  142 + else {
  143 + // set update isn't allowed
  144 + updateStatus = false;
  145 + return false;
  146 + }
  147 + }
  148 + }
  149 + }, this);
137 150  
138   - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
  151 + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
139 152 && this.timeSelector.TTGrid.getStore().count() == 0) {
140 153  
141   - Ext.Msg.show({
142   - title: 'Warning', msg: 'You chose Time Selection `by TimeTable` but no timeTable was added!'
143   - +'<br>You must add one or choose Time Selection `by Interval`',
144   - icon: Ext.MessageBox.WARNING, buttons: Ext.Msg.OK
145   - });
146   - updateStatus = false;
147   - }
148   - // if the update is allowed
149   - if (updateStatus) {
150   - /// real object update
151   - // update TimeTable object with the content of form
152   - basicForm.updateRecord(this.object);
153   - this.object.set('timesrc', timeSource);
154   - // set valid intervals into TimeTable object
155   - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) {
156   - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
157   - }
158   - }
159   - // return the update status
160   - return updateStatus;
  154 + Ext.Msg.show({
  155 + title: 'Warning', msg: 'You chose Time Selection `by TimeTable` but no timeTable was added!'
  156 + +'<br>You must add one or choose Time Selection `by Interval`',
  157 + icon: Ext.MessageBox.WARNING, buttons: Ext.Msg.OK
  158 + });
  159 + updateStatus = false;
  160 + }
  161 + // if the update is allowed
  162 + if (updateStatus)
  163 + {
  164 + /// real object update
  165 + // update TimeTable object with the content of form
  166 + basicForm.updateRecord(this.object);
  167 + this.object.set('timesrc', timeSource);
  168 + // set valid intervals into TimeTable object
  169 + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) {
  170 + this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
  171 + }
  172 + }
  173 + // return the update status
  174 + return updateStatus;
161 175 },
162 176  
163 177 /**
164   - * load this.object into form
165   - */
166   - loadObject : function(){
167   - // load object into form
168   -
169   - this.formPanel.getForm().loadRecord(this.object);
170   - // set object's TTs into the timeselector
171   - this.addTTs(this.object.get('timeTables'));
  178 + * load this.object into form
  179 + */
  180 + loadObject : function()
  181 + {
  182 + // load object into form
  183 + this.formPanel.getForm().loadRecord(this.object);
  184 + // set object's TTs into the timeselector
  185 + this.addTTs(this.object.get('timeTables'));
172 186 },
173 187  
174 188 /**
175 189 * save method called by Save button to launch the save process
176 190 */
177   - saveProcess : function(toRename){
178   - // if the TimeTable object has been modified
179   - if (this.object.dirty) {
180   - // TT module
181   - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);//('search-win');
182   - // if the name has been modified this is a creation
183   - if (this.object.isModified('name')){
184   -
185   - // if object already has an id : it's a 'rename' of an existing Condition
186   - if (this.object.get('id')){
187   - // the context Node is the parent node of current edited one
188   - var contextNode = searchModule.linkedNode.parentNode;
189   - // link a new node to the TimeTableModule
190   - searchModule.createLinkedNode();
191   - // set the contextNode
192   - searchModule.linkedNode.set('contextNode',contextNode);
193   - // create a new object linked
194   - searchModule.createObject(this.object.getJsonValues());
195   - var searchObj = searchModule.linkedNode.get('object');
196   - // synchronisation of objects
197   - this.object = searchObj;
198   - if (toRename) searchModule.linkedNode.toRename = true;
199   - }
200   - // fire creation event
201   - // this.object.fireEvent('create');
202   - searchModule.linkedNode.create();
203   - } else {
204   - searchModule.linkedNode.set('contextNode',searchModule.contextNode);
205   - // this.object.fireEvent('modify');
206   - searchModule.linkedNode.update();
207   - }
208   - }
  191 + saveProcess : function(toRename)
  192 + {
  193 + // if the TimeTable object has been modified
  194 + if (this.object.dirty)
  195 + {
  196 + // Search module
  197 + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);//('search-win');
  198 + // if the name has been modified this is a creation
  199 + if (this.object.isModified('name'))
  200 + {
  201 + // if object already has an id : it's a 'rename' of an existing Condition
  202 + if (this.object.get('id'))
  203 + {
  204 + // the context Node is the parent node of current edited one
  205 + var contextNode = searchModule.linkedNode.parentNode;
  206 + // link a new node to the TimeTableModule
  207 + searchModule.createLinkedNode();
  208 + // set the contextNode
  209 + searchModule.linkedNode.set('contextNode',contextNode);
  210 + // create a new object linked
  211 + searchModule.createObject(this.object.getJsonValues());
  212 + var searchObj = searchModule.linkedNode.get('object');
  213 + // synchronisation of objects
  214 + this.object = searchObj;
  215 + if (toRename) searchModule.linkedNode.toRename = true;
  216 + }
  217 + searchModule.linkedNode.create();
  218 + } else {
  219 + searchModule.linkedNode.set('contextNode',searchModule.contextNode);
  220 + // this.object.fireEvent('modify');
  221 + searchModule.linkedNode.update();
  222 + }
  223 + }
209 224 },
210 225  
211 226 /**
212 227 * overwrite metod called by Save button
213 228 */
214   - overwriteProcess : function(btn){
215   - if (btn == 'cancel') return;
216   -
217   - this.fieldName.clearInvalid();
218   - this.saveProcess(true);
  229 + overwriteProcess : function(btn)
  230 + {
  231 + if (btn == 'cancel') return;
  232 +
  233 + this.fieldName.clearInvalid();
  234 + this.saveProcess(true);
219 235 },
220 236  
221 237 /**
222 238 * search method called by 'Do Search' button to launch the search process
223 239 */
224   - doSearch : function(){
225   - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
226   - searchModule.linkedNode.execute();
227   - // fire execution
228   - // this.object.fireEvent('execute',this.object.dirty);
  240 + doSearch : function()
  241 + {
  242 + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
  243 + searchModule.linkedNode.execute();
  244 + // fire execution
  245 + // this.object.fireEvent('execute',this.object.dirty);
229 246 },
230 247  
231   - /**
232   - * Check if brackets are balanced
233   - */
234   - isBalanced : function(str){
235   - str = (""+str).replace(/[^()\[\]{}]/g, "");
236   - var bracket = {
237   - "]": "[",
238   - "}": "{",
239   - ")": "("
240   - },
241   - openBrackets = [],
242   - isClean = true,
243   - i = 0,
244   - len = str.length;
  248 + /**
  249 + * Check if brackets are balanced
  250 + */
  251 + isBalanced : function(str)
  252 + {
  253 + str = (""+str).replace(/[^()\[\]{}]/g, "");
  254 + var bracket = {
  255 + "]": "[",
  256 + "}": "{",
  257 + ")": "("
  258 + },
  259 + openBrackets = [],
  260 + isClean = true,
  261 + i = 0,
  262 + len = str.length;
245 263  
246   - for(; isClean && i<len; i++ ){
247   - if( bracket[ str[ i ] ] ){
248   - isClean = ( openBrackets.pop() === bracket[ str[ i ] ] );
249   - }else{
250   - openBrackets.push(str[i]);
251   - }
252   - }
253   - if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced';
254   -
255   - return true;
256   - },
  264 + for(; isClean && i<len; i++ ){
  265 + if( bracket[ str[ i ] ] ){
  266 + isClean = ( openBrackets.pop() === bracket[ str[ i ] ] );
  267 + }else{
  268 + openBrackets.push(str[i]);
  269 + }
  270 + }
  271 + if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced';
  272 +
  273 + return true;
  274 + },
257 275  
258   - /**
259   - * Update constructionField (Search Condition) in window search
260   - */
261   - updateConstruct : function(oldval,newval)
262   - {
263   - var expression = this.constructionField.value;
264   - oldval = oldval.replace(/[(]/g,"\\(");
265   - oldval = oldval.replace(/[)]/g,"\\)");
266   - var reg=new RegExp(oldval, "g");
267   - expression = expression.replace(reg, newval);
268   - this.constructionField.setValue(expression);
  276 + /**
  277 + * Update constructionField (Search Condition) in window search
  278 + */
  279 + updateConstruct : function(oldval,newval)
  280 + {
  281 + var expression = this.constructionField.value;
  282 + oldval = oldval.replace(/[(]/g,"\\(");
  283 + oldval = oldval.replace(/[)]/g,"\\)");
  284 + var reg=new RegExp(oldval, "g");
  285 + expression = expression.replace(reg, newval);
  286 + this.constructionField.setValue(expression);
269 287 },
270 288  
271 289 /**
272 290 * Check if changes were made before closing window
273 291 * @return true if changes
274 292 */
275   - fclose : function() {
276   - var form = this.formPanel.getForm();
  293 + fclose : function()
  294 + {
  295 + var form = this.formPanel.getForm();
277 296 var isDirty = form.isDirty();
278 297 return isDirty;
279 298 },
280 299  
281   - /**
282   - * Component configiration / init
283   - */
284   - init : function(config)
285   - {
286   - this.timeSelector = new amdaUI.TimeSelectorUI({id: 'SearchTimeSelector',flex: 2});
  300 + /**
  301 + * Component configiration / init
  302 + */
  303 + init : function(config)
  304 + {
  305 + this.timeSelector = new amdaUI.TimeSelectorUI({id: 'SearchTimeSelector',flex: 2});
287 306  
288   - this.fieldName = new Ext.form.field.Text({
289   - labelAlign: 'top', itemId: 'formParamName',
290   - fieldLabel: 'Request Name<b>*</b>',
291   - name : 'name',
292   - width: 375,
293   - colspan: 3,
294   - allowBlank : false,
295   - stripCharsRe: /(^\s+|\s+$)/g,
296   - validateOnChange: false,
297   - validateOnBlur: false,
298   - validFlag: false,
299   - validator : function() {
300   - return this.validFlag;
301   - }
302   - });
  307 + this.fieldName = new Ext.form.field.Text({
  308 + labelAlign: 'top', itemId: 'formParamName',
  309 + fieldLabel: 'Request Name<b>*</b>',
  310 + name : 'name',
  311 + width: 375,
  312 + colspan: 3,
  313 + allowBlank : false,
  314 + stripCharsRe: /(^\s+|\s+$)/g,
  315 + validateOnChange: false,
  316 + validateOnBlur: false,
  317 + validFlag: false,
  318 + validator : function()
  319 + {
  320 + return this.validFlag;
  321 + }
  322 + });
303 323  
304   - this.constructionField = new extensions.SelectableTextArea({
305   - labelAlign: 'top',
306   - itemId: 'formSearchCondition',
307   - fieldLabel:'Data Mining Condition<b>*</b>',
308   - allowBlank : false, blankText : 'Condition expression is required',
309   - name: 'expression',
310   - validateOnChange: false,
311   - validateOnBlur: false,
312   - validator : this.isBalanced,
313   - flex : 2.5,
314   - listeners :
315   - {
316   - render : function(o,op)
317   - {
318   - var me = this;
319   - var el = me.bodyEl;
320   - var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
321   - ddGroup: 'explorerTree',
322   - notifyEnter : function(ddSource, e, data)
323   - { },
324   - notifyOver : function(ddSource, e, data)
325   - {
326   - if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) {
327   - this.valid = false;
328   - return this.dropNotAllowed;
329   - }
330   - if (((data.records[0].data.nodeType == 'localParam') ||
331   - (data.records[0].data.nodeType == 'remoteParam') ||
332   - (data.records[0].data.nodeType == 'remoteSimuParam') ||
333   - (data.records[0].data.nodeType == 'derivedParam') ||
334   - (data.records[0].data.nodeType == 'myDataParam') ||
335   - (data.records[0].data.nodeType == 'alias'))&&
336   - //(data.records[0].data.leaf) &&
337   - !data.records[0].data.disable)
338   - {
339   - this.valid = true;
340   - return this.dropAllowed;
341   - }
342   - this.valid = false;
343   - return this.dropNotAllowed;
344   - },
345   - notifyDrop : function(ddSource, e, data)
346   - {
347   - if (!this.valid) return false;
348   -
349   - var nameToSent;
350   - var components = null;
351   - switch (data.records[0].get('nodeType'))
352   - {
353   - case 'localParam' :
354   - case 'remoteParam' :
355   - case 'remoteSimuParam' :
356   - nameToSent = data.records[0].get('id');
357   - if (data.records[0].get('alias')!= "" )
358   - nameToSent = "#"+data.records[0].get('alias');
359   -// var component_info = data.records[0].get('component_info');
360   -// if (component_info && component_info.parentId) {
361   -// if ( component_info.index1 && component_info.index2 ){
362   -// nameToSent = component_info.parentId;
363   -// components = [];
364   -// if (component_info.index1)
365   -// components['index1'] = component_info.index1;
366   -// if (component_info.index2)
367   -// components['index2'] = component_info.index2;
368   -// }
369   -// }
370   - break;
371   - case 'alias' :
372   - nameToSent = "#"+data.records[0].get('text');
373   - break;
374   - case 'derivedParam' :
375   - nameToSent = "ws_"+data.records[0].get('text');
376   - break;
377   - case 'myDataParam' :
378   - var name = data.records[0].get('text');
379   - nameToSent = "wsd_"+name;
380   - var size = data.records[0].get('size');
381   - if (size && size > 1) {
382   - nameToSent += "(0)";
383   - myDesktopApp.warningMsg("parameter "+name+" is array of size: "+size+"<br/>Please put index");
384   - }
385   - break;
386   - default :
387   - return false;
388   - }
389   - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
390   -
391   - if (searchModule)
392   - searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
393   - return true;
394   - }
395   - });
396   - }
397   - }
398   - });
  324 + this.constructionField = new extensions.SelectableTextArea(
  325 + {
  326 + labelAlign: 'top',
  327 + itemId: 'formSearchCondition',
  328 + fieldLabel:'Data Mining Condition<b>*</b>',
  329 + allowBlank : false, blankText : 'Condition expression is required',
  330 + name: 'expression',
  331 + validateOnChange: false,
  332 + validateOnBlur: false,
  333 + validator : this.isBalanced,
  334 + flex : 2.5,
  335 + listeners :
  336 + {
  337 + render : function(o,op)
  338 + {
  339 + var me = this;
  340 + var el = me.bodyEl;
  341 + var dropTarget = Ext.create('Ext.dd.DropTarget', el,
  342 + {
  343 + ddGroup: 'explorerTree',
  344 + notifyEnter : function(ddSource, e, data){ },
  345 + notifyOver : function(ddSource, e, data)
  346 + {
  347 + if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) {
  348 + this.valid = false;
  349 + return this.dropNotAllowed;
  350 + }
  351 + if (((data.records[0].data.nodeType == 'localParam') ||
  352 + (data.records[0].data.nodeType == 'remoteParam') ||
  353 + (data.records[0].data.nodeType == 'remoteSimuParam') ||
  354 + (data.records[0].data.nodeType == 'derivedParam') ||
  355 + (data.records[0].data.nodeType == 'myDataParam') ||
  356 + (data.records[0].data.nodeType == 'alias'))&&
  357 + //(data.records[0].data.leaf) &&
  358 + !data.records[0].data.disable)
  359 + {
  360 + this.valid = true;
  361 + return this.dropAllowed;
  362 + }
  363 + this.valid = false;
  364 + return this.dropNotAllowed;
  365 + },
  366 + notifyDrop : function(ddSource, e, data)
  367 + {
  368 + if (!this.valid) return false;
  369 +
  370 + var nameToSent;
  371 + var components = null;
  372 + switch (data.records[0].get('nodeType'))
  373 + {
  374 + case 'localParam' :
  375 + case 'remoteParam' :
  376 + case 'remoteSimuParam' :
  377 + nameToSent = data.records[0].get('id');
  378 + if (data.records[0].get('alias')!= "" )
  379 + nameToSent = "#"+data.records[0].get('alias');
  380 + var component_info = data.records[0].get('component_info');
  381 + if (component_info && component_info.parentId)
  382 + {
  383 + if ( component_info.index1 && component_info.index2 )
  384 + {
  385 + nameToSent = component_info.parentId;
  386 + components = [];
  387 + if (component_info.index1)
  388 + components['index1'] = component_info.index1;
  389 + if (component_info.index2)
  390 + components['index2'] = component_info.index2;
  391 + }
  392 + if ( data.records[0].get('needsArgs') )
  393 + {
  394 + nameToSent = component_info.parentId;
  395 + if (component_info.index1)
  396 + {
  397 + components = [];
  398 + components['index1'] = component_info.index1;
  399 + }
  400 + }
  401 + }
  402 + break;
  403 + case 'alias' :
  404 + nameToSent = "#"+data.records[0].get('text');
  405 + break;
  406 + case 'derivedParam' :
  407 + nameToSent = "ws_"+data.records[0].get('text');
  408 + break;
  409 + case 'myDataParam' :
  410 + var name = data.records[0].get('text');
  411 + nameToSent = "wsd_"+name;
  412 + var size = data.records[0].get('size');
  413 + if (size && size > 1) {
  414 + nameToSent += "(0)";
  415 + myDesktopApp.warningMsg("parameter "+name+" is array of size: "+size+"<br/>Please put index");
  416 + }
  417 + break;
  418 + default :
  419 + return false;
  420 + }
  421 + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
  422 +
  423 + if (searchModule)
  424 + searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  425 + return true;
  426 + }
  427 + });
  428 + }
  429 + }
  430 + });
399 431  
400   - this.formPanel = new Ext.form.Panel({
401   - region : 'center',
402   - bodyStyle: { background : '#dfe8f6' },
403   - border: false, buttonAlign: 'left',
404   - trackResetOnLoad: true, //reset to the last loaded record
405   - layout : {
406   - type : 'vbox',
407   - align: 'stretch',
408   - defaultMargins : { top:15, bottom:0, left: 15, right:15}
409   - },
410   - id: 'formSearch',
411   - defaults: {
412   - border: false
413   - },
414   - items : [
415   - {
416   - xtype: 'container',
417   - flex: 2.5,
418   - layout: {
419   - type: 'hbox',
420   - align: 'stretch'
421   - },
422   - items: [
423   - {
424   - flex: 3,
425   - xtype: 'container',
426   - border: false,
427   - layout: {
428   - type: 'table',
429   - columns: 3
430   - },
431   - defaultType: 'textfield',
432   - defaults: {
433   - labelAlign: 'top'
434   - },
435   - items: [
436   - this.fieldName,
437   - {
438   - xtype :'displayfield', width: 165,
439   - hideLabel: true,
440   - value: '<b>Averaging/Interpolation</b>'
441   - },
442   - { xtype: 'component', width: 45 },
443   - {
444   - xtype :'displayfield', width: 165,
445   - hideLabel: true,
446   - value: '<b>Data Gap</b>'
447   - },
448   - {
449   - xtype: 'numberfield', name: 'sampling',
450   - fieldLabel: 'Sampling Time Step (sec)*', minValue : 0,
451   - labelAlign: 'top', hideTrigger: true, width: 165
452   - },
453   - { xtype: 'component', width: 45 },
454   - {
455   - xtype: 'numberfield', name: 'gap',
456   - fieldLabel: 'if no data for interval', minValue : 1,
457   - labelAlign: 'top', hideTrigger : true, width: 165
458   - },
459   - {
460   - xtype: 'textfield',
461   - name: 'description',
462   - xtype: 'textarea', fieldLabel:'Description',
463   - width: 375, height: 70,
464   - colspan: 3
465   - }]
466   - },
467   - this.timeSelector
468   - ]
469   - },
470   - this.constructionField
471   - ],
472   - fbar: [
473   - {
474   - text: 'Do Search',
475   - scope : this,
476   - handler: function(button){
477   - // update object with user's values
478   - // if the return is true (object had been updated)
479   - if(this.updateObject()){
480   - // launch the search process
481   - this.doSearch();
482   - }
483   - }
484   - },
485   - {
486   - text: 'Save Request',
487   - scope: this,
488   - handler: function(){
489   - // update object with user's values
490   - // if the return is true (object had been updated)
491   - if (this.updateObject()){
492   - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
493   - if (!searchModule)
494   - return;
495   - var me = this;
496   -
497   - searchModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) {
498   - if (!res)
499   - {
500   - me.fieldName.validFlag = 'Error during object validation';
501   - myDesktopApp.errorMsg(me.fieldName.validFlag);
502   - me.fieldName.validate();
503   - return;
504   - }
505   -
506   - if (!res.valid)
507   - {
508   - if (res.error)
509   - {
510   - if (res.error.search('subtree') != -1) {
511   - Ext.MessageBox.show({title:'Warning',
512   - msg: res.error+'<br/>Do you want to overwrite it?',
513   - width: 300,
514   - buttons: Ext.MessageBox.OKCANCEL,
515   - fn : me.overwriteProcess,
516   - icon: Ext.MessageBox.WARNING,
517   - scope : me
518   - });
519   - me.fieldName.validFlag = true;
520   - }
521   - else
522   - me.fieldName.validFlag = res.error;
523   - }
524   - else
525   - {
526   - me.fieldName.validFlag = 'Invalid object name';
527   - myDesktopApp.errorMsg(me.fieldName.validFlag);
528   - }
529   - me.fieldName.validate();
530   - return;
531   - }
532   -
533   - me.fieldName.validFlag = true;
534   - me.fieldName.validate();
535   - me.saveProcess(false);
536   - });
537   - }
538   - }
539   - },
540   - {
541   - text: 'Reset',
542   - scope : this,
543   - handler: function(){
544   - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
545   - searchModule.createLinkedNode();
546   - searchModule.createObject();
547   - this.setObject(searchModule.getLinkedNode().get('object'));
548   - }
549   - }
550   - ]
551   - });
  432 + this.formPanel = new Ext.form.Panel(
  433 + {
  434 + region : 'center',
  435 + bodyStyle: { background : '#dfe8f6' },
  436 + border: false, buttonAlign: 'left',
  437 + trackResetOnLoad: true, //reset to the last loaded record
  438 + layout : {
  439 + type : 'vbox',
  440 + align: 'stretch',
  441 + defaultMargins : { top:15, bottom:0, left: 15, right:15}
  442 + },
  443 + id: 'formSearch',
  444 + defaults: {
  445 + border: false
  446 + },
  447 + items : [
  448 + {
  449 + xtype: 'container',
  450 + flex: 2.5,
  451 + layout: {
  452 + type: 'hbox',
  453 + align: 'stretch'
  454 + },
  455 + items: [
  456 + {
  457 + flex: 3,
  458 + xtype: 'container',
  459 + border: false,
  460 + layout: {
  461 + type: 'table',
  462 + columns: 3
  463 + },
  464 + defaultType: 'textfield',
  465 + defaults: {
  466 + labelAlign: 'top'
  467 + },
  468 + items: [
  469 + this.fieldName,
  470 + {
  471 + xtype :'displayfield', width: 165,
  472 + hideLabel: true,
  473 + value: '<b>Averaging/Interpolation</b>'
  474 + },
  475 + { xtype: 'component', width: 45 },
  476 + {
  477 + xtype :'displayfield', width: 165,
  478 + hideLabel: true,
  479 + value: '<b>Data Gap</b>'
  480 + },
  481 + {
  482 + xtype: 'numberfield', name: 'sampling',
  483 + fieldLabel: 'Sampling Time Step (sec)*', minValue : 0,
  484 + labelAlign: 'top', hideTrigger: true, width: 165
  485 + },
  486 + { xtype: 'component', width: 45 },
  487 + {
  488 + xtype: 'numberfield', name: 'gap',
  489 + fieldLabel: 'if no data for interval', minValue : 1,
  490 + labelAlign: 'top', hideTrigger : true, width: 165
  491 + },
  492 + {
  493 + xtype: 'textfield',
  494 + name: 'description',
  495 + xtype: 'textarea', fieldLabel:'Description',
  496 + width: 375, height: 70,
  497 + colspan: 3
  498 + }
  499 + ]
  500 + },
  501 + this.timeSelector
  502 + ]
  503 + },
  504 + this.constructionField
  505 + ],
  506 + fbar: [
  507 + {
  508 + text: 'Do Search',
  509 + scope : this,
  510 + handler: function(button){
  511 + // update object with user's values
  512 + // if the return is true (object had been updated)
  513 + if(this.updateObject()){
  514 + // launch the search process
  515 + this.doSearch();
  516 + }
  517 + }
  518 + },
  519 + {
  520 + text: 'Save Request',
  521 + scope: this,
  522 + handler: function()
  523 + {
  524 + // update object with user's values
  525 + // if the return is true (object had been updated)
  526 + if (this.updateObject())
  527 + {
  528 + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
  529 + if (!searchModule)
  530 + return;
  531 + var me = this;
  532 +
  533 + searchModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) {
  534 + if (!res)
  535 + {
  536 + me.fieldName.validFlag = 'Error during object validation';
  537 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  538 + me.fieldName.validate();
  539 + return;
  540 + }
  541 +
  542 + if (!res.valid)
  543 + {
  544 + if (res.error)
  545 + {
  546 + if (res.error.search('subtree') != -1) {
  547 + Ext.MessageBox.show({title:'Warning',
  548 + msg: res.error+'<br/>Do you want to overwrite it?',
  549 + width: 300,
  550 + buttons: Ext.MessageBox.OKCANCEL,
  551 + fn : me.overwriteProcess,
  552 + icon: Ext.MessageBox.WARNING,
  553 + scope : me
  554 + });
  555 + me.fieldName.validFlag = true;
  556 + }
  557 + else
  558 + me.fieldName.validFlag = res.error;
  559 + }
  560 + else
  561 + {
  562 + me.fieldName.validFlag = 'Invalid object name';
  563 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  564 + }
  565 + me.fieldName.validate();
  566 + return;
  567 + }
  568 +
  569 + me.fieldName.validFlag = true;
  570 + me.fieldName.validate();
  571 + me.saveProcess(false);
  572 + });
  573 + }
  574 + }
  575 + },
  576 + {
  577 + text: 'Reset',
  578 + scope : this,
  579 + handler: function()
  580 + {
  581 + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
  582 + searchModule.createLinkedNode();
  583 + searchModule.createObject();
  584 + this.setObject(searchModule.getLinkedNode().get('object'));
  585 + }
  586 + }
  587 + ]
  588 + });
552 589  
553   - var myConf = {
554   - layout: 'border',
555   - defaults: { layout: 'fit', border: false },
556   - items: [
557   - this.formPanel,
558   - {
559   - xtype: 'panel', region: 'south',
560   - title: 'Information',
561   - collapsible: true,
562   - height: 100,
563   - autoHide: false,
564   - iconCls: 'icon-information',
565   - bodyStyle: 'padding:5px',
566   - loader: {
567   - autoLoad: true,
568   - url: helpDir+'dataMiningHOWTO'
569   - }
570   - }
571   - ],
572   - plugins: [ {ptype: 'calculator', myBtns:[], context: 'Condition'}, {ptype: 'paramArgumentsPlugin', pluginId: 'search-param-components-plugin'}]
573   - };
  590 + var myConf = {
  591 + layout: 'border',
  592 + defaults: { layout: 'fit', border: false },
  593 + items:
  594 + [
  595 + this.formPanel,
  596 + {
  597 + xtype: 'panel', region: 'south',
  598 + title: 'Information',
  599 + collapsible: true,
  600 + height: 100,
  601 + autoHide: false,
  602 + iconCls: 'icon-information',
  603 + bodyStyle: 'padding:5px',
  604 + loader:
  605 + {
  606 + autoLoad: true,
  607 + url: helpDir+'dataMiningHOWTO'
  608 + }
  609 + }
  610 + ],
  611 + plugins: [
  612 + {ptype: 'calculator', myBtns:[], context: 'Condition'},
  613 + {ptype: 'paramArgumentsPlugin', pluginId: 'search-param-components-plugin'}
  614 + ]
  615 + };
574 616  
575   - Ext.apply (this , Ext.apply (arguments, myConf));
576   - }
  617 + Ext.apply (this , Ext.apply (arguments, myConf));
  618 + }
577 619  
578 620 });
... ...
js/app/views/StatisticsUI.js
... ... @@ -22,7 +22,8 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, {
22 22 // functionStore : null
23 23 },
24 24  
25   - constructor: function(config) {
  25 + constructor: function(config)
  26 + {
26 27 this.init(config);
27 28 this.callParent(arguments);
28 29 // if (this.object) this.loadObject();
... ... @@ -32,7 +33,8 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, {
32 33 paramArgsPlug.onApply = this.onApplyParameterArgs;
33 34 },
34 35  
35   - onApplyParameterArgs : function(parentUI, paramObject) {
  36 + onApplyParameterArgs : function(parentUI, paramObject)
  37 + {
36 38 parentUI.paramGrid.getView().refresh();
37 39 },
38 40  
... ... @@ -55,12 +57,12 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, {
55 57  
56 58 if (components) {
57 59 if (components['index1']) {
58   - // paramObj['dim1-index'] = components['index1'];
  60 + paramObj['dim1-index'] = components['index1'];
59 61 ++paramObj['type'];
60 62 }
61 63  
62 64 if (components['index2']) {
63   - // paramObj['dim2-index'] = components['index2'];
  65 + paramObj['dim2-index'] = components['index2'];
64 66 ++paramObj['type'];
65 67 }
66 68 }
... ... @@ -105,18 +107,15 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, {
105 107  
106 108 var formValues = basicForm.getValues();
107 109 // this.object.set('name',formValues.name);
108   -// this.object.set('description',formValues.description);
  110 + this.object.set('description',formValues.description);
109 111  
110 112 var recs = this.paramGrid.getStore().getNewRecords();
111 113 var paramArr = new Array();
112 114  
113 115 Ext.Array.each(recs, function(rec, index, allItems)
114   - {
115   - var obj = new Object();
116   - obj.param = rec.get('paramid');
117   - obj.template_args = rec.get('template_args');
118   - obj.function = rec.get('function');
119   -
  116 + {
  117 + var obj = Ext.clone(rec.data);
  118 +
120 119 if (obj.function == null)
121 120 {
122 121 myDesktopApp.warningMsg('Please select function : `click to select`');
... ... @@ -279,38 +278,61 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;, {
279 278 },
280 279 notifyDrop : function(ddSource, e, data)
281 280 {
282   - if (!this.valid)
283   - return false;
284   - var nameToSent;
285   - var components = null;
286   - switch (data.records[0].data.nodeType)
287   - {
288   - case 'localParam' :
289   - case 'remoteParam':
290   - case 'remoteSimuParam':
291   - nameToSent = data.records[0].get('id');
292   - if (data.records[0].get('alias')!= "" )
293   - var nameToSent = "#"+data.records[0].get('alias');
294   - break;
295   - case 'alias' :
296   - nameToSent = "#"+data.records[0].get('text');
297   - break;
298   - case 'derivedParam' :
299   - nameToSent = "ws_"+data.records[0].get('text');
300   - break;
301   - case 'myDataParam' :
302   - nameToSent = "wsd_"+data.records[0].get('text');
303   - break;
304   - default :
305   - return false;
306   - }
307   - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.statistics.id);
308   - if (module)
309   - {
310   - module.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
311   - }
312   - return true;
313   - }
  281 + if (!this.valid)
  282 + return false;
  283 + var nameToSent;
  284 + var components = null;
  285 +
  286 + switch (data.records[0].data.nodeType)
  287 + {
  288 + case 'localParam' :
  289 + case 'remoteParam':
  290 + case 'remoteSimuParam':
  291 + nameToSent = data.records[0].get('id');
  292 + if (data.records[0].get('alias')!= "" )
  293 + var nameToSent = "#"+data.records[0].get('alias');
  294 + var component_info = data.records[0].get('component_info');
  295 + if (component_info && component_info.parentId)
  296 + {
  297 + if ( component_info.index1 && component_info.index2 )
  298 + {
  299 + nameToSent = component_info.parentId;
  300 + components = [];
  301 + if (component_info.index1)
  302 + components['index1'] = component_info.index1;
  303 + if (component_info.index2)
  304 + components['index2'] = component_info.index2;
  305 + }
  306 + if ( data.records[0].get('needsArgs') )
  307 + {
  308 + nameToSent = component_info.parentId;
  309 + if (component_info.index1)
  310 + {
  311 + components = [];
  312 + components['index1'] = component_info.index1;
  313 + }
  314 + }
  315 + }
  316 + break;
  317 + case 'alias' :
  318 + nameToSent = "#"+data.records[0].get('text');
  319 + break;
  320 + case 'derivedParam' :
  321 + nameToSent = "ws_"+data.records[0].get('text');
  322 + break;
  323 + case 'myDataParam' :
  324 + nameToSent = "wsd_"+data.records[0].get('text');
  325 + break;
  326 + default :
  327 + return false;
  328 + }
  329 + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.statistics.id);
  330 + if (module)
  331 + {
  332 + module.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  333 + }
  334 + return true;
  335 + }
314 336 });
315 337 },
316 338 cellclick : function(grid, cell, cellIndex, record){
... ...