incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r541721 - /incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js
Date Fri, 25 May 2007 16:48:04 GMT
Author: mturyn
Date: Fri May 25 09:48:02 2007
New Revision: 541721

URL: http://svn.apache.org/viewvc?view=rev&rev=541721
Log:
http://issues.apache.org/jira/browse/XAP-456 +
Gets upper-right-hand corner of table fixed when there's just a vertical scrollbar.

Also: fixes small sizer displacement problem under Firefox.
Also: Fixes scrollbar logic---was over-widening FF.
Also: Tightens delays down for the scrollbar logic's implementation---formally 0ms for FF,
now 200ms for IEs (100ms worked, so I doubled it).

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=541721&r1=541720&r2=541721
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Fri May 25 09:48:02 2007
@@ -99,6 +99,15 @@
 	isContainer: false,
 	defaultCellInfo: {_text:""},
 	
+	// Delay between setting height or width and
+	// resetting scrollDiv overflow back to "auto" 
+	// (previously set to "hidden" at the start 
+	// of setHeight() or setWidth()):
+	_resetScrollDivDelayMs: (dojo.render.html.moz)?0:0,
+	// Delay between resetting scrollDiv overflow
+	// back to "auto" and checking to see the results of that:
+	_finishScrollDivDelayMs: (dojo.render.html.moz)?0:100,	
+	
 // Debugging	
 //	_ctr:-1 ,
 //	loggit: function(aString){
@@ -117,7 +126,7 @@
 			this._tableLayoutModel = {} ;
 		}	
 // debugging
-//window.foo = this ;
+window.foo = this ;
 	},		
 	
 	
@@ -713,7 +722,7 @@
 			= (this.domNode.offsetHeight 
 				- this.headerDiv.offsetHeight) +"px" ;
 
-		this._resetScrollDivLater(500) ;
+		this._resetScrollDivLater( this._resetScrollDivDelayMs ) ;
 
 	},
 	
@@ -735,14 +744,19 @@
 	
 	
 	_resetScrollDiv: function(){
-	// Should probably be able to avoit this,
+	// Should probably be able to avoid this,
 	// but this is doing it directly....
 		var oBox = {} ;
 		oBox.width = this.scrollDiv.clientWidth ;
 		oBox.height = this.scrollDiv.clientHeight ;
 
 		this.scrollDiv.style.overflow="auto" ;
-		dojo.lang.setTimeout(this,this._finishScrollDiv,200,oBox) ;
+		dojo.lang.setTimeout(
+							this,
+							this._finishScrollDiv,
+							this._finishScrollDivDelayMs,
+							oBox
+								) ;
 	},
 	
 	_finishScrollDiv: function(originalScrollClientBox){
@@ -759,16 +773,9 @@
 			if(!this._tableLayoutModel.initialWidth
 				&& !this._tableLayoutModel.resetWidthPx
 				){
-				var newWidthPx = this.domNode.scrollWidth ;
-				if(dojo.render.html.moz){
-					newWidthPx += deltaW ;
-				}
+				var newWidthPx = this.scrollDiv.offsetWidth ;
+				newWidthPx += deltaW ;
 				this.domNode.style.width = newWidthPx + "px" ;
-				// Redisplays headerDiv appropriately---fills in
-				// square above right vertical scrollbar:
-				this.onScrollCallback() ;				
-				// TODO: IMPORTANT: find a way to bring the
-				// get the upper right to look decent under IE6/7.				
 			}
 		} 
 		//debugger;
@@ -778,13 +785,21 @@
 			if( !this._tableLayoutModel.initialHeight
 				&& !this._tableLayoutModel.resetHeightPx
 				){
-				var newHeightPx = this.domNode.scrollHeight ;
-				if(dojo.render.html.moz){
-					newHeightPx += deltaH ;
-				}
+				var newHeightPx 
+					= this.scrollDiv.scrollHeight
+						+this.headerDiv.clientHeight ;
+//				if(dojo.render.html.ie){
+//					newHeightPx += deltaH ;
+//				}
 				this.scrollDiv.style.height = newHeightPx +"px" ;
 			}
-		}		
+		}
+			
+		// Redisplays headerDiv appropriately---fills in
+		// square above right vertical scrollbar:		
+		this.onScrollCallback() ;
+		this._renewColumnSizers() ;
+		this._fixAllSizerWidthsAndPositions() ;
 	},		
 	
 	setWidth: function(aWidth){   //debug::this.loggit('setWidth') ;
@@ -851,12 +866,12 @@
 		var deltaPx = fWidth - oWidth ;
 
 		if( deltaPx == 0  ){
-			this._resetScrollDivLater(500) ;
+			this._resetScrollDivLater(this._resetScrollDivDelayMs) ;
 			return ;
 		}
-		if( deltaPx <0){
+		if( deltaPx < 0){
 			// any need to do anything else?
-			this._resetScrollDivLater(500) ;
+			this._resetScrollDivLater(this._resetScrollDivDelayMs) ;
 			return ;			
 			
 		} 
@@ -866,6 +881,7 @@
 				|| !this.headerRow.childNodes
 				|| this.headerRow.childNodes.length == 0 
 			){
+			this._resetScrollDivLater(this._resetScrollDivDelayMs) ;			
 			return ;
 		}	
 				
@@ -876,7 +892,7 @@
 			var w = fWidth + "px" ;
 
 // TODO: remove all the bits now made redundant by
-// _resetScrollDiv
+// _resetScrollDiv---or maybe rename that to onResized()
 
 			this.table.style.width = "100%" ;
 			var tableWidth = this.table.clientWidth +"px" ;
@@ -893,7 +909,7 @@
 			this.extendLastColumn(deltaPx) ;
 		}
 
-		this._resetScrollDivLater(500) ;
+		this._resetScrollDivLater(this._resetScrollDivDelayMs) ;
 	},	
 	
 	extendLastColumn: function(changeInPixels){   //debug::this.loggit('extendLastColumn') ;
@@ -1491,6 +1507,11 @@
 			if( index < this.headerRow.childNodes.length - 1 ){	
 				left 
 					= this.headerRow.childNodes[index+1].offsetLeft ;
+				// under Firefox, looks like we're off by a border width
+				// or something (margin?)
+				if(dojo.render.html.moz){
+					left += 1 ;
+				}
 			} else {
 				// Pseudo-column at the end:
 				left= this.headerRow.scrollWidth ;						
@@ -1504,6 +1525,26 @@
 			sizerNode.style.width=this._sizerWidth +"px" ;
 			sizerNode.style.height = this.headerRow.clientHeight+"px";				
 	},
+	
+	
+	_fixAllSizerWidthsAndPositions: function(index){	
+		// Readjust sizer handles to match				
+		// headers:
+		if( !this.columnSizer ){
+			return ;
+		}
+		var sizerHandles = this.columnSizer.sizers ;
+		if( sizerHandles ){
+			return ;
+		}	
+
+		for(var kk=0; kk < sizerHandles.length ; ++kk){
+			// Widen the sizers so they're more selectable:
+			//---sizers behave more accurately when they're
+			// slimmer, but are harder to select....
+			this._fixSizerWidthAndPosition(kk) ;
+		}
+	},
 
 
 	_redoSplitPanelStyling: function(delay){   //debug::this.loggit('_redoSplitPanelStyling')
;
@@ -1643,7 +1684,8 @@
 //			}			
 		}	
 
-		var headers = this.headerRow.childNodes ;		
+		var headers = this.headerRow.childNodes ;
+		var totalSizeShare = 0 ;		
 		for(var jj=0; jj < headers.length; ++jj){
 			var paneWidget = splitterPanes[jj] ;		
 			var paneStyle = paneWidget.domNode.style ;
@@ -1652,6 +1694,7 @@
 			paneWidget.sizeShare 
 				= dojo.html.getMarginBox(headers[jj]).width ;
 			paneWidget.sizeActual = paneWidget.sizeShare ;				
+			totalSizeShare += paneWidget.sizeShare ;
 		}
 		// style the spacer pane at the far right to avoid
 		// a weird effect under ie that displays overflowed
@@ -1663,24 +1706,14 @@
 		paneStyle.visibility="visible" ;
 		dojo.html.addClass(paneWidget.domNode,"xapHeaderBackground");
 		paneStyle.zIndex = 0 ;
-//		paneWidget.sizeShare 
-//			= dojo.html.getMarginBox(headers[jj]).width ;
-//		paneWidget.sizeActual = paneWidget.sizeShare ;		
-		
-		
-		
+		paneWidget.sizeShare 
+			= this.splitterContainer.clientWidth
+				- totalSizeShare ;
+		paneWidget.sizeActual = paneWidget.sizeShare ;		
 		
 		// Readjust sizer handles to match				
 		// headers:
-		var headers = this.headerRow.childNodes ;
-		for(var kk=0; kk < sizerHandles.length ; ++kk){
-			// Widen the sizers so they're more selectable:
-			//---sizers behave more accurately when they're
-			// slimmer, but are harder to select....
-			this._fixSizerWidthAndPosition(kk) ;
-		}
-		
-	
+		this._fixAllSizerWidthsAndPositions() ;
 		
 		sizer.virtualSizer.style.visibility = "visible" ;	
 	},



Mime
View raw message