Commit b2e93d9299f3253a9cd7212e1fac9ec9c1aa37ce

Authored by Elena.Budnik
2 parents c6c2f576 d825d47b

Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM

Showing 1 changed file with 182 additions and 185 deletions   Show diff stats
js/app/views/FiltersUI.js
... ... @@ -9,7 +9,7 @@
9 9 ********************************************************************************
10 10 * FT Id : Date : Name - Description
11 11 *******************************************************************************
12   - * :
  12 + * :
13 13 */
14 14  
15 15 /*
... ... @@ -19,41 +19,41 @@
19 19 Ext.define('amdaUI.FilterGridPanel', {
20 20 extend : 'Ext.grid.Panel',
21 21 alias : 'widget.gridFilter',
22   -
  22 +
23 23 filtersInfoStore : null,
24 24 filtersListStore : null,
25   -
  25 +
26 26 selectListStore : null,
27 27 crtFilter : null,
28   -
  28 +
29 29 opStore : null,
30 30 condStore : null,
31   -
  31 +
32 32 groupingFeature : null,
33 33 valueColumn : null,
34   -
  34 +
35 35 groupMenu : null,
36 36 itemMenu : null,
37   -
38   - constructor: function(config)
39   - {
  37 +
  38 + constructor: function(config)
  39 + {
40 40 this.init(config);
41 41 this.callParent(arguments);
42 42 },
43   -
  43 +
44 44 setFiltersInfoStore: function(infoStore)
45 45 {
46 46 this.filtersInfoStore = infoStore;
47 47 },
48   -
  48 +
49 49 setFiltersListStore: function(listStore)
50 50 {
51 51 this.filtersListStore = listStore;
52 52 },
53   -
  53 +
54 54 setConditions : function(record)
55 55 {
56   - this.editingPlugin.completeEdit();
  56 + this.editingPlugin.completeEdit();
57 57 this.crtFilter = record;
58 58 this.reconfigure(record.conditions());
59 59 this.store.groupField = 'type';
... ... @@ -61,59 +61,59 @@ Ext.define('amdaUI.FilterGridPanel', {
61 61 if (record.conditions().getCount() > 0)
62 62 this.getSelectionModel().select(record.conditions().getAt(0));
63 63 },
64   -
  64 +
65 65 setConditionType : function(condType,condInfo,reset)
66 66 {
67 67 if (!condInfo)
68 68 return;
69   -
  69 +
70 70 //update current conditions types store
71 71 this.condStore.removeAll();
72   -
  72 +
73 73 this.filtersInfoStore.getById(condType).conditions().data.each(function(cond)
74 74 {
75 75 this.condStore.add(cond);
76 76 },
77 77 this
78 78 );
79   -
  79 +
80 80 //update current operators store
81 81 this.opStore.removeAll();
82   -
  82 +
83 83 condInfo.ops().data.each(function(op)
84 84 {
85 85 this.opStore.add({id : op.get('id'), name : op.get('name')});
86 86 },
87 87 this
88 88 );
89   -
  89 +
90 90 //update current value field
91 91 var valueField = this.getValueField(condInfo);
92   - this.editingPlugin.completeEdit();
  92 + this.editingPlugin.completeEdit();
93 93 this.editingPlugin.setColumnField(this.columns[3],valueField);
94   -
  94 +
95 95 //get current cell
96 96 var crtCell;
97   - if (this.getSelectionModel().hasSelection()) {
98   - crtCell = this.getSelectionModel().getSelection()[0];
  97 + if (this.getSelectionModel().hasSelection()) {
  98 + crtCell = this.getSelectionModel().getSelection()[0];
99 99 }
100 100 else
101   - return;
  101 + return;
102 102 crtCell.set('condId',condInfo.get('id'));
103   -
  103 +
104 104 if (reset)
105   - {
  105 + {
106 106 //set first operator
107 107 crtCell.set('opId',this.opStore.getAt(0).get('id'));
108   -
  108 +
109 109 //reset value field
110 110 switch (valueField.xtype)
111 111 {
112   - case 'combobox' :
  112 + case 'combobox' :
113 113 crtCell.set('value',valueField.store.getAt(0).get('name'));
114 114 break;
115 115 case 'datefield' :
116   - var date = new Date();
  116 + var date = new Date();
117 117 crtCell.set('value',date);
118 118 break;
119 119 default :
... ... @@ -121,7 +121,7 @@ Ext.define('amdaUI.FilterGridPanel', {
121 121 }
122 122 }
123 123 },
124   -
  124 +
125 125 getValueField : function(condInfo)
126 126 {
127 127 //get field type in relation with the condition
... ... @@ -130,21 +130,21 @@ Ext.define('amdaUI.FilterGridPanel', {
130 130 case 'select' :
131 131 if (!this.filtersListStore.getById(condInfo.get('selectList')))
132 132 console.log('Error - Missing select list definition for '+condInfo.get('selectList'));
133   - else {
  133 + else {
134 134 // to avoid an attempt to load remotely association store in combobox - it is already here!
135 135 var store2 = new Ext.data.Store({model : 'amdaModel.FilterSelectListElt'});
136   -
  136 +
137 137 this.filtersListStore.getById(condInfo.get('selectList')).elems().each(function(record){
138 138 store2.add(record.copy());
139   - });
140   -
  139 + });
  140 +
141 141 return {
142 142 xtype : 'combobox',
143 143 queryMode: 'local',
144 144 editable: false,
145 145 displayField:'name',
146 146 valueField : 'id',
147   - store : store2
  147 + store : store2
148 148 };
149 149 }
150 150 case 'date' :
... ... @@ -159,23 +159,23 @@ Ext.define('amdaUI.FilterGridPanel', {
159 159 };
160 160  
161 161 }
162   -
  162 +
163 163 // console.log('Error - Missing value field definition for '+condInfo.get('type'));
164 164 return {
165 165 xtype : 'textfield'
166 166 };
167 167 },
168   -
  168 +
169 169 createCondition : function(group)
170 170 {
171 171 var rec = Ext.create('amdaModel.FilterDefCond',{
172 172 type : group,
173 173 logical : 'and'
174 174 });
175   -
  175 +
176 176 return rec;
177 177 },
178   -
  178 +
179 179 onAddCondition : function(t)
180 180 {
181 181 var crtGroup = t.parentMenu.crtGroup;
... ... @@ -187,7 +187,7 @@ Ext.define('amdaUI.FilterGridPanel', {
187 187 this.store.each(function(cond)
188 188 {
189 189 if (cond.get('type') == crtGroup)
190   - maxIndex = (maxIndex < cond.get('index')) ? cond.get('index') : maxIndex;
  190 + maxIndex = (maxIndex < cond.get('index')) ? cond.get('index') : maxIndex;
191 191 },this);
192 192 rec.set('index',maxIndex+1);
193 193 this.store.add(rec);
... ... @@ -196,7 +196,7 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
196 196 this.getSelectionModel().select(rec);
197 197 this.setConditionType(crtGroup,firstCond, true);
198 198 },
199   -
  199 +
200 200 onInsertCondition : function(t)
201 201 {
202 202 if (this.getSelectionModel().hasSelection())
... ... @@ -218,7 +218,7 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
218 218 this.setConditionType(crtRec.get('type'),firstCond, true);
219 219 }
220 220 },
221   -
  221 +
222 222 onDeleteCondition : function(t)
223 223 {
224 224 if (this.getSelectionModel().hasSelection())
... ... @@ -229,7 +229,7 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
229 229 this.store.group('type');
230 230 };
231 231 },
232   -
  232 +
233 233 onClearGroupConditions : function(t)
234 234 {
235 235 var crtGroup = t.parentMenu.crtGroup;
... ... @@ -243,17 +243,17 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
243 243 if (rec.get('index') == -1)
244 244 return;
245 245 this.store.remove(rec);
246   - },this);
  246 + },this);
247 247 this.store.group('type');
248 248 },
249   -
  249 +
250 250 onClearAllConditions : function(t)
251   - {
  251 + {
252 252 var recs = this.store.getGroups();
253 253 if (!recs)
254 254 return;
255 255 Ext.each(recs, function (group)
256   - {
  256 + {
257 257 Ext.each(group.children, function (rec)
258 258 {
259 259 if (rec.get('index') == -1)
... ... @@ -264,47 +264,47 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
264 264 this);
265 265 this.store.group('type');
266 266 },
267   -
  267 +
268 268 onSelectConditionType : function(combo,records,eOpts)
269 269 {
270 270 if (!records || (records.length != 1))
271 271 return;
272 272 this.setConditionType(records[0].getFilter().get('id'),records[0],true);
273 273 },
274   -
  274 +
275 275 createCellEditingPlugin : function()
276 276 {
277 277 var cellPlug = Ext.create('Ext.grid.plugin.CellEditing', {
278 278 clicksToEdit: 2,
279 279 listeners: {
280   - beforeedit: function(o, el, opt) {
  280 + beforeedit: function(o, el, opt) {
281 281 if ((el.field == 'logical') && (el.record.get('index') <= 0))
282 282 return false;
283 283 return true;
284 284 }
285 285 }
286   - });
287   -
  286 + });
  287 +
288 288 return cellPlug;
289 289 },
290   -
  290 +
291 291 createOperatorStore : function()
292 292 {
293 293 this.opStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterOpInfo'});
294 294 return this.opStore;
295 295 },
296   -
  296 +
297 297 createFilterCondInfoStore : function()
298 298 {
299 299 this.condStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterConditionInfo'});
300 300 return this.condStore;
301 301 },
302   -
  302 +
303 303 createLogicalColumn : function()
304 304 {
305 305 return {
306   - header: '',
307   - dataIndex: 'logical',
  306 + header: '',
  307 + dataIndex: 'logical',
308 308 flex: 1,
309 309 allowBlank : false,
310 310 renderer: function(value,metaData,record,rowIndex,colIndex,store,view)
... ... @@ -322,18 +322,18 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
322 322 }
323 323 };
324 324 },
325   -
  325 +
326 326 createTypeColumn : function()
327 327 {
328   - return {
329   - header: 'Type',
330   - dataIndex: 'condId',
  328 + return {
  329 + header: 'Type',
  330 + dataIndex: 'condId',
331 331 flex: 3,
332 332 allowBlank : false,
333 333 renderer: function(value,metaData,record,rowIndex,colIndex,store,view)
334 334 {
335 335 var crtType = record.get('type');
336   - var conditions = this.filtersInfoStore.getById(crtType).conditions();
  336 + var conditions = this.filtersInfoStore.getById(crtType).conditions();
337 337 var condition = conditions.getById(record.get('condId'));
338 338 if (condition)
339 339 return condition.get('name');
... ... @@ -354,21 +354,21 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
354 354 'select': this.onSelectConditionType
355 355 }
356 356 }
357   - };
  357 + };
358 358 },
359   -
  359 +
360 360 createOperatorColumn : function()
361 361 {
362   - return {
363   - header: '',
364   - dataIndex: 'opId',
  362 + return {
  363 + header: '',
  364 + dataIndex: 'opId',
365 365 flex: 1,
366 366 allowBlank : false,
367 367 renderer: function(value,metaData,record,rowIndex,colIndex,store,view)
368 368 {
369 369 var crtType = record.get('type');
370 370 var conditions = this.filtersInfoStore.getById(crtType).conditions();
371   -
  371 +
372 372 var condition = conditions.getById(record.get('condId'));
373 373 if (!condition || !condition.ops().getById(record.get('opId')))
374 374 return '';
... ... @@ -383,21 +383,21 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
383 383 valueField : 'id',
384 384 store : this.createOperatorStore()
385 385 }
386   -
  386 +
387 387 };
388 388 },
389   -
  389 +
390 390 createValueColumn : function()
391 391 {
392   - return {
393   - header: 'Value',
394   - dataIndex: 'value',
  392 + return {
  393 + header: 'Value',
  394 + dataIndex: 'value',
395 395 flex: 3,
396 396 renderer: function(value,metaData,record,rowIndex,colIndex,store,view)
397 397 {
398 398 var crtType = record.get('type');
399 399 var conditions = this.filtersInfoStore.getById(crtType).conditions();
400   - var condition = conditions.getById(record.get('condId'));
  400 + var condition = conditions.getById(record.get('condId'));
401 401 if (!condition)
402 402 return value;
403 403 switch(condition.get('type'))
... ... @@ -417,7 +417,7 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
417 417 }
418 418 };
419 419 },
420   -
  420 +
421 421 createColumns : function()
422 422 {
423 423 return [
... ... @@ -427,11 +427,11 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
427 427 this.createValueColumn()
428 428 ];
429 429 },
430   -
  430 +
431 431 createContextMenus : function()
432 432 {
433 433 var me = this;
434   -
  434 +
435 435 this.groupMenu = Ext.create('Ext.menu.Menu', {
436 436 crtGroup : null,
437 437 items: [{
... ... @@ -454,7 +454,7 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
454 454 }
455 455 ]
456 456 });
457   -
  457 +
458 458 this.itemMenu = Ext.create('Ext.menu.Menu', {
459 459 items: [{
460 460 text: 'Insert',
... ... @@ -468,21 +468,21 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
468 468 scope : me
469 469 }
470 470 ]
471   - });
  471 + });
472 472 },
473   -
  473 +
474 474 createGroupingFeature : function()
475 475 {
476 476 var me = this;
477   -
  477 +
478 478 this.groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
479 479 enableGroupingMenu: true,
480 480 enableNoGroups : false,
481 481 showGroupsText : false,
482   - groupHeaderTpl: Ext.create('Ext.XTemplate',
483   - '{name:this.filter_type} ({rows.length:this.cond_info})',
  482 + groupHeaderTpl: Ext.create('Ext.XTemplate',
  483 + '{name:this.filter_type} ({rows.length:this.cond_info})',
484 484 {
485   - cond_info : function(val)
  485 + cond_info : function(val)
486 486 {
487 487 var nbCond = val < 1 ? 0 : val-1;
488 488 return (nbCond > 1) ? nbCond+' conditions' : nbCond+' condition';
... ... @@ -497,20 +497,20 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
497 497 return rec.get('name');
498 498 }
499 499 }
500   -
  500 +
501 501 )
502 502 });
503 503 },
504   -
505   - init : function(config)
  504 +
  505 + init : function(config)
506 506 {
507 507 var me = this;
508   -
  508 +
509 509 this.createContextMenus();
510   -
  510 +
511 511 this.createGroupingFeature();
512   -
513   - var myConf =
  512 +
  513 + var myConf =
514 514 {
515 515 plugins : [
516 516 this.createCellEditingPlugin()
... ... @@ -531,12 +531,12 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
531 531 {
532 532 if (selections && selections[0])
533 533 {
534   -
  534 +
535 535 var condId = selections[0].get('condId');
536   -
  536 +
537 537 var crtType = selections[0].get('type');
538 538 var conditions = this.filtersInfoStore.getById(crtType).conditions();
539   -
  539 +
540 540 var cond = conditions.getById(condId);
541 541 if (cond)
542 542 {
... ... @@ -550,13 +550,13 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
550 550 this.itemMenu.showAt(e.getXY());
551 551 },
552 552 groupcontextmenu : function(view, node, group, e)
553   - {
  553 + {
554 554 e.stopEvent();
555 555 this.groupMenu.crtGroup = group;
556 556 this.groupMenu.showAt(e.getXY());
557 557 },
558 558 scope : this
559   -
  559 +
560 560 }
561 561 };
562 562 Ext.apply (this , Ext.apply (arguments, myConf));
... ... @@ -564,7 +564,7 @@ Ext.define(&#39;amdaUI.FilterGridPanel&#39;, {
564 564 });
565 565  
566 566 /*
567   - * Filters main interface
  567 + * Filters main interface
568 568 */
569 569  
570 570 Ext.define('amdaUI.FiltersUI', {
... ... @@ -575,27 +575,27 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
575 575 'amdaModel.FilterInfo',
576 576 'amdaModel.FilterDef'
577 577 ],
578   -
  578 +
579 579 newFilterName : 'New_Filter_',
580   -
  580 +
581 581 //filters info to build interface
582 582 filtersInfoStore : null,
583 583 filtersListStore : null,
584   -
585   - constructor: function(config) {
  584 +
  585 + constructor: function(config) {
586 586 this.init(config);
587 587 this.callParent(arguments);
588 588 },
589   -
  589 +
590 590 onSelect : function(combo,records,eOpts)
591 591 {
592 592 if (!records || (records.length != 1))
593   - return;
  593 + return;
594 594 var record = records[0];
595 595 this.setFilterName(record.get('name'));
596 596 this.grid.setConditions(record);
597 597 },
598   -
  598 +
599 599 onBeforeSelect: function(combo, record, index)
600 600 {
601 601 /*var me = this;
... ... @@ -617,12 +617,12 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
617 617 }*/
618 618 return true;
619 619 },
620   -
  620 +
621 621 onAddFilter : function(t)
622 622 {
623 623 this.addFilter(null,null);
624 624 },
625   -
  625 +
626 626 addFilter : function(name,conds,successfn)
627 627 {
628 628 var combo = this.getFilterCombo();
... ... @@ -630,20 +630,20 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
630 630 return null;
631 631  
632 632 var newRec = Ext.create('amdaModel.FilterDef');
633   -
  633 +
634 634 if (name != null)
635 635 newRec.set('name',name);
636   -
  636 +
637 637 newRec.conditions();
638   -
  638 +
639 639 if (conds != null)
640 640 Ext.each(conds, function(cond)
641 641 {
642 642 newRec.conditions().add(cond);
643 643 },this);
644   -
  644 +
645 645 combo.store.add(newRec);
646   -
  646 +
647 647 //sync store with the server
648 648 combo.store.sync({
649 649 scope: this,
... ... @@ -655,27 +655,27 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
655 655 newRec.conditions().removeAll();
656 656 newRec.conditions().add(resRec.conditions);
657 657 combo.select(newRec);
658   - combo.fireEvent('select', combo, [newRec] );
  658 + combo.fireEvent('select', combo, [newRec] );
659 659 if (successfn)
660 660 successfn.call(this,newRec);
661 661 }});
662   -
  662 +
663 663 return newRec;
664 664 },
665   -
  665 +
666 666 onDeleteFilter : function(t)
667 667 {
668 668 var combo = this.getFilterCombo();
669 669 if (!combo)
670 670 return;
671   -
  671 +
672 672 var rec = this.getCrtFilterRecord();
673   -
  673 +
674 674 if (!rec)
675 675 return;
676 676 if (rec.get("id") == "0")
677 677 Ext.Msg.show( {
678   - title : 'Filter',
  678 + title : 'Filter',
679 679 msg : 'Cannot delete the Default Filter',
680 680 modal : false,
681 681 icon : Ext.Msg.ERROR,
... ... @@ -691,47 +691,44 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
691 691 //fire select event
692 692 combo.fireEvent('select', combo, [combo.store.getAt(0)]);
693 693 }
694   - // the same in WS explorer combobox
  694 + // the same in WS explorer combobox
695 695 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) {
696 696 var store = module.filtersStore;
697   - var win = module.getUiContent();
  697 + var win = module.getUiContent();
698 698 var comboList = win.dockedItems.getAt(1).items.items[0];
699   -
700   - var recList = store.getById(rec.get("id"));
701   - store.remove(recList);
  699 +
  700 + var recList = store.getById(rec.get("id"));
  701 + store.remove(recList);
702 702 if (store.getCount() > 0)
703   - {
704   - comboList.select(store.getAt(0));
  703 + {
  704 + comboList.select(store.getAt(0));
705 705 //fire select event
706 706 comboList.fireEvent('select', comboList, [store.getAt(0)]);
707   - }
  707 + }
708 708 });
709   -
  709 +
710 710 }
711 711 },
712   -
  712 +
713 713 onSaveFilter : function(t)
714 714 {
715 715 var filters = this.getFilterCombo().getStore().data.items;
716 716 for (key in filters) {
717 717 if (filters[key].get('name') === this.getFilterName()) {
718   - Ext.Msg.show({
719   - title:'Duplicated name',
720   - msg: 'This name is already used.<br/>Please choose an other one or remove the old filter.',
721   - icon: Ext.Msg.WARNING
722   - });
  718 + myDesktopApp.infoMsg('This name is already used.<br/>' +
  719 + 'Please choose an other one or remove the old filter.');
723 720 return null;
724 721 }
725 722 }
726 723  
727 724 var rec = this.getCrtFilterRecord();
728   -
  725 +
729 726 if (!rec)
730 727 return;
731   -
  728 +
732 729 this.saveFilter(rec);
733 730 },
734   -
  731 +
735 732 onApplyFilter : function(t)
736 733 {
737 734 var me = this;
... ... @@ -748,27 +745,27 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
748 745 );
749 746 return;
750 747 }
751   -
  748 +
752 749 this.requestApplyFilter(rec);
753 750 },
754   -
  751 +
755 752 requestApplyFilter : function(rec)
756 753 {
757   - AmdaAction.setCrtFilterId({id : rec.get('id')},
  754 + AmdaAction.setCrtFilterId({id : rec.get('id')},
758 755 function (result, e)
759 756 {
760 757 var t = e.getTransaction();
761   - if (e.status)
762   - {
  758 + if (e.status)
  759 + {
763 760 if (result)
764 761 {
765 762 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) {
766   - module.setCrtFilter();
767   - });
  763 + module.setCrtFilter();
  764 + });
768 765 }
769 766 else
770 767 Ext.Msg.show( {
771   - title : 'Filter',
  768 + title : 'Filter',
772 769 msg : 'Cannot apply filter',
773 770 modal : true,
774 771 icon : Ext.Msg.ERROR,
... ... @@ -779,10 +776,10 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
779 776 {
780 777 // FAILURE
781 778 Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
782   - }
  779 + }
783 780 },this);
784 781 },
785   -
  782 +
786 783 isDirty : function(filter)
787 784 {
788 785 if (filter.dirty)
... ... @@ -798,7 +795,7 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
798 795 );
799 796 return dirty;
800 797 },
801   -
  798 +
802 799 getFilterCombo : function()
803 800 {
804 801 var comboField = this.query('#filter_combo');
... ... @@ -806,7 +803,7 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
806 803 return null;
807 804 return comboField[0];
808 805 },
809   -
  806 +
810 807 getNameField : function()
811 808 {
812 809 var nameField = this.query('#filter_name');
... ... @@ -814,11 +811,11 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
814 811 return null;
815 812 return nameField[0];
816 813 },
817   -
  814 +
818 815 saveFilter : function(rec,successfn)
819 816 {
820 817 var me = this;
821   -
  818 +
822 819 var filterName = this.getFilterName();
823 820 if (!filterName)
824 821 return;
... ... @@ -842,13 +839,13 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
842 839 });
843 840 return;
844 841 }
845   -
  842 +
846 843 var msg;
847 844 if (rec.get('id') == 0)
848 845 msg = 'The name of the default filter cannot be modified. Do you want to create a new instance of this filter?';
849 846 else
850 847 msg = 'Filter name has been changed. Do you want to create a new instance of this filter?';
851   -
  848 +
852 849 Ext.Msg.confirm('Filters', msg,
853 850 function(btn) {
854 851 if (btn == 'yes')
... ... @@ -861,33 +858,33 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
861 858 conds[i] = cond.getJsonValues();
862 859 },
863 860 this);
864   -
  861 +
865 862 //reload conditions of the current filter
866 863 amdaModel.FilterDef.load(rec.get('id'),
867 864 {
868 865 scope : this,
869   - callback : function(r, operation)
  866 + callback : function(r, operation)
870 867 {
871 868 //reset modifications on current record
872 869 rec.conditions().removeAll();
873 870 rec.conditions().loadData(r.conditions().data.items);
874 871 //create the new filter
875 872 var newRec = this.addFilter(filterName,conds,successfn);
876   -
  873 +
877 874 }
878   - }
  875 + }
879 876 );
880 877 return;
881   - }
882   -
  878 + }
  879 +
883 880 if (rec.get('id') == 0)
884 881 {
885 882 filterName = rec.get('name'); //cannot change default filter name
886 883 this.setFilterName(filterName);
887 884 }
888   -
  885 +
889 886 //change the name of the filter
890   - rec.set('name',filterName);
  887 + rec.set('name',filterName);
891 888 //save modifications
892 889 rec.save({
893 890 success: function() {
... ... @@ -905,9 +902,9 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
905 902 });
906 903 },
907 904 this
908   - );
  905 + );
909 906 },
910   -
  907 +
911 908 setFilterName : function(n)
912 909 {
913 910 var nameField = this.getNameField();
... ... @@ -915,13 +912,13 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
915 912 return;
916 913 nameField.setValue(n);
917 914 },
918   -
  915 +
919 916 getFilterName : function()
920 917 {
921 918 var nameField = this.getNameField();
922 919 return nameField.getValue();
923 920 },
924   -
  921 +
925 922 getCrtFilterRecord : function()
926 923 {
927 924 var combo = this.getFilterCombo();
... ... @@ -929,14 +926,14 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
929 926 return null;
930 927 return combo.store.getById(combo.getValue());
931 928 },
932   -
  929 +
933 930 setCrtFilter : function()
934   - {
  931 + {
935 932 AmdaAction.getCrtFilterId(function (result, e)
936 933 {
937 934 var t = e.getTransaction();
938   - if (e.status)
939   - {
  935 + if (e.status)
  936 + {
940 937 if (result)
941 938 {
942 939 var crtId = result;
... ... @@ -960,17 +957,17 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
960 957 {
961 958 // FAILURE
962 959 Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
963   - }
  960 + }
964 961 },this);
965 962 },
966   -
  963 +
967 964 createFilterStore : function()
968 965 {
969 966 return Ext.create('Ext.data.Store',
970 967 {
971 968 model: 'amdaModel.FilterDef',
972 969 autoLoad : true,
973   - listeners :
  970 + listeners :
974 971 {
975 972 'load' : function(store, records, successful)
976 973 {
... ... @@ -987,10 +984,10 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
987 984 },
988 985 scope : this
989 986 }
990   -
  987 +
991 988 });
992 989 },
993   -
  990 +
994 991 reloadFilter : function()
995 992 {
996 993 var combo = this.getFilterCombo();
... ... @@ -998,7 +995,7 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
998 995 return;
999 996 combo.getStore().reload();
1000 997 },
1001   -
  998 +
1002 999 createToolBar : function()
1003 1000 {
1004 1001 var me = this;
... ... @@ -1041,10 +1038,10 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
1041 1038 'beforeselect' : this.onBeforeSelect
1042 1039 }
1043 1040 }
1044   -
  1041 +
1045 1042 ];
1046 1043 },
1047   -
  1044 +
1048 1045 createInfoPanel : function()
1049 1046 {
1050 1047 var me = this;
... ... @@ -1080,21 +1077,21 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
1080 1077 ]
1081 1078 };
1082 1079 },
1083   -
  1080 +
1084 1081 createGridPanel : function()
1085 1082 {
1086 1083 this.grid = Ext.create('amdaUI.FilterGridPanel',{});
1087 1084 return this.grid;
1088 1085 },
1089   -
1090   - init : function(config)
  1086 +
  1087 + init : function(config)
1091 1088 {
1092 1089 var me = this;
1093   -
  1090 +
1094 1091 var myConf = {
1095 1092 layout: 'border',
1096 1093 tbar : this.createToolBar(),
1097   - items: [
  1094 + items: [
1098 1095 {
1099 1096 xtype : 'panel',
1100 1097 region: 'center',
... ... @@ -1107,10 +1104,10 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
1107 1104 items : [
1108 1105 this.createInfoPanel(),
1109 1106 this.createGridPanel()
1110   - ]
  1107 + ]
1111 1108 },
1112 1109 {
1113   - xtype: 'panel',
  1110 + xtype: 'panel',
1114 1111 region: 'south',
1115 1112 title: 'Information',
1116 1113 collapsible: true,
... ... @@ -1121,12 +1118,12 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
1121 1118 loader: {
1122 1119 autoLoad: true,
1123 1120 url: helpDir+'filterHOWTO'
1124   - }
  1121 + }
1125 1122 }
1126 1123 ]
1127 1124 };
1128 1125 Ext.apply (me , Ext.apply (arguments, myConf));
1129   -
  1126 +
1130 1127 this.filtersInfoStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterInfo'});
1131 1128 this.filtersListStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterSelectList'});
1132 1129  
... ... @@ -1138,7 +1135,7 @@ Ext.define(&#39;amdaUI.FiltersUI&#39;, {
1138 1135 this.filtersListStore.load({
1139 1136 scope : me,
1140 1137 callback: function(records, operation, success)
1141   - {
  1138 + {
1142 1139 me.grid.setFiltersListStore(this.filtersListStore);
1143 1140 }
1144 1141 });
... ...