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/04/20 00:59:50 UTC

svn commit: r530601 - in /incubator/xap/trunk/codebase: css/xapDefault.css src/xap/widgets/dojo/TreeTable.js

Author: mturyn
Date: Thu Apr 19 17:59:49 2007
New Revision: 530601

URL: http://svn.apache.org/viewvc?view=rev&rev=530601
Log:
Fixed bug introduced that screwed up natural-width columns (was comparing [e.g.] "160px">"140px" when
there was no explicit width.

Fixed header button blocking.

Modified:
    incubator/xap/trunk/codebase/css/xapDefault.css
    incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.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=530601&r1=530600&r2=530601
==============================================================================
--- incubator/xap/trunk/codebase/css/xapDefault.css (original)
+++ incubator/xap/trunk/codebase/css/xapDefault.css Thu Apr 19 17:59:49 2007
@@ -205,6 +205,11 @@
 	margin: 0px
 }
 
+
+.xapHeaderTable{
+	padding-left: 1px ;	
+}
+
 .xapHeaderMouseOver{
 	background-image: url(./xap_header_hover.gif);
 }
@@ -229,7 +234,7 @@
 }
 
 .xapHeaderWrapper{
-	border-left: 1px solid rgb(80,80,80);
+	border-right: 1px solid rgb(80,80,80);
 }
 
 .xapHeaderContents{

Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js?view=diff&rev=530601&r1=530600&r2=530601
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Thu Apr 19 17:59:49 2007
@@ -172,6 +172,12 @@
 		var firstRow = this._rows.length>0?this._rows[0].domNode:null;
 
 		var tableWidth = 0;
+		// No need to test for these each iteration:
+		var hasHeaders = this.headerRow && this.headerRow.childNodes ;
+		var hasFirstRow = firstRow && firstRow.childNodes ;	
+		var hasHeaderTable = this.headerTable && this.headerTable.childNodes ;
+		var hasBodyTable = this.table && this.table.childNodes ;
+		
 		for (var i=0; i<this._columns.length;i++){
 					
 			var headerWidth = 0;
@@ -180,21 +186,33 @@
 			
 			//In IE get/set of column width dynamically doesn't seem to work 
 			//too well so use first row instead
+
+			var node = null ;
 			if (dojo.render.html.ie){
-				var headerWidth = this.headerRow.childNodes[i].offsetWidth;
-				if (firstRow && firstRow.childNodes[i]){
+				if( hasHeaders && (node = this.headerRow.childNodes[i])){
+					headerWidth 
+						// = node.offsetWidth;
+						= dojo.html.getMarginBox(node).width;						
+				}
+				node = null ;
+				if ( hasFirstRow && (node = firstRow.childNodes[i]) ){
 					columnWidth 
-						= dojo.html.getMarginBox(firstRow.childNodes[i]).width
-							+"px" ;
+						= dojo.html.getMarginBox(node).width ;
 				}
 			}
 			else{
-				headerWidth 
-						= dojo.html.getMarginBox(this.headerTable.childNodes[i]).width
-							+"px" ;
-				columnWidth 
-						= dojo.html.getMarginBox(this.table.childNodes[i]).width
-							+"px" ;				
+				if( hasHeaderTable
+						&& (node = this.headerTable.childNodes[i])
+						){			
+					headerWidth 
+						= dojo.html.getMarginBox(node).width ;
+				}
+				node=null;
+				if( hasBodyTable
+					&& (node = this.table.childNodes[i])){
+					columnWidth 
+						= dojo.html.getMarginBox(node).width ;				
+				}
 			}
 			
 			/* if the user explicitly set the column width or
@@ -213,8 +231,9 @@
 			var finalWidth = setWidth ;
 			if( !setWidth ){
 				finalWidth = headerWidth>columnWidth ? headerWidth:columnWidth;	
+				finalWidth += "px" ;
 			}
-			this._columns[i].setSetWidth(finalWidth) ;
+			this._columns[i].setStatedWidth(finalWidth) ;
 			tableWidth += parseInt(finalWidth);
 		}
 		
@@ -377,6 +396,8 @@
 		this.headerBody = document.createElement("tbody");
 		this.headerTable.appendChild(this.headerBody);
 		
+		dojo.html.addClass(this.headerTable,"xapHeaderTable");
+		
 		//now populate the header row
 		this.headerRow = document.createElement("tr");
 		this.headerBody.appendChild(this.headerRow);
@@ -1007,10 +1028,15 @@
 		var parent = this.columnsSizer.domNode ;
 		var sizerHandles = sizer.sizers ;
 		var splitterPanes = this.columnsSizer.children ;
-		// Under Firefox and IE7, this is innocuous; 
+		// Under Firefox and IE7, this is innocuous 
+		// and in fact necessary to get the splitter 
+		// dom node out of the way of the column headers.
 		// under IE6 this screws up the sizing of
 		// the splitter dom node, making it 0-by-0:
-		//parent.style.visibility = "hidden" ;
+		if(!dojo.render.html.ie60){
+			parent.style.visibility = "hidden" ;
+		}
+		
 		// TODO: get rid of bogus sizers; 'til then:
 		var nSizers = this._columns.length - 1 ;
 		for(var ii=0; ii <= nSizers; ++ii){
@@ -1018,11 +1044,16 @@
 			child.style.visibility = "visible" ;
 			child.style.zIndex = 0 ;
 		}	
-		for(var jj=0; jj < splitterPanes.length; ++jj){
-			var pane = splitterPanes[jj] ;
-			child.style.visibility="hidden" ;
+		for(var kk=nSizers; kk < sizerHandles.length ; ++kk){
+			var child = sizerHandles[kk] ;
+			child.style.visibility = "visible" ;
 			child.style.zIndex = 500 ;
 		}			
+		for(var jj=0; jj < splitterPanes.length; ++jj){
+			var pane = splitterPanes[jj].domNode ;
+			pane.style.visibility="hidden" ;
+			pane.style.zIndex = 500 ;
+		}				
 		sizer.virtualSizer.style.visibility = "visible" ;	
 	},
 
@@ -1047,7 +1078,7 @@
 //				w += this._sizerWidth ;
 //			}
 			var wPx = w +"px" ;
-			this._columns[ii].setSetWidth(w) ;
+			this._columns[ii].setStatedWidth(w) ;
 			this._columns[ii]._explicitColumnWidth = wPx ;			
 			dojo.html.setMarginBox(
 									this._columns[ii].domNode,
@@ -1137,11 +1168,11 @@
 		}
 	},
 	
-	getSetWidth: function(){
-		return this._sSetWidth ;
+	getStatedWidth: function(){
+		return this._sStatedWidth ;
 	},
 
-	setSetWidth: function(val){
+	setStatedWidth: function(val){
 		var res = val ;
 		// We want a string value that
 		// can be used to directly set
@@ -1149,11 +1180,11 @@
 		if(!isNaN(val)){
 			res += "px" ;
 		}
-		this._sSetWidth = res ;
+		this._sStatedWidth = res ;
 	},
 	
 	getBestWidth: function(){
-		var res = this.getSetWidth() ;
+		var res = this.getStatedWidth() ;
 		if( !res ){
 			// Use column width; if not set,
 			// use header width: