Commit e79d93b97cd0e2db2fbfd09a19699a4619a87c27
1 parent
ecac355e
Exists in
master
and in
111 other branches
fix trailing whitespaces on filterui
Showing
1 changed file
with
180 additions
and
180 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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
417 | 417 | } |
418 | 418 | }; |
419 | 419 | }, |
420 | - | |
420 | + | |
421 | 421 | createColumns : function() |
422 | 422 | { |
423 | 423 | return [ |
... | ... | @@ -427,11 +427,11 @@ Ext.define('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FilterGridPanel', { |
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('amdaUI.FiltersUI', { |
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('amdaUI.FiltersUI', { |
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('amdaUI.FiltersUI', { |
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('amdaUI.FiltersUI', { |
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,25 +691,25 @@ Ext.define('amdaUI.FiltersUI', { |
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; |
... | ... | @@ -725,13 +725,13 @@ Ext.define('amdaUI.FiltersUI', { |
725 | 725 | } |
726 | 726 | |
727 | 727 | var rec = this.getCrtFilterRecord(); |
728 | - | |
728 | + | |
729 | 729 | if (!rec) |
730 | 730 | return; |
731 | - | |
731 | + | |
732 | 732 | this.saveFilter(rec); |
733 | 733 | }, |
734 | - | |
734 | + | |
735 | 735 | onApplyFilter : function(t) |
736 | 736 | { |
737 | 737 | var me = this; |
... | ... | @@ -748,27 +748,27 @@ Ext.define('amdaUI.FiltersUI', { |
748 | 748 | ); |
749 | 749 | return; |
750 | 750 | } |
751 | - | |
751 | + | |
752 | 752 | this.requestApplyFilter(rec); |
753 | 753 | }, |
754 | - | |
754 | + | |
755 | 755 | requestApplyFilter : function(rec) |
756 | 756 | { |
757 | - AmdaAction.setCrtFilterId({id : rec.get('id')}, | |
757 | + AmdaAction.setCrtFilterId({id : rec.get('id')}, | |
758 | 758 | function (result, e) |
759 | 759 | { |
760 | 760 | var t = e.getTransaction(); |
761 | - if (e.status) | |
762 | - { | |
761 | + if (e.status) | |
762 | + { | |
763 | 763 | if (result) |
764 | 764 | { |
765 | 765 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) { |
766 | - module.setCrtFilter(); | |
767 | - }); | |
766 | + module.setCrtFilter(); | |
767 | + }); | |
768 | 768 | } |
769 | 769 | else |
770 | 770 | Ext.Msg.show( { |
771 | - title : 'Filter', | |
771 | + title : 'Filter', | |
772 | 772 | msg : 'Cannot apply filter', |
773 | 773 | modal : true, |
774 | 774 | icon : Ext.Msg.ERROR, |
... | ... | @@ -779,10 +779,10 @@ Ext.define('amdaUI.FiltersUI', { |
779 | 779 | { |
780 | 780 | // FAILURE |
781 | 781 | Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); |
782 | - } | |
782 | + } | |
783 | 783 | },this); |
784 | 784 | }, |
785 | - | |
785 | + | |
786 | 786 | isDirty : function(filter) |
787 | 787 | { |
788 | 788 | if (filter.dirty) |
... | ... | @@ -798,7 +798,7 @@ Ext.define('amdaUI.FiltersUI', { |
798 | 798 | ); |
799 | 799 | return dirty; |
800 | 800 | }, |
801 | - | |
801 | + | |
802 | 802 | getFilterCombo : function() |
803 | 803 | { |
804 | 804 | var comboField = this.query('#filter_combo'); |
... | ... | @@ -806,7 +806,7 @@ Ext.define('amdaUI.FiltersUI', { |
806 | 806 | return null; |
807 | 807 | return comboField[0]; |
808 | 808 | }, |
809 | - | |
809 | + | |
810 | 810 | getNameField : function() |
811 | 811 | { |
812 | 812 | var nameField = this.query('#filter_name'); |
... | ... | @@ -814,11 +814,11 @@ Ext.define('amdaUI.FiltersUI', { |
814 | 814 | return null; |
815 | 815 | return nameField[0]; |
816 | 816 | }, |
817 | - | |
817 | + | |
818 | 818 | saveFilter : function(rec,successfn) |
819 | 819 | { |
820 | 820 | var me = this; |
821 | - | |
821 | + | |
822 | 822 | var filterName = this.getFilterName(); |
823 | 823 | if (!filterName) |
824 | 824 | return; |
... | ... | @@ -842,13 +842,13 @@ Ext.define('amdaUI.FiltersUI', { |
842 | 842 | }); |
843 | 843 | return; |
844 | 844 | } |
845 | - | |
845 | + | |
846 | 846 | var msg; |
847 | 847 | if (rec.get('id') == 0) |
848 | 848 | msg = 'The name of the default filter cannot be modified. Do you want to create a new instance of this filter?'; |
849 | 849 | else |
850 | 850 | msg = 'Filter name has been changed. Do you want to create a new instance of this filter?'; |
851 | - | |
851 | + | |
852 | 852 | Ext.Msg.confirm('Filters', msg, |
853 | 853 | function(btn) { |
854 | 854 | if (btn == 'yes') |
... | ... | @@ -861,33 +861,33 @@ Ext.define('amdaUI.FiltersUI', { |
861 | 861 | conds[i] = cond.getJsonValues(); |
862 | 862 | }, |
863 | 863 | this); |
864 | - | |
864 | + | |
865 | 865 | //reload conditions of the current filter |
866 | 866 | amdaModel.FilterDef.load(rec.get('id'), |
867 | 867 | { |
868 | 868 | scope : this, |
869 | - callback : function(r, operation) | |
869 | + callback : function(r, operation) | |
870 | 870 | { |
871 | 871 | //reset modifications on current record |
872 | 872 | rec.conditions().removeAll(); |
873 | 873 | rec.conditions().loadData(r.conditions().data.items); |
874 | 874 | //create the new filter |
875 | 875 | var newRec = this.addFilter(filterName,conds,successfn); |
876 | - | |
876 | + | |
877 | 877 | } |
878 | - } | |
878 | + } | |
879 | 879 | ); |
880 | 880 | return; |
881 | - } | |
882 | - | |
881 | + } | |
882 | + | |
883 | 883 | if (rec.get('id') == 0) |
884 | 884 | { |
885 | 885 | filterName = rec.get('name'); //cannot change default filter name |
886 | 886 | this.setFilterName(filterName); |
887 | 887 | } |
888 | - | |
888 | + | |
889 | 889 | //change the name of the filter |
890 | - rec.set('name',filterName); | |
890 | + rec.set('name',filterName); | |
891 | 891 | //save modifications |
892 | 892 | rec.save({ |
893 | 893 | success: function() { |
... | ... | @@ -905,9 +905,9 @@ Ext.define('amdaUI.FiltersUI', { |
905 | 905 | }); |
906 | 906 | }, |
907 | 907 | this |
908 | - ); | |
908 | + ); | |
909 | 909 | }, |
910 | - | |
910 | + | |
911 | 911 | setFilterName : function(n) |
912 | 912 | { |
913 | 913 | var nameField = this.getNameField(); |
... | ... | @@ -915,13 +915,13 @@ Ext.define('amdaUI.FiltersUI', { |
915 | 915 | return; |
916 | 916 | nameField.setValue(n); |
917 | 917 | }, |
918 | - | |
918 | + | |
919 | 919 | getFilterName : function() |
920 | 920 | { |
921 | 921 | var nameField = this.getNameField(); |
922 | 922 | return nameField.getValue(); |
923 | 923 | }, |
924 | - | |
924 | + | |
925 | 925 | getCrtFilterRecord : function() |
926 | 926 | { |
927 | 927 | var combo = this.getFilterCombo(); |
... | ... | @@ -929,14 +929,14 @@ Ext.define('amdaUI.FiltersUI', { |
929 | 929 | return null; |
930 | 930 | return combo.store.getById(combo.getValue()); |
931 | 931 | }, |
932 | - | |
932 | + | |
933 | 933 | setCrtFilter : function() |
934 | - { | |
934 | + { | |
935 | 935 | AmdaAction.getCrtFilterId(function (result, e) |
936 | 936 | { |
937 | 937 | var t = e.getTransaction(); |
938 | - if (e.status) | |
939 | - { | |
938 | + if (e.status) | |
939 | + { | |
940 | 940 | if (result) |
941 | 941 | { |
942 | 942 | var crtId = result; |
... | ... | @@ -960,17 +960,17 @@ Ext.define('amdaUI.FiltersUI', { |
960 | 960 | { |
961 | 961 | // FAILURE |
962 | 962 | Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); |
963 | - } | |
963 | + } | |
964 | 964 | },this); |
965 | 965 | }, |
966 | - | |
966 | + | |
967 | 967 | createFilterStore : function() |
968 | 968 | { |
969 | 969 | return Ext.create('Ext.data.Store', |
970 | 970 | { |
971 | 971 | model: 'amdaModel.FilterDef', |
972 | 972 | autoLoad : true, |
973 | - listeners : | |
973 | + listeners : | |
974 | 974 | { |
975 | 975 | 'load' : function(store, records, successful) |
976 | 976 | { |
... | ... | @@ -987,10 +987,10 @@ Ext.define('amdaUI.FiltersUI', { |
987 | 987 | }, |
988 | 988 | scope : this |
989 | 989 | } |
990 | - | |
990 | + | |
991 | 991 | }); |
992 | 992 | }, |
993 | - | |
993 | + | |
994 | 994 | reloadFilter : function() |
995 | 995 | { |
996 | 996 | var combo = this.getFilterCombo(); |
... | ... | @@ -998,7 +998,7 @@ Ext.define('amdaUI.FiltersUI', { |
998 | 998 | return; |
999 | 999 | combo.getStore().reload(); |
1000 | 1000 | }, |
1001 | - | |
1001 | + | |
1002 | 1002 | createToolBar : function() |
1003 | 1003 | { |
1004 | 1004 | var me = this; |
... | ... | @@ -1041,10 +1041,10 @@ Ext.define('amdaUI.FiltersUI', { |
1041 | 1041 | 'beforeselect' : this.onBeforeSelect |
1042 | 1042 | } |
1043 | 1043 | } |
1044 | - | |
1044 | + | |
1045 | 1045 | ]; |
1046 | 1046 | }, |
1047 | - | |
1047 | + | |
1048 | 1048 | createInfoPanel : function() |
1049 | 1049 | { |
1050 | 1050 | var me = this; |
... | ... | @@ -1080,21 +1080,21 @@ Ext.define('amdaUI.FiltersUI', { |
1080 | 1080 | ] |
1081 | 1081 | }; |
1082 | 1082 | }, |
1083 | - | |
1083 | + | |
1084 | 1084 | createGridPanel : function() |
1085 | 1085 | { |
1086 | 1086 | this.grid = Ext.create('amdaUI.FilterGridPanel',{}); |
1087 | 1087 | return this.grid; |
1088 | 1088 | }, |
1089 | - | |
1090 | - init : function(config) | |
1089 | + | |
1090 | + init : function(config) | |
1091 | 1091 | { |
1092 | 1092 | var me = this; |
1093 | - | |
1093 | + | |
1094 | 1094 | var myConf = { |
1095 | 1095 | layout: 'border', |
1096 | 1096 | tbar : this.createToolBar(), |
1097 | - items: [ | |
1097 | + items: [ | |
1098 | 1098 | { |
1099 | 1099 | xtype : 'panel', |
1100 | 1100 | region: 'center', |
... | ... | @@ -1107,10 +1107,10 @@ Ext.define('amdaUI.FiltersUI', { |
1107 | 1107 | items : [ |
1108 | 1108 | this.createInfoPanel(), |
1109 | 1109 | this.createGridPanel() |
1110 | - ] | |
1110 | + ] | |
1111 | 1111 | }, |
1112 | 1112 | { |
1113 | - xtype: 'panel', | |
1113 | + xtype: 'panel', | |
1114 | 1114 | region: 'south', |
1115 | 1115 | title: 'Information', |
1116 | 1116 | collapsible: true, |
... | ... | @@ -1121,12 +1121,12 @@ Ext.define('amdaUI.FiltersUI', { |
1121 | 1121 | loader: { |
1122 | 1122 | autoLoad: true, |
1123 | 1123 | url: helpDir+'filterHOWTO' |
1124 | - } | |
1124 | + } | |
1125 | 1125 | } |
1126 | 1126 | ] |
1127 | 1127 | }; |
1128 | 1128 | Ext.apply (me , Ext.apply (arguments, myConf)); |
1129 | - | |
1129 | + | |
1130 | 1130 | this.filtersInfoStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterInfo'}); |
1131 | 1131 | this.filtersListStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterSelectList'}); |
1132 | 1132 | |
... | ... | @@ -1138,7 +1138,7 @@ Ext.define('amdaUI.FiltersUI', { |
1138 | 1138 | this.filtersListStore.load({ |
1139 | 1139 | scope : me, |
1140 | 1140 | callback: function(records, operation, success) |
1141 | - { | |
1141 | + { | |
1142 | 1142 | me.grid.setFiltersListStore(this.filtersListStore); |
1143 | 1143 | } |
1144 | 1144 | }); |
... | ... |