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 jm...@apache.org on 2007/05/21 22:37:25 UTC

svn commit: r540332 - in /incubator/xap/trunk/codebase: css/xapDefault.css src/xap/bridges/dojo/TableBridge.js

Author: jmargaris
Date: Mon May 21 15:37:24 2007
New Revision: 540332

URL: http://svn.apache.org/viewvc?view=rev&rev=540332
Log:
https://issues.apache.org/jira/browse/XAP-440

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

Modified: incubator/xap/trunk/codebase/css/xapDefault.css
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/css/xapDefault.css?view=diff&rev=540332&r1=540331&r2=540332
==============================================================================
--- incubator/xap/trunk/codebase/css/xapDefault.css (original)
+++ incubator/xap/trunk/codebase/css/xapDefault.css Mon May 21 15:37:24 2007
@@ -362,14 +362,17 @@
 }
 
 .alternateRow{ 
+	color: black;
 	background-color: #EDEDED;
 }
 
-.selectedRow{ 
+.selectedRow{
+	color: black;
 	background-color: #F5DE92;
 }
 
 .header{
+	color: black;
 	background-color: #EDEDED;
 }
 

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=540332&r1=540331&r2=540332
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js Mon May 21 15:37:24 2007
@@ -27,9 +27,9 @@
 
 Xap.require("xap.bridges.dojo.DojoWidgetBridge");
 Xap.require("xap.widgets.dojo.TreeTable"); 
+Xap.require("dojo.html"); 
 Xap.require("xap.util.CssUtils"); 
 
-
  
  /**
  * @fileoverview
@@ -75,7 +75,7 @@
 	if( w ){
 		peer._tableLayoutModel.initialWidth = w ;
 	}	
-}
+};
 
 
 
@@ -138,17 +138,20 @@
 /**
  * Dynamic attributes
  */
-xap.bridges.dojo.TableBridge.prototype.getNewAllowedAttributes = function(){
+xap.bridges.dojo.TableBridge.prototype.getNewAllowedAttributes = function() {
 	return [
 		"altColor",
 		"altBackgroundColor",
 		"highlightColor",
 		"highlightBackgroundColor",
 		"horizontalLineColor",
-		"verticalLineColor"];
+		"verticalLineColor",
+		"collapsedImage",
+		"expandedImage"];
 };
 
 
+
 xap.bridges.dojo.TableBridge.prototype.setHeightAttribute = function(value){
 	this.getPeer().setHeight (value);
 };
@@ -195,7 +198,7 @@
 xap.bridges.dojo.TableBridge.prototype.getGlobalRule = function(cssClassName) {
 	var globalRule = xap.util.CssUtils.getCSSRule('.' + cssClassName);
 	return globalRule;
-}
+};
 
 
 /**
@@ -203,20 +206,22 @@
  *
  *	@return CSS rule object
  */
-xap.bridges.dojo.TableBridge.prototype.getLocalRule = function(cssClassName,bCreate) {
+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 && bCreate ) {
-			// create local rule
-			var globalRule = this.getGlobalRule(cssClassName);
-			if( globalRule ){
-				dojo.html.insertCssRule(selector, globalRule.style.cssText);
-				localRule = xap.util.CssUtils.getCSSRule(selector);
-			}
+		// create local rule
+		var globalRule = this.getGlobalRule(cssClassName);
+		if( globalRule ){
+			dojo.html.insertCssRule(selector, globalRule.style.cssText);
+			localRule = xap.util.CssUtils.getCSSRule(selector);
+		} else {
+			xap.log.Logger.getRootLogger().error('Missing CSS rule ' + cssClassName);
+		}
 	}
 	return localRule;
-}
+};
 
 
 //===============================	ATTRIBUTE SETTERS
@@ -227,8 +232,10 @@
 	var cssClassName = this.getPeer()._alternateRowClass;
 	// "true" == "create one if there isn't one extant"
 	var localRule = this.getLocalRule(cssClassName, true);
-	if( localRule ){
+	if( localRule && localRule.style ){
 		localRule.style.color = value ;
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
 	}
 	// create local selected row class to prevent override
 	this.getLocalRule(this.getPeer()._selectedRowClass, true);
@@ -238,7 +245,7 @@
 xap.bridges.dojo.TableBridge.prototype.attributeRemovers.altColor = function() {
 	var cssClassName = this.getPeer()._alternateRowClass;
 	var localRule = this.getLocalRule(cssClassName);
-	if(localRule) {	localRule.style.color = null; } 
+	if(localRule) {	localRule.style.color = ''; } 
 };
 
 //==
@@ -247,16 +254,22 @@
 xap.bridges.dojo.TableBridge.prototype.setAltBackgroundColorAttribute = function(value) {
 	var cssClassName = this.getPeer()._alternateRowClass;
 	var localRule = this.getLocalRule(cssClassName);
-	localRule.style.backgroundColor = value;
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule && localRule.style ){
+		localRule.style.backgroundColor = value;
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
 	// create local selected row class to prevent override
-	this.getLocalRule(this.getPeer()._selectedRowClass);
+	this.getLocalRule(this.getPeer()._selectedRowClass, true);
 };
 
 /** XML attribute remove method for "altBackgroundColor" */
 xap.bridges.dojo.TableBridge.prototype.attributeRemovers.altBackgroundColor = function() {
 	var cssClassName = this.getPeer()._alternateRowClass;
 	var localRule = this.getLocalRule(cssClassName);
-	if(localRule) {	localRule.style.backgroundColor = null; } 
+	if(localRule) {	localRule.style.backgroundColor = ''; } 
 };
 
 
@@ -265,15 +278,20 @@
 /** XML attribute set method for "highlightColor" */
 xap.bridges.dojo.TableBridge.prototype.setHighlightColorAttribute = function(value) {
 	var cssClassName = this.getPeer()._selectedRowClass;
-	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 ){
+		localRule.style.color = value ;
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
 };
 
 /** XML attribute remove method for "highlightColor" */
 xap.bridges.dojo.TableBridge.prototype.attributeRemovers.highlightColor = function() {
 	var cssClassName = this.getPeer()._selectedRowClass;
 	var localRule = this.getLocalRule(cssClassName);
-	if(localRule) {	localRule.style.color = null; } 
+	if(localRule) {	localRule.style.color = ''; } 
 };
 
 
@@ -283,34 +301,43 @@
 /** XML attribute set method for "highlightBackgroundColor" */
 xap.bridges.dojo.TableBridge.prototype.setHighlightBackgroundColorAttribute = function(value) {
 	var cssClassName = this.getPeer()._selectedRowClass;
-	var localRule = this.getLocalRule(cssClassName);
-	localRule.style.backgroundColor = value;
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule && localRule.style ){
+		localRule.style.backgroundColor = value;
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
 };
 
 /** XML attribute remove method for "highlightBackgroundColor" */
 xap.bridges.dojo.TableBridge.prototype.attributeRemovers.highlightBackgroundColor = function() {
 	var cssClassName = this.getPeer()._selectedRowClass;
 	var localRule = this.getLocalRule(cssClassName);
-	if(localRule) {	localRule.style.backgroundColor = null; } 
+	if(localRule) {	localRule.style.backgroundColor = ''; } 
 };
 
 
-
 //==
 
 
 /** XML attribute set method for "horizontalLineColor" */
 xap.bridges.dojo.TableBridge.prototype.setHorizontalLineColorAttribute = function(value) {
 	var cssClassName = this.getPeer()._tableCellClass;
-	var localRule = this.getLocalRule(cssClassName);
-	localRule.style.borderBottomColor = value;
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule && localRule.style ){
+		localRule.style.borderBottomColor = value;
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
 };
 
 /** XML attribute remove method for "horizontalLineColor" */
 xap.bridges.dojo.TableBridge.prototype.attributeRemovers.horizontalLineColor = function() {
 	var cssClassName = this.getPeer()._tableCellClass;
 	var localRule = this.getLocalRule(cssClassName);
-	if(localRule) {	localRule.style.borderBottomColor = null; } 
+	if(localRule) {	localRule.style.borderBottomColor = ''; } 
 };
 
 
@@ -320,14 +347,65 @@
 /** XML attribute set method for "verticalLineColor" */
 xap.bridges.dojo.TableBridge.prototype.setVerticalLineColorAttribute = function(value) {
 	var cssClassName = this.getPeer()._tableCellClass;
-	var localRule = this.getLocalRule(cssClassName);
-	localRule.style.borderRightColor = value;
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule && localRule.style ){
+		localRule.style.borderRightColor = value;
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
 };
 
 /** XML attribute remove method for "verticalLineColor" */
 xap.bridges.dojo.TableBridge.prototype.attributeRemovers.verticalLineColor = function() {
 	var cssClassName = this.getPeer()._tableCellClass;
 	var localRule = this.getLocalRule(cssClassName);
-	if(localRule) {	localRule.style.borderRightColor = null; } 
+	if(localRule) {	localRule.style.borderRightColor = ''; } 
+};
+
+
+//==
+
+
+/** XML attribute set method for "collapsedImage" */
+xap.bridges.dojo.TableBridge.prototype.setCollapsedImageAttribute = function(value) {
+	var cssClassName = 'ImgNodeCollapsed';
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule && localRule.style ){
+		localRule.style.backgroundImage = 'url(' + value + ')';
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
+};
+
+/** XML attribute remove method for "collapsedImage" */
+xap.bridges.dojo.TableBridge.prototype.attributeRemovers.collapsedImage = function() {
+	var cssClassName = 'ImgNodeCollapsed';
+	var localRule = this.getLocalRule(cssClassName);
+	if(localRule) {	localRule.style.backgroundImage = ''; } 
+};
+
+
+//==
+
+
+/** XML attribute set method for "expandedImage" */
+xap.bridges.dojo.TableBridge.prototype.setExpandedImageAttribute = function(value) {
+	var cssClassName = 'ImgNodeExpanded';
+	// "true" == "create one if there isn't one extant"
+	var localRule = this.getLocalRule(cssClassName, true);
+	if( localRule && localRule.style ){
+		localRule.style.backgroundImage = 'url(' + value + ')';
+	} else {
+		xap.log.Logger.getRootLogger().error('Unable to create local rule ' + cssClassName);
+	}
+};
+
+/** XML attribute remove method for "expandedImage" */
+xap.bridges.dojo.TableBridge.prototype.attributeRemovers.expandedImage = function() {
+	var cssClassName = 'ImgNodeExpanded';
+	var localRule = this.getLocalRule(cssClassName);
+	if(localRule) {	localRule.style.backgroundImage = ''; } 
 };