summaryrefslogtreecommitdiff
path: root/frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js
authorGiulio Cesare Solaroli <giulio.cesare@solaroli.it>2011-10-03 16:04:12 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@solaroli.it>2011-10-03 16:04:12 (UTC)
commit541bb378ddece2eab135a8066a16994e94436dea (patch) (side-by-side diff)
treeff160ea3e26f7fe07fcfd401387c5a0232ca715e /frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js
parent1bf431fd3d45cbdf4afa3e12afefe5d24f4d3bc7 (diff)
parentecad5e895831337216544e81f1a467e0c68c4a6a (diff)
downloadclipperz-541bb378ddece2eab135a8066a16994e94436dea.zip
clipperz-541bb378ddece2eab135a8066a16994e94436dea.tar.gz
clipperz-541bb378ddece2eab135a8066a16994e94436dea.tar.bz2
Merge pull request #1 from gcsolaroli/master
First version of the restructured repository
Diffstat (limited to 'frontend/beta/js/YUI-extensions/grid/AbstractColumnModel.js') (more/less context) (show 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 @@
+/**
+ * @class YAHOO.ext.grid.AbstractColumnModel
+ * @extends YAHOO.ext.util.Observable
+ * This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid.
+ * @constructor
+*/
+YAHOO.ext.grid.AbstractColumnModel = function(){
+ // legacy events
+ this.onWidthChange = new YAHOO.util.CustomEvent('widthChanged');
+ this.onHeaderChange = new YAHOO.util.CustomEvent('headerChanged');
+ this.onHiddenChange = new YAHOO.util.CustomEvent('hiddenChanged');
+
+ this.events = {
+ /**
+ * @event widthchange
+ * Fires when the width of a column changes
+ * @param {ColumnModel} this
+ * @param {Number} columnIndex The column index
+ * @param {Number} newWidth The new width
+ */
+ 'widthchange': this.onWidthChange,
+ /**
+ * @event headerchange
+ * Fires when the text of a header changes
+ * @param {ColumnModel} this
+ * @param {Number} columnIndex The column index
+ * @param {Number} newText The new header text
+ */
+ 'headerchange': this.onHeaderChange,
+ /**
+ * @event hiddenchange
+ * Fires when a column is hidden or "unhidden"
+ * @param {ColumnModel} this
+ * @param {Number} columnIndex The column index
+ * @param {Number} hidden true if hidden, false otherwise
+ */
+ 'hiddenchange': this.onHiddenChange
+ };
+};
+
+YAHOO.ext.grid.AbstractColumnModel.prototype = {
+ fireEvent : YAHOO.ext.util.Observable.prototype.fireEvent,
+ on : YAHOO.ext.util.Observable.prototype.on,
+ addListener : YAHOO.ext.util.Observable.prototype.addListener,
+ delayedListener : YAHOO.ext.util.Observable.prototype.delayedListener,
+ removeListener : YAHOO.ext.util.Observable.prototype.removeListener,
+ purgeListeners : YAHOO.ext.util.Observable.prototype.purgeListeners,
+ bufferedListener : YAHOO.ext.util.Observable.prototype.bufferedListener,
+
+ fireWidthChange : function(colIndex, newWidth){
+ this.onWidthChange.fireDirect(this, colIndex, newWidth);
+ },
+
+ fireHeaderChange : function(colIndex, newHeader){
+ this.onHeaderChange.fireDirect(this, colIndex, newHeader);
+ },
+
+ fireHiddenChange : function(colIndex, hidden){
+ this.onHiddenChange.fireDirect(this, colIndex, hidden);
+ },
+
+ /**
+ * Interface method - Returns the number of columns.
+ * @return {Number}
+ */
+ getColumnCount : function(){
+ return 0;
+ },
+
+ /**
+ * Interface method - Returns true if the specified column is sortable.
+ * @param {Number} col The column index
+ * @return {Boolean}
+ */
+ isSortable : function(col){
+ return false;
+ },
+
+ /**
+ * Interface method - Returns true if the specified column is hidden.
+ * @param {Number} col The column index
+ * @return {Boolean}
+ */
+ isHidden : function(col){
+ return false;
+ },
+
+ /**
+ * Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none).
+ * @param {Number} col The column index
+ * @return {Function}
+ */
+ getSortType : function(col){
+ return YAHOO.ext.grid.DefaultColumnModel.sortTypes.none;
+ },
+
+ /**
+ * Interface method - Returns the rendering (formatting) function defined for the column.
+ * @param {Number} col The column index
+ * @return {Function}
+ */
+ getRenderer : function(col){
+ return YAHOO.ext.grid.DefaultColumnModel.defaultRenderer;
+ },
+
+ /**
+ * Interface method - Returns the width for the specified column.
+ * @param {Number} col The column index
+ * @return {Number}
+ */
+ getColumnWidth : function(col){
+ return 0;
+ },
+
+ /**
+ * Interface method - Returns the total width of all columns.
+ * @return {Number}
+ */
+ getTotalWidth : function(){
+ return 0;
+ },
+
+ /**
+ * Interface method - Returns the header for the specified column.
+ * @param {Number} col The column index
+ * @return {String}
+ */
+ getColumnHeader : function(col){
+ return '';
+ }
+};