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/01/24 03:32:43 UTC

svn commit: r499232 - /incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js

Author: mturyn
Date: Tue Jan 23 19:32:42 2007
New Revision: 499232

URL: http://svn.apache.org/viewvc?view=rev&rev=499232
Log:
http://issues.apache.org/jira/browse/XAP-266

Centre a window that wants it at the end of init(); was earlier centering itself when its parent was of zero extent.

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js?view=diff&rev=499232&r1=499231&r2=499232
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js Tue Jan 23 19:32:42 2007
@@ -119,9 +119,25 @@
 		
 	
 	this.setHeightAttribute(h) ;	
-	this.setWidthAttribute(w) ;		
+	this.setWidthAttribute(w) ;	
+	
+	if( this.isCentered() ){
+		// does nothing until body grows larger than [0,0] in extent:
+		dojo.lang.setTimeout(this,"delayedCenter",0) ;
+	}		
 
 }
+
+//use only in a separate thread, since if the body never gets
+// big enough....:
+xap.bridges.dojo.WindowBridge.prototype.delayedCenter = function(){
+	if(document.body.clientHeight == 0 && document.body.clientWidth == 0){
+		dojo.lang.setTimeout(this,"delayedCenter",3) ;
+		return ;
+	};
+	this.center() ;
+}
+
 
 xap.bridges.dojo.WindowBridge.prototype.getPeerString = function(){
     return "Window" ;