incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r539267 - /incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js
Date Fri, 18 May 2007 05:46:08 GMT
Author: mturyn
Date: Thu May 17 22:46:07 2007
New Revision: 539267

URL: http://svn.apache.org/viewvc?view=rev&rev=539267
Log:
Extending last column in better shape, but table width clipping is off in IE when table domNode
width exceeds table body width.

Modified:
    incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js

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=539267&r1=539266&r2=539267
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Thu May 17 22:46:07 2007
@@ -65,7 +65,7 @@
 	this._initialResizePending = true;
 	
 	// width of each column sizer, in pixels:
-	this._sizerWidth = 8 ;
+	this._sizerWidth = 6 ;
 
 };
 
@@ -729,23 +729,43 @@
 	},	
 	
 	extendLastColumn: function(changeInPixels){   //debug::this.loggit('extendLastColumn') ;
+	
+		// Since their layout is fixed, this will mean that
+		// the tables in question will end up as wide as their
+		// columns (or first row cells, under IE) and borders
+		// will need.  If we don't do this, space ends up getting
+		// added to or subtracted from (it seems) the first cell,
+		// which ends up with a width of "100%":
+		this.headerTable.style.width = "auto" ;
+		this.table.style.width = "auto" ;			
+
+	
 		var headerChildren = this.headerRow.childNodes ;
 		var len = headerChildren.length ;
+		var lastIdx = len - 1 ;
 		if(len > 0){
 			var newWidth = dojo.html.getMarginBox(headerChildren[len-1]).width ;
 			newWidth += changeInPixels ;
-			headerChildren[len-1].style.width = newWidth+"px";				
+			headerChildren[lastIdx].style.width = newWidth+"px";				
 			var sizer = this.columnsSizer ;
 			// Put all the extra space in the last column:
-			sizer.children[len-1].sizeShare = newWidth ;
-			sizer.children[len-1].sizeActual = newWidth ;
-			this._columns[len-1]._explicitColumnWidth
+			sizer.children[lastIdx].sizeShare = newWidth ;
+			sizer.children[lastIdx].sizeActual = newWidth ;
+			this._columns[lastIdx]._explicitColumnWidth
 						 = newWidth + "px" ;
 		}
-		// We're now in much the same situation as at a drag end:
-		// we need to resize headers and body cells according to the
-		// new columns:
-		this._reconcileHeaderAndBodyColumns() ;
+		// Match headers to body columns:
+		this._fixColumnWidths(lastIdx,lastIdx) ;
+		
+		// Fix these widths (in the sense of "set them");
+		// leaving them free seems to hurt scrolling:
+		this.headerTable.style.width 
+			= this.headerTable.scrollWidth +"px" ;
+		this.table.style.width 
+			= this.headerTable.scrollWidth +"px" ;
+			
+		this._renewColumnSizers();
+
 	},
 
 	
@@ -1077,7 +1097,7 @@
 	_sizeSplitterContainer: function(){   //debug::this.loggit('_sizeSplitterContainer') ;
 		var box = {} ;
 
-		box.width = this.domNode.clientWidth
+		box.width = Math.max(this.domNode.scrollWidth,this.table.scrollWidth) ;
 		box.height =  this.scrollDiv.clientHeight
 						+ this.headerTable.clientHeight - 2 ;
 		
@@ -1142,6 +1162,7 @@
 		this._sizeSplitterContainer() ;
 		
 	
+	
 		// Get a more accurate result with 
 		// a splitter width of 1px; make wider
 		// at rest...
@@ -1217,6 +1238,10 @@
 	
 	_applyBasicSizerStyling: function(){
 	
+//debug		var rainbow=["red","orange","yellow","green",
+//						"blue","indigo","violet"
+//					] ;
+	
 		for( var idx = 0; idx < this.columnsSizer.sizers.length; ++idx){
 			var aSizer = this.columnsSizer.sizers[idx] ;
 /*debug*/			aSizer.id = this.domNode.id + "_sizer_"+idx ;
@@ -1238,7 +1263,7 @@
 			// splitter container desendent:
 			aSizer.style.visibility="visible" ;
 	
-// /*debug:*/	aSizer.style.backgroundColor = "darkcyan" ;			
+ // /*debug:*/	aSizer.style.backgroundColor = rainbow[idx] ;			
 				
 			if( dojo.render.html.ie ){
 				aSizer.style.filter = "alpha(opacity=0)" ;				
@@ -1294,7 +1319,7 @@
 		
 		var remainingWidthPx 
 				= this.columnsSizer.paneWidth ;
-				
+
 		for(var ii=0; ii<sizerPanes.length; ++ii){
 			var sizerPane = sizerPanes[ii] ;
 
@@ -1304,7 +1329,7 @@
 				sizerPane.sizeShare = w ;
 				sizerPane.sizeActual = w ;	
 				sizerPane.domNode.style.width = (w)+"px" ;
-				remainingWidthPx -= w ;
+				remainingWidthPx -= w ;				
 			} else {
 				// this is the extra pane on the right
 				sizerPane.sizeShare = remainingWidthPx ;
@@ -1401,7 +1426,9 @@
 				= (child.offsetLeft 
 					- Math.floor(w/2)							
 					) + "px" ;			
-		}			
+		}
+		
+	
 		
 		sizer.virtualSizer.style.visibility = "visible" ;	
 	},
@@ -1462,9 +1489,9 @@
 			delete this._lastTableRightPx ;
 			delete this._grabbedSizerIndex ;
 			delete this._grabbedTheLastSizer ;				
-			this.headerTable.style.width = currentTableRightPx +"px" ;
-			this.table.style.width = this.headerTable.style.width ;
+
 			this.extendLastColumn(deltaTableRightPx) ;
+		
 			return ;
 		}
 		// else---all other sizers:



Mime
View raw message