You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2007/05/01 03:43:14 UTC

svn commit: r533926 - /incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js

Author: mturyn
Date: Mon Apr 30 20:43:13 2007
New Revision: 533926

URL: http://svn.apache.org/viewvc?view=rev&rev=533926
Log:
Guarded against case when there is no local rule returned from getLocalRule(), including "no global rule" case.

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js?view=diff&rev=533926&r1=533925&r2=533926
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js Mon Apr 30 20:43:13 2007
@@ -184,15 +184,17 @@
  *
  *	@return CSS rule object
  */
-xap.bridges.dojo.TableBridge.prototype.getLocalRule = function(cssClassName) {
+xap.bridges.dojo.TableBridge.prototype.getLocalRule = function(cssClassName,bCreate) {
 	var id = this.getRootDomNode().getAttribute('id');
 	var selector = 'div#' + id + ' .' + cssClassName;
 	var localRule = xap.util.CssUtils.getCSSRule(selector);
-	if(!localRule) {
+	if(!localRule && bCreate ) {
 			// create local rule
 			var globalRule = this.getGlobalRule(cssClassName);
-			dojo.html.insertCssRule(selector, globalRule.style.cssText);
-			localRule = xap.util.CssUtils.getCSSRule(selector);
+			if( globalRule ){
+				dojo.html.insertCssRule(selector, globalRule.style.cssText);
+				localRule = xap.util.CssUtils.getCSSRule(selector);
+			}
 	}
 	return localRule;
 }
@@ -204,10 +206,13 @@
 /** XML attribute set method for "altColor" */
 xap.bridges.dojo.TableBridge.prototype.setAltColorAttribute = function(value) {
 	var cssClassName = this.getPeer()._alternateRowClass;
-	var localRule = this.getLocalRule(cssClassName);
-	localRule.style.color = value;
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule ){
+		localRule.style.color = value ;
+	}
 	// create local selected row class to prevent override
-	this.getLocalRule(this.getPeer()._selectedRowClass);
+	this.getLocalRule(this.getPeer()._selectedRowClass, true);
 };
 
 /** XML attribute remove method for "altColor" */