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/05 20:17:22 UTC

svn commit: r493171 - in /incubator/xap/trunk/src/xap: bridges/dojo/WindowBridge.js widgets/dojo/Window.js

Author: mturyn
Date: Fri Jan  5 12:17:22 2007
New Revision: 493171

URL: http://svn.apache.org/viewvc?view=rev&rev=493171
Log:
http://issues.apache.org/jira/browse/XAP-87
1.) Added an extra sizing when the bridge is finishing up its initialisation.
2.) Moved more of the code to the widget, to avoid "puppetry" by the bridge;
	---much more modular if the widget does things involving its internals.

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

Modified: incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js?view=diff&rev=493171&r1=493170&r2=493171
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js Fri Jan  5 12:17:22 2007
@@ -86,6 +86,20 @@
 	// (on start-up, set[Min|Max]imizedAttribute() gets
 	// called if either of those attributes are set to
 	// "true", but neither works.)
+	
+	// Yet another place where an attribute
+	// doesn't change the start-up DOM unless we
+	// enforce it as late as possible:
+	var h = this.getElement().getAttribute("height") ;
+	var w = this.getElement().getAttribute("width") ;
+	
+	if( h && h!= ""){
+		this.setHeightAttribute(h) ;
+	}
+	if( w && w!= ""){
+		this.setWidthAttribute(w) ;
+	}	
+	
 }
 
 xap.bridges.dojo.WindowBridge.prototype.getPeerString = function(){
@@ -215,15 +229,14 @@
 
 /** XML attribute set method for "width" */
 xap.bridges.dojo.WindowBridge.prototype.setWidthAttribute = function(value){
-	this.getRootDomNode().style.width = value ;
-	this.getPeer().resizeWindow();
+	this.getPeer().setWidth(value) ;
 }
 
 /** XML attribute set method for "height" */
 xap.bridges.dojo.WindowBridge.prototype.setHeightAttribute = function(value){
-	this.getRootDomNode().style.height = value ;
-	this.getPeer().resizeWindow();
+	this.getPeer().setHeight(value) ;
 }
+
 
 /** XML attribute set method for "maximized" */
 xap.bridges.dojo.WindowBridge.prototype.setMaximizedAttribute = function(value){

Modified: incubator/xap/trunk/src/xap/widgets/dojo/Window.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/Window.js?view=diff&rev=493171&r1=493170&r2=493171
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/Window.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/Window.js Fri Jan  5 12:17:22 2007
@@ -51,7 +51,7 @@
 		dojo.event.connect(this,"onResized",this,"showTitleBarIcons");	
 
 		// Paranoically sure let us be that the icons are redisplayed:		
-		dojo.event.connect(this.resizeBar._resizeHandle,"endSizing",this,"showTitleBarIconsd");	
+		dojo.event.connect(this.resizeBar._resizeHandle,"endSizing",this,"showTitleBarIconsd");		
 	},
 	
 	minimizeWindow:function(evt) {
@@ -223,8 +223,20 @@
 		this.resizeBar.style.visibility=sAttr ;
 		
 		this._visible = bVisible ;
-	}	
+	},
+	
+	setHeight: function(val){
+	// get value in pixels by resizing dom node first:
+		this.domNode.style.height = val ;
+		this.resizeTo(this.domNode.clientWidth,this.domNode.clientHeight) ;	
+		this.resizeWindow() ;
+	},
 	
+	setWidth: function(val){
+		this.domNode.style.width = val ;
+		this.resizeTo(this.domNode.clientWidth,this.domNode.clientHeight) ;		
+		this.resizeWindow() ;
+	}
 });