incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r480176 - in /incubator/xap/trunk/src/xap: bridges/dojo/WindowBridge.js widgets/dojo/Window.js
Date Tue, 28 Nov 2006 19:47:12 GMT
Author: mturyn
Date: Tue Nov 28 11:47:11 2006
New Revision: 480176

URL: http://svn.apache.org/viewvc?view=rev&rev=480176
Log:
XAP-86 --fixed (title-bar icon buttons left trails)
XAP-71 --partial fix---can reset 'resizable' other attributes still unsettable on the fly.

Redisplay (hide, then show) icons when the aWindow.resizeTo() method is called.
Added code that allows the window to keep better track of its resizing handle.

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=480176&r1=480175&r2=480176
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/WindowBridge.js Tue Nov 28 11:47:11 2006
@@ -49,8 +49,10 @@
 
 xap.bridges.dojo.WindowBridge.prototype.init = function() {
 	this.superclass.init.call(this);
+	
 	var peer = this.getPeer() ;
-
+	
+	
 	peer.resizeTo(200,200) ;
 	if( !peer.previous ){
 		peer.previous = {} ;
@@ -69,7 +71,7 @@
 	dojo.event.connectBefore(peer.titleBar,"ondblclick",this,"toggleMaximized");
 
 
-//	dojo.event.connectBefore(peer.domNode,"onkeydown",this,"kd");
+
 
 	
 	// Set max xor min, if desired, as early as possible:
@@ -100,7 +102,7 @@
  
 
 xap.bridges.dojo.WindowBridge.prototype.getNewAllowedAttributes = function(){
-	return ["maximized","minimized"];
+	return ["maximized","minimized","resizable"];
 }	
 
 
@@ -270,7 +272,7 @@
  * "Restore" == go back to last state, which means minimised if
  * that were the state from which we maximised.
 **/ 
- xap.bridges.dojo.WindowBridge.prototype.restoreWindow = function(){
+xap.bridges.dojo.WindowBridge.prototype.restoreWindow = function(){
 	if (
 		(this.getPeer().windowState == xap.xml.XmlTokens.MAXIMIZED)
 			&& this.wasMaximisedFromMinimized
@@ -285,8 +287,17 @@
 	}
  }
  
- 
-// xap.bridges.dojo.WindowBridge.prototype.kd = function(evt){
-// 	var foo = -1 ;
-// 	var goo = -1 ;
-// }
\ No newline at end of file
+
+xap.bridges.dojo.WindowBridge.prototype.setResizableAttribute = function(val){
+	if( val && val != "false"){
+		this.getPeer().enableResizeHandle() ;
+		this.writeBackAttribute(xap.xml.XmlTokens.RESIZABLE,xap.xml.XmlTokens.TRUE);		
+		this.resizable=xap.xml.XmlTokens.TRUE ;
+	} else if (!val || val=="false"){
+		this.getPeer().disableResizeHandle() ;
+		this.writeBackAttribute(xap.xml.XmlTokens.RESIZABLE,xap.xml.XmlTokens.FALSE);		
+		this.resizable=xap.xml.XmlTokens.FALSE ;		
+	}
+}
+
+

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=480176&r1=480175&r2=480176
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/Window.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/Window.js Tue Nov 28 11:47:11 2006
@@ -42,6 +42,17 @@
 
 dojo.lang.extend(xap.widgets.dojo.Window, {
 	widgetType: "Window",
+	postCreate: function(){
+		xap.widgets.dojo.Window.superclass.postCreate.call(this);	
+		this.aquireResizeHandleObject() ;
+		// Keep icons from leaving trails over the extending title bar:
+		dojo.event.connectBefore(this,"resizeTo",this,"redisplayTitlebarIcons");
+		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");

+	},
+	
 	minimizeWindow:function(evt) {
 
 		if (evt && xap.util.Event.getPreventDefault(evt)){
@@ -128,8 +139,67 @@
 			bottom: this.domNode.style.bottom,
 			right: this.domNode.style.right
 		};	
+	},
+	
+	enableResizeHandle: function(){
+		this.resizeBar.style.display="";
+		if( !this.resizeBar._resizeHandle ){
+			var rh = dojo.widget.createWidget("ResizeHandle", {targetElmId: this.widgetId, id:this.widgetId+"_resize"});
+			this.resizeBar._resizeHandle = rh ;	
+		}			
+		this.resizeBar.appendChild(this.resizeBar._resizeHandle.domNode);
+		this.resizeBar.style.visibility="visible" ;
+		this.resizeBar.style.display="";		
+	},
+
+
+	disableResizeHandle: function(){
+		if(this.resizeBar.firstChild){
+			this.resizeBar.removeChild(this.resizeBar.firstChild);
+		}
+	},
+	
+	aquireResizeHandleObject: function(){
+		// In order to change  resizability, and track size changes better
+		// we need to be able to grab the resizehandle object
+		// associated with the element---and dojo.byId() can't find it
+		// even though we get its name right---maybe it doesn't like the ':'
+		// In any event, we'll need this functionality in order to be able 
+		// to change the "resizable" attribute:
+		this.disableResizeHandle() ;
+		this.enableResizeHandle() ;			
+	},
+
+	windowActions:
+ 		{minimizeAction:null,
+ 			maximizeAction:null,
+ 			restoreAction:null,
+ 			closeAction:null
+ 		} ,
+
+	
+	redisplayTitlebarIcons: function(){
+		for(var action in  this.windowActions ){
+		// Note that we aren't touching the "display" attribute;
+		// this will override ...style.display=""
+			(this[action]).style.visibility = "hidden" ;
+		}
+		// The hiding above and this show is basically forcing a redraw:
+		dojo.lang.setTimeout(this,"showTitleBarIcons",1) ;
+	 },
+ 
+	showTitleBarIcons: function(){
+		for(var action in  this.windowActions ){
+			(this[action]).style.visibility = "visible" ;
+		}
 	}
+	
+	
 });
+
+
+
+
 
 
 dojo.require("dojo.html.shadow");



Mime
View raw message