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/29 17:00:00 UTC

svn commit: r533528 - /incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js

Author: mturyn
Date: Sun Apr 29 09:59:59 2007
New Revision: 533528

URL: http://svn.apache.org/viewvc?view=rev&rev=533528
Log:
Made sizers wider to make them easier to select.
Adjusted code so that the wider sizers were positioned properly.
Removed (some) kruft.

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=533528&r1=533527&r2=533528
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Sun Apr 29 09:59:59 2007
@@ -62,7 +62,7 @@
 	this._initialResizePending = true;
 	
 	// width of each column sizer, in pixels:
-	this._sizerWidth = 2 ;
+	this._sizerWidth = 7 ;
 }
 
 dojo.inherits(xap.widgets.dojo.TreeTable,dojo.widget.HtmlWidget);
@@ -917,7 +917,7 @@
 		var splitterContainerStyle = splitterContainer.style ;		
 		splitterContainerStyle.position = "absolute" ;
 		splitterContainerStyle.top = "0px" ;
-		
+	
 		var box = dojo.html.getContentBox(this.headerRow) ;
 		box.height = this.domNode.scrollHeight ;
 		dojo.html.setMarginBox(splitterContainer,box) ;
@@ -945,13 +945,14 @@
 				
 		var columnsSizer = this.columnsSizer ;
 		var sizers = columnsSizer.sizers ;
+		var foundTrueSizerWidth = false ;		
 																							
 		for (var ii = 0; ii<this.headerRow.childNodes.length; ++ii){
 			var node = this.headerRow.childNodes[ii] ;
 			var box = dojo.html.getMarginBox(node) ;				
 			
-			if(borderFudge==null){
-				borderFudge 
+			if(this._borderFudge==null){
+				this._borderFudge 
 					= box.width - dojo.html.getContentBox(node).width;
 			}
 
@@ -960,7 +961,7 @@
 			// pane given over to this panel:
 			var dom = widg.domNode ;
 	
-			widg.sizeShare = box.width + borderFudge ;
+			widg.sizeShare = box.width ;//+ borderFudge ;
 
 			columnsSizer.addChild( widg ) ;			
 
@@ -973,7 +974,11 @@
 				dojo.html.removeClass(aSizer, "dojoSplitContainerSizerH") ;
 				dojo.html.addClass(aSizer, "xapTableStationarySizers") ;
 				aSizer.style.visibility="visible" ;	
-				aSizer.style.opacity = 0.0 ;
+				if( dojo.render.html.ie ){
+					aSizer.style.filter = "alpha(opacity=0)" ;				
+				} else {
+					aSizer.style.opacity = 0.0 ;				
+				}
 //				aSizer.style.backgroundColor="" ;
 				aSizer._xapReformatted = true ;		
 			}
@@ -1016,7 +1021,7 @@
 		sizer.onResized(null) ;
 		
 		var sizerDivs = sizer.sizers ;
-		
+		var sizerPanes = sizer.children ;
 
 		// We end up with superfluous sizers at the 
 		// end of the list; trim them:
@@ -1039,23 +1044,14 @@
 		}
 
 
-		var h = this.domNode.offsetHeight +"px" ;
-		var aSizer = null ;
-
-		// Now we'll be able to know the true sizer-width:
-		if( aSizer != null ){
-			var w = (dojo.html.getMarginBox(aSizer)).width ;
-			this._sizerWidth = w ;
-			sizer.sizerWidth = w ;	
-		}
-		
-		// Assign the split panels' "sizeShare", which will be used
-		// to set the relative sizes of the panels.  Here, we'll use
-		// their actual sizes; the widget will sum them and use them
-		// to get the correct proportions and sizes:
-		for(var ii=0; this._columns && ii< this._columns.length; ++ii ){
-			sizer.children.sizeShare = this._columns[ii].clientWidth ;
+		for(var ii=0; ii<sizerPanes.length; ++ii){
+			var sizerPane = sizerPanes[ii] ;
+			var w = dojo.html.getMarginBox(this.headerRow.childNodes[ii]).width ;
+			sizerPane.sizeShare = w ;
+			sizerPane.sizeActual = w ;	
+			sizerPane.domNode.style.width = (w)+"px" ;					
 		}
+		sizer._layoutPanels() ;
 	
 	},
 
@@ -1064,6 +1060,12 @@
 			dojo.lang.setTimeout(this,this._hideSplitterPanelsAndShowSizers,delay) ;
 			return ;
 		}
+	
+		if( this._columns.length != this.columnsSizer.children.length){
+			return ;
+		}
+	
+	
 		var sizer = this.columnsSizer ;
 		var parent = this.columnsSizer.domNode ;
 		var sizerHandles = sizer.sizers ;
@@ -1079,18 +1081,29 @@
 		
 		// TODO: get rid of bogus sizers; 'til then:
 		var nSizers = this._columns.length - 1 ;
+
+		// Figure out now if we'r in a browser
+		// that will need an explicitly transparent
+		// background colour---IE6 under XP
+		var shouldSetTransparent = 
+			dojo.render.html.ie60 &&
+( dojo.render.html.UA.indexOf("Windows NT 5") == -1 ) ;
+				
+
 		for(var ii=0; ii <= nSizers; ++ii){
 			var child = sizerHandles[ii] ;
 			var childStyle = child.style ;
 			childStyle.visibility = "visible" ;
 			childStyle.zIndex = 100 ;
-			if(dojo.render.html.ie60){
+
+			
+			if(shouldSetTransparent){
 				/* Can't set it to "transparent" in CSS because
 				   because that removes selectability under IE7;
-				   ---instead, apply it in code to IE6, which is
+				   ---instead, apply it in code to IE6/XP, which is
 				   the only place it's needed,as the stylesheet's
-				   0 opacity/alpha-filter stuff works fine in Fire-
-				   fox and IE7, respectably.
+				   {0 opacity} xor {alpha-filter stuff} works fine in Fire-
+				   fox, IE7, and IE6/Win2K.
 				*/
 				childStyle.backgroundColor="transparent" ;			
 			}			
@@ -1104,7 +1117,22 @@
 			var pane = splitterPanes[jj].domNode ;
 			pane.style.visibility="hidden" ;
 			pane.style.zIndex = 500 ;
-		}				
+		}
+		// Readjust sizer handles to match				
+		// headers:
+		var headers = this.headerRow.childNodes ;
+		for(var kk=0; kk < nSizers ; ++kk){
+			var child = sizerHandles[kk] ;			
+			var w = child.clientWidth ;
+	
+			// I think the "-2" is a border
+			// margin/padding factor, since it
+			// appears to be constant regardless of the splitter width>2:			
+			child.style.left = 
+				(headers[kk+1].offsetLeft 
+					-Math.round(w/2)) + "px" ;			
+		}			
+		
 		sizer.virtualSizer.style.visibility = "visible" ;	
 	},
 
@@ -1147,7 +1175,6 @@
 			this._rebuildRow(this._rows[i], 0);
 		}
 
-
 		// hide split panels, otherwise they'd
 		// block mouse events to the column headers
 		// they're over:
@@ -1161,6 +1188,7 @@
 		dojo.html.addClass( dragger, "xapTableMovingSizer" ) ;
 		// Can't cache: table height might changed
 		dragger.style.height = this.domNode.offsetHeight+"px" ;
+		dragger.style.width = "0px" ;
 		// Bring splitter container to front so
 		// that we're not getting the column mouseover effects:
 		this.splitterContainer.style.visibility = "visible" ;