summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
index 740a091..8bb3016 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
30 27
31Clipperz.PM.UI.Web.Controllers.GridController = function(args) { 28Clipperz.PM.UI.Web.Controllers.GridController = function(args) {
32 args = args || {}; 29 args = args || {};
33 30
34 Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args); 31 Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args);
35 32
36 this._grid = null; 33 this._grid = null;
37 this._user = null; 34 this._user = null;
38 this._sortedColumnManager = null; 35 this._sortedColumnManager = null;
39 this._cachedObjects = null; 36 this._cachedObjects = null;
40 this._filterController = args.filterController || null; 37 this._filterController = args.filterController || null;
41 38
42 this._deferredDisplaySelectedRowsInvocation = null; 39 this._deferredDisplaySelectedRowsInvocation = null;
43 40
44 return this; 41 return this;
45}; 42};
46 43
47Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, { 44Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, {
48 45
49 'toString': function() { 46 'toString': function() {
50 return "Clipperz.PM.UI.Web.Controllers.GridController"; 47 return "Clipperz.PM.UI.Web.Controllers.GridController";
51 }, 48 },
52 49
53 //----------------------------------------------------------------------------- 50 //-----------------------------------------------------------------------------
54 51
55 'createGrid': function () { 52 'createGrid': function () {
56 throw Clipperz.Base.exception.AbstractMethod; 53 throw Clipperz.Base.exception.AbstractMethod;
57 }, 54 },
58 55
59 'setupWithGrid': function (aGrid) { 56 'setupWithGrid': function (aGrid) {
60 this._grid = aGrid; 57 this._grid = aGrid;
61 58
62 if (this._grid != null) { 59 if (this._grid != null) {
63 MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { 60 MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) {
64 if (aColumnManager.isSortable()) { 61 if (aColumnManager.isSortable()) {
65 if (aColumnManager.isSorted()) { 62 if (aColumnManager.isSorted()) {
66 this.setSortedColumnManager(aColumnManager); 63 this.setSortedColumnManager(aColumnManager);
67 } 64 }
68 MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort'); 65 MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort');
69 } 66 }
70 MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow'); 67 MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow');
71 MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow'); 68 MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow');
72 }, this); 69 }, this);
73 } 70 }
74 }, 71 },
75 72
76 'grid': function() { 73 'grid': function() {
77 if (this._grid == null) { 74 if (this._grid == null) {
78 this.setupWithGrid(this.createGrid()); 75 this.setupWithGrid(this.createGrid());
79 } 76 }
80 77
81 return this._grid; 78 return this._grid;
82 }, 79 },
83 80
84 'filterController': function () { 81 'filterController': function () {
85//Clipperz.log('GridController.filterController >>>', this._filterController); 82//Clipperz.log('GridController.filterController >>>', this._filterController);
86 if (this._filterController == null) { 83 if (this._filterController == null) {
87 this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); 84 this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController();
88 } 85 }
89//Clipperz.log('GridController.filterController <<<', this._filterController); 86//Clipperz.log('GridController.filterController <<<', this._filterController);
90 return this._filterController; 87 return this._filterController;
91 }, 88 },
92 89
93 //----------------------------------------------------------------------------- 90 //-----------------------------------------------------------------------------
94 91
95 'columnsManagers': function () { 92 'columnsManagers': function () {
96 return this.grid().columnsManagers(); 93 return this.grid().columnsManagers();
97 }, 94 },
98 95
99 'columnManagerWithName': function (aName) { 96 'columnManagerWithName': function (aName) {
100 varmanagers; 97 varmanagers;
101 var result; 98 var result;
102 99
103 managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers()); 100 managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers());
104 101
105 if (managers.length == 1) { 102 if (managers.length == 1) {
106 result = managers[0]; 103 result = managers[0];
107 } else if (managers.length == 0) { 104 } else if (managers.length == 0) {
108 result = null; 105 result = null;
109 } else { 106 } else {
110 throw "WTF!!!"; 107 throw "WTF!!!";
111 } 108 }
112 109
113 return result; 110 return result;
114 }, 111 },
115 112
116 'sortedColumnManager': function () { 113 'sortedColumnManager': function () {
117 return this._sortedColumnManager; 114 return this._sortedColumnManager;
118 }, 115 },
119 116
120 'setSortedColumnManager': function(aValue) { 117 'setSortedColumnManager': function(aValue) {