summaryrefslogtreecommitdiff
path: root/frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js
Unidiff
Diffstat (limited to 'frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js131
1 files changed, 131 insertions, 0 deletions
diff --git a/frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js b/frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js
new file mode 100644
index 0000000..1f93590
--- a/dev/null
+++ b/frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js
@@ -0,0 +1,131 @@
1/**
2 * @class YAHOO.ext.grid.AbstractColumnModel
3 * @extends YAHOO.ext.util.Observable
4 * This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid.
5 * @constructor
6*/
7YAHOO.ext.grid.AbstractColumnModel = function(){
8 // legacy events
9 this.onWidthChange = new YAHOO.util.CustomEvent('widthChanged');
10 this.onHeaderChange = new YAHOO.util.CustomEvent('headerChanged');
11 this.onHiddenChange = new YAHOO.util.CustomEvent('hiddenChanged');
12
13 this.events = {
14 /**
15 * @event widthchange
16 * Fires when the width of a column changes
17 * @param {ColumnModel} this
18 * @param {Number} columnIndex The column index
19 * @param {Number} newWidth The new width
20 */
21 'widthchange': this.onWidthChange,
22 /**
23 * @event headerchange
24 * Fires when the text of a header changes
25 * @param {ColumnModel} this
26 * @param {Number} columnIndex The column index
27 * @param {Number} newText The new header text
28 */
29 'headerchange': this.onHeaderChange,
30 /**
31 * @event hiddenchange
32 * Fires when a column is hidden or "unhidden"
33 * @param {ColumnModel} this
34 * @param {Number} columnIndex The column index
35 * @param {Number} hidden true if hidden, false otherwise
36 */
37 'hiddenchange': this.onHiddenChange
38 };
39};
40
41YAHOO.ext.grid.AbstractColumnModel.prototype = {
42 fireEvent : YAHOO.ext.util.Observable.prototype.fireEvent,
43 on : YAHOO.ext.util.Observable.prototype.on,
44 addListener : YAHOO.ext.util.Observable.prototype.addListener,
45 delayedListener : YAHOO.ext.util.Observable.prototype.delayedListener,
46 removeListener : YAHOO.ext.util.Observable.prototype.removeListener,
47 purgeListeners : YAHOO.ext.util.Observable.prototype.purgeListeners,
48 bufferedListener : YAHOO.ext.util.Observable.prototype.bufferedListener,
49
50 fireWidthChange : function(colIndex, newWidth){
51 this.onWidthChange.fireDirect(this, colIndex, newWidth);
52 },
53
54 fireHeaderChange : function(colIndex, newHeader){
55 this.onHeaderChange.fireDirect(this, colIndex, newHeader);
56 },
57
58 fireHiddenChange : function(colIndex, hidden){
59 this.onHiddenChange.fireDirect(this, colIndex, hidden);
60 },
61
62 /**
63 * Interface method - Returns the number of columns.
64 * @return {Number}
65 */
66 getColumnCount : function(){
67 return 0;
68 },
69
70 /**
71 * Interface method - Returns true if the specified column is sortable.
72 * @param {Number} col The column index
73 * @return {Boolean}
74 */
75 isSortable : function(col){
76 return false;
77 },
78
79 /**
80 * Interface method - Returns true if the specified column is hidden.
81 * @param {Number} col The column index
82 * @return {Boolean}
83 */
84 isHidden : function(col){
85 return false;
86 },
87
88 /**
89 * Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none).
90 * @param {Number} col The column index
91 * @return {Function}
92 */
93 getSortType : function(col){
94 return YAHOO.ext.grid.DefaultColumnModel.sortTypes.none;
95 },
96
97 /**
98 * Interface method - Returns the rendering (formatting) function defined for the column.
99 * @param {Number} col The column index
100 * @return {Function}
101 */
102 getRenderer : function(col){
103 return YAHOO.ext.grid.DefaultColumnModel.defaultRenderer;
104 },
105
106 /**
107 * Interface method - Returns the width for the specified column.
108 * @param {Number} col The column index
109 * @return {Number}
110 */
111 getColumnWidth : function(col){
112 return 0;
113 },
114
115 /**
116 * Interface method - Returns the total width of all columns.
117 * @return {Number}
118 */
119 getTotalWidth : function(){
120 return 0;
121 },
122
123 /**
124 * Interface method - Returns the header for the specified column.
125 * @param {Number} col The column index
126 * @return {String}
127 */
128 getColumnHeader : function(col){
129 return '';
130 }
131};