incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r535417 - in /incubator/xap/trunk/codebase/src/xap: bridges/dojo/TableBridge.js widgets/dojo/TreeTable.js
Date Sat, 05 May 2007 00:00:27 GMT
Author: mturyn
Date: Fri May  4 17:00:27 2007
New Revision: 535417

URL: http://svn.apache.org/viewvc?view=rev&rev=535417
Log:
Has a work-around for IE6/7 not doing well when adding rows to an originally-empty table.

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

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=535417&r1=535416&r2=535417
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TableBridge.js Fri May  4 17:00:27 2007
@@ -148,7 +148,6 @@
 	}
 	else if (childPeer instanceof xap.widgets.dojo.TableRow){
 		this.getPeer().insertRow(childPeer,-1);
-		this.getPeer().onRowInserted(childPeer, -1) ;
 	}
 };
 

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=535417&r1=535416&r2=535417
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Fri May  4 17:00:27 2007
@@ -86,6 +86,7 @@
 	+ '</div>'
 	+ '<div dojoAttachPoint="scrollDiv" style="overflow:auto;width:100%;height:100%;">'
 		+ '<table dojoAttachPoint="table" style="height:100%;">'
+			+ '<thead dojoAttachPoint="spacerRow"></thead>'
 			+ '<tbody></tbody>'
 		+ '</table>'
 	+ '</div>'
@@ -113,18 +114,19 @@
 	/**
 	 * Rebuild just the rows of the table, typically called after sorting.
 	 */
-	_rebuildRowsLater : function(){
+	_rebuildRowsLater : function(delay){
 		
 		//if a full rebuild is pending don't bother
 		if (!this._rebuildTableTask && !this._rebuildRowsTask){
-			this._rebuildRowsTask = dojo.lang.setTimeout(this, this._rebuildRows, 0);		
+			var theDelay = delay || 0 ;
+			this._rebuildRowsTask = dojo.lang.setTimeout(this, this._rebuildRows, delay);		
 		}
 	},
 	
 	/**
 	 * Rebuilds the entire table from scratch, should be a very rare occurence.
 	 */
-	_rebuildTableLater: function(){
+	_rebuildTableLater: function(delay){
 		
 		//cancel any partial rebuild tasks
 		if (this._rebuildRowsTask){
@@ -137,8 +139,9 @@
 		}
 		
 		//if not already scheduled then schedule it
+		var theDelay = delay || 0 ;
 		if (!this._rebuildTableTask){
-			this._rebuildTableTask = dojo.lang.setTimeout(this, this._rebuildTable, 0);
+			this._rebuildTableTask = dojo.lang.setTimeout(this, this._rebuildTable, theDelay);
 		}
 	},
 	
@@ -260,8 +263,10 @@
 				this.pullback() ;
 			}		
 		}
-		window.clearTimeout(this._resizeTableTask);
-		this._resizeTableTask = null;
+		if( this._resizeTableTask ){
+			window.clearTimeout(this._resizeTableTask);
+			this._resizeTableTask = null;
+		}
 	},
 	
 	_fixColumnWidths : function(){
@@ -371,8 +376,10 @@
 		for (var i =0; i<this._rows.length; i++){
 			this._rebuildRow(this._rows[i], 0);
 		}
-		window.clearTimeout(this._rebuildRowsTask);
-		this._rebuildRowsTask = null;
+		if( this._rebuildRowsTask ){
+			window.clearTimeout(this._rebuildRowsTask);
+			this._rebuildRowsTask = null;
+		}
 		
 		// resize columns in the case of new rows added
 		// ---absolutely avoid this if we've just sorted.
@@ -383,6 +390,7 @@
 			this._resizeTable();
 		}
 		this._recolorAlternateRows();
+		this._redoSplitterStyling(1000) ;		
 	},
 	
 	/**
@@ -488,8 +496,10 @@
 		
 		//if we have no width wait for onResized()
 	    if (!wh.width){
-	    	window.clearTimeout(this._rebuildTableTask);
-			this._rebuildTableTask = null;
+	    	if(this._rebuildTableTask){
+		    	window.clearTimeout(this._rebuildTableTask);
+				this._rebuildTableTask = null;
+			}
 			return;
 		}
 		this._initialResizePending = false;
@@ -497,10 +507,12 @@
 		this._rebuildHead();
 		this._rebuildBody();
 		
-
-		window.clearTimeout(this._rebuildTableTask);
-		this._rebuildTableTask = null;
+		if( this._rebuildTableTask ){
+			window.clearTimeout(this._rebuildTableTask);
+			this._rebuildTableTask = null;
+		}
 		this._resizeTable();
+		
 
 		if(dojo.render.html.ie){
 			this.pullback() ;
@@ -629,7 +641,7 @@
 		// 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._endSizing() ;
+		this._reconcileHeaderAndBodyColumns() ;
 		if(dojo.render.html.ie){
 			this.pullback() ;
 		}		
@@ -668,6 +680,9 @@
 			var ht = this.domNode.clientHeight - this.headerDiv.clientHeight;			
 			if ( ht > 0 ) contentHt = ht + "px";
 			this.scrollDiv.style.height = contentHt;
+			if( this.columnsSizer ){
+				this._renewColumnSizers() ;			
+			}
 		}
 	},
 	/**
@@ -732,7 +747,18 @@
 		//at the right spot. Gets kind of tricky for nested rows and such,
 		//in that case you need to insert relative to a sibling
 		// TODO: maybe resize the columns when stuff is added
-		this._rebuildRowsLater();
+
+		// TODO important: find out why the first row
+		// added to an IE table created with no rows
+		// gets messed-up column widths:
+		if(!this._created 
+			|| !dojo.render.html.ie
+				||this._rows.length>1 
+			){
+			this._rebuildRowsLater();			
+		} else {
+			this._rebuildTableLater(500);
+		}
 	},
 	
 	_rowRemoved: function(row){
@@ -816,11 +842,6 @@
 		//event hook
 	},
 	 
-	onRowInserted : function(rowWidget, index){
-		this._recolorAlternateRows();
-		this._redoSplitterStyling(1000) ;
-	 	//event hook
-	},	 
 	 
 	onScrollCallback : function(event){
 		if (this.scrollDiv){
@@ -1049,9 +1070,15 @@
 
 	_redoSplitterStyling: function(delay){
 		if( delay != undefined ){
-			dojo.lang.setTimeout(this,this._redoSplitterStyling,delay) ;
+			this._redoSplitterStylingTask
+				= dojo.lang.setTimeout(this,this._redoSplitterStyling,delay) ;
 			return ;
 		}
+		
+		if( this._redoSplitterStylingTask ){
+			window.clearTimeout(this._redoSplitterStylingTask) ;
+			this._redoSplitterStylingTask = null ;
+		}
 
 		var sizer = this.columnsSizer ;
 		
@@ -1111,7 +1138,8 @@
 
 	_hideSplitterPanelsAndShowSizers: function(delay){
 		if( delay != undefined ){
-			dojo.lang.setTimeout(this,this._hideSplitterPanelsAndShowSizers,delay) ;
+			this._hideSplitterPanelsAndShowSizersTask
+				= dojo.lang.setTimeout(this,this._hideSplitterPanelsAndShowSizers,delay) ;
 			return ;
 		}
 		// Don't bother if there are no columns or,
@@ -1123,6 +1151,10 @@
 			return ;
 		}
 	
+		if( this._hideSplitterPanelsAndShowSizersTask ){
+			window.clearTimeout(this._hideSplitterPanelsAndShowSizersTask	) ;
+			this._hideSplitterPanelsAndShowSizersTask = null ;
+		}
 	
 		var sizer = this.columnsSizer ;
 		var parent = this.columnsSizer.domNode ;
@@ -1195,11 +1227,11 @@
 	},
 
 	onEndSizing: function(){
-		dojo.lang.setTimeout(this,this._endSizing,10) ;
+		dojo.lang.setTimeout(this,this._reconcileHeaderAndBodyColumns,10) ;
 	},
 	
 	
-	_endSizing: function(){	
+	_reconcileHeaderAndBodyColumns: function(){	
 		dojo.html.removeClass( this.columnsSizer.virtualSizer, "xapTableMovingSizer" ) ;	
 
 		this.columnsSizer._layoutPanels() ;
@@ -1429,7 +1461,9 @@
 		this.domNode.appendChild(td);
 		td.style.whiteSpace = "nowrap";
 		td.style.overflow = "hidden";
-		
+		cell.style.whiteSpace = "nowrap";
+		cell.style.overflow = "hidden";		
+
 		var hAlignment = null ;
 		if ( cell.style.textAlign ) {
 			hAlignment = cell.style.textAlign;



Mime
View raw message