incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r472778 - /incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js
Date Thu, 09 Nov 2006 05:32:15 GMT
Author: mturyn
Date: Wed Nov  8 21:32:11 2006
New Revision: 472778

URL: http://svn.apache.org/viewvc?view=rev&rev=472778
Log:
Minimisation and maximisation seem to be in decent shape now.

Modified:
    incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.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=472778&r1=472777&r2=472778
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js Wed Nov  8 21:32:11 2006
@@ -27,6 +27,7 @@
 Xap.require("xap.session.ClientEvent"); 
 Xap.require("xap.util.Event");
 Xap.require('xap.bridges.dojo.DojoWidgetBridge');
+Xap.require("xap.xml.XmlTokens") ;
 
  /**
  * @fileoverview
@@ -48,16 +49,29 @@
 
 xap.bridges.dojo.WindowBridge.prototype.init = function() {
 	this.superclass.init.call(this);
-	this.getPeer().resizeTo(200,200);
-	dojo.event.connect(this.getPeer(),"maximizeWindow",this,"onMaximize");
-	dojo.event.connect(this.getPeer(),"minimizeWindow",this,"onMinimize");
-	dojo.event.connect(this.getPeer(),"closeWindow",this,"onClose");
-	dojo.event.connect(this.getPeer(),"restoreWindow",this,"onRestore");
-	
-	dojo.event.connectBefore(this.getPeer(),"maximizeWindow",this,"onMaximizing");
-	dojo.event.connectBefore(this.getPeer(),"minimizeWindow",this,"onMinimizing");
-	dojo.event.connectBefore(this.getPeer(),"closeWindow",this,"onClosing");
-	dojo.event.connectBefore(this.getPeer(),"restoreWindow",this,"onRestoring");
+	var peer = this.getPeer() ;
+
+	peer.resizeTo(200,200) ;
+
+	dojo.event.connect(peer,"maximizeWindow",this,"onMaximize");
+	dojo.event.connect(peer,"minimizeWindow",this,"onMinimize");
+	dojo.event.connect(peer,"closeWindow",this,"onClose");
+	dojo.event.connect(peer,"restoreWindow",this,"onRestore");
+	
+	dojo.event.connectBefore(peer,"maximizeWindow",this,"onMaximizing");
+	dojo.event.connectBefore(peer,"minimizeWindow",this,"onMinimizing");
+	dojo.event.connectBefore(peer,"closeWindow",this,"onClosing");
+	dojo.event.connectBefore(peer,"restoreWindow",this,"onRestoring");
+	
+	// Set max xor min, if desired, as early as possible:
+	if( this.getElement().getAttribute(xap.xml.XmlTokens.MINIMIZED) == "true"){
+		this.setMinimizedAttribute(xap.xml.XmlTokens.TRUE) ;
+	} else if( this.getElement().getAttribute(xap.xml.XmlTokens.MAXIMIZED) == "true"){
+		this.setMaximizedAttribute(xap.xml.XmlTokens.TRUE) ;
+	} 
+	// (on start-up, set[Min|Max]imizedAttribute() gets
+	// called if either of those attributes are set to
+	// "true", but neither works.)
 }
 
 xap.bridges.dojo.WindowBridge.prototype.getPeerString = function(){
@@ -74,7 +88,7 @@
  
 
 xap.bridges.dojo.WindowBridge.prototype.getNewAllowedAttributes = function(){
-	return [];
+	return ["maximized","minimized"];
 }	
 
 
@@ -105,6 +119,8 @@
 	//propertyMap.hasShadow= true; 
 	
 	propertyMap.constrainToContainer= true;
+		
+	
 	this.superclass.mapAllowedInitialPropertiesFromXalToDojo.call(this, propertyMap, attrHolder);
 }
 
@@ -195,5 +211,32 @@
 	this.getRootDomNode().style.height = value ;
 	this.getPeer().resizeWindow();
 }
+
+/** XML attribute set method for "maximized" */
+xap.bridges.dojo.WindowBridge.prototype.setMaximizedAttribute = function(value){
+	if( value == xap.xml.XmlTokens.TRUE){
+		if (this.getElement().getAttribute(xap.xml.XmlTokens.MAXIMIZABLE)
+				!= xap.xml.XmlTokens.FALSE
+			){
+			this.getPeer().maximizeWindow({});
+		}
+	} else {
+		this.getPeer().restoreWindow({}) ;
+	}		
+}
+
+/** XML attribute set method for "minimized" */
+xap.bridges.dojo.WindowBridge.prototype.setMinimizedAttribute = function(value){
+	if( value == xap.xml.XmlTokens.TRUE){
+		if (this.getElement().getAttribute(xap.xml.XmlTokens.MINIMIZABLE)
+				!= xap.xml.XmlTokens.FALSE
+			){
+			this.getPeer().minimizeWindow({});
+		}
+	} else {
+		this.getPeer().restoreWindow({}) ;
+	}
+}
+
  
  



Mime
View raw message