jsm

net/sf/jsm/table/filters/jsmExactFilter.js

Summary

No overview generated for 'net/sf/jsm/table/filters/jsmExactFilter.js'


Class Summary
JsmExactFilter A filter implementation checking for exact values

/**
 * Creates a new JsmExactFilter object
 * @class A filter implementation checking for exact values
 * @constructor
 * @param {String} columnIdxOrName The column idx or name
 * @param {String} value The value the cell has to contain
 * @param {boolean} ignoreCase Ignore case
 */ 
  function JsmExactFilter(columnIdxOrName, value, ignoreCase) {
  	this.columnIdxOrName = columnIdxOrName;
  	this.value = value;
  	this.ignoreCase = ignoreCase;
  } 
  JsmExactFilter.prototype.className="JsmExactFilter";  

  	/** checks if this row is valid or if it should be filtered out
  	* @param {JsmTr} The table row
  	* @return {boolean}
  	*/   
  JsmExactFilter.prototype.isValidRow = function(tr) {
  	retVal = false;  
	logger.debug("JsmExactFilter: " + tr.getCell(this.columnIdxOrName).getValue() + " - " + this.value);
  	if (this.ignoreCase) {
  		if (tr.getCell(this.columnIdxOrName).getValue().toLowerCase() == this.value.toLowerCase()) retVal = true;
  	} else {
  		if (tr.getCell(this.columnIdxOrName).getValue() == this.value) retVal = true;
  	}
  	
  	return retVal;
  }
  
  /** Sets the column to filter on
 	* @param {int/String} columnIdxOrName The column name or index
 	* @return this
  	*/     
  JsmExactFilter.prototype.setColumn = function(columnIdxOrName) {
  	this.columnIdxOrName = columnIdxOrName;  
  	return this;  	
  }      
  
  /** Sets the value to filter against
 	* @param {String} value
 	* @return this
  	*/     
  JsmExactFilter.prototype.setValue = function(value) {
  	this.value = value;  
  	return this;  	
  }   
  
  /** Specifies if the case should be ignored
 	* @param {boolean} ignoreCase
 	* @return this
  	*/     
  JsmExactFilter.prototype.setIgnoreCase = function(ignoreCase) {
  	this.ignoreCase = ignoreCase;  
  	return this;  	
  }   
  
  /** Clones this JsmExactFilter
  * @return {JsmExactFilter}
  */
  JsmExactFilter.prototype.clone = function() {
	var clonedObject = new JsmExactFilter();
   	//TODO is it sufficient to copy the Array or do we have to iterate and copy each entry
   	clonedObject._attributes = this._attributes;
   	clonedObject._metaData = this._metaData;   
   	clonedObject.value = this.value; 
   	clonedObject.ignoreCase = this.ignoreCase; 
   	clonedObject.columnIdxOrName = this.columnIdxOrName;    	   	  		
   	return clonedObject;	
  }   

jsm

Documentation generated by JSDoc on Tue Sep 26 08:42:57 2006