incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r499884 - in /incubator/xap/trunk/codebase/src/xap: bridges/basic/AbstractWidgetBridge.js bridges/dojo/WindowBridge.js widgets/dojo/Window.js
Date Thu, 25 Jan 2007 18:29:29 GMT
Author: mturyn
Date: Thu Jan 25 10:29:28 2007
New Revision: 499884

URL: http://svn.apache.org/viewvc?view=rev&rev=499884
Log:
http://issues.apache.org/jira/browse/XAP-225
Basic attribute removal: on removing an attribute "foo", if there's a
         this.attributeRemovers["foo"]
it will run it, otherwise it will just do
         this.getRootDomNode.style["foo"] = "" ;

Reopen this with specific attribute problems (e.g., "Removing aGoogleMarker.opacity 
isn't updating the DOM"), if necessary.  It probably will be so, because though the general
method 
works all right with the basic attributes (extent/font/colouring/borders), specific
widgets will need specified methods---see the changes in WindowBridge for an example:  
        xap.widgets.dojo.WindowBridge.attributeRemovers["title"]

Changed Window to fit with the new scheme---before, it was treating a title of "" as a null
title, and ignoring it.

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

Modified: incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js?view=diff&rev=499884&r1=499883&r2=499884
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js Thu Jan 25
10:29:28 2007
@@ -888,4 +888,23 @@
 	clientEvent.keyChar = character;
 	this.fireEvent(eventName,null,null,clientEvent);
 	//IMPORTANT mods, consumed, cancel?
-}
\ No newline at end of file
+}
+
+// Mapper to specialized attribute removal methods:
+xap.bridges.basic.AbstractWidgetBridge.prototype.attributeRemovers = new Object() ;
+
+
+xap.bridges.basic.AbstractWidgetBridge.prototype.onAttributeRemoved = function(event){
+	var node = this.getRootDomNode() ;
+	var attributeName = event.getName() ;
+	
+	if (this.attributeRemovers[attributeName]){
+		this.attributeRemovers[attributeName].call(this) ;
+		return ;
+	}
+	
+	if(node && attributeName && node.style && node.style[attributeName]){
+		node.style[attributeName] = "" ;
+	} 
+}
+

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=499884&r1=499883&r2=499884
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js Thu Jan 25 10:29:28
2007
@@ -406,4 +406,12 @@
 	this.getPeer().setTitle( txt ) ;
 }
 
-
+/**
+ * We need a specified remover for the "title" attribute because the
+ * root dom node's style doesn't have a "title" attribute.
+ * @see xap.bridges.basic.AbstractWidgetBridge.prototype.onAttributeRemoved 
+ * @see xap.bridges.basic.AbstractWidgetBridge.prototype.attributeRemovers
+**/ 
+xap.bridges.dojo.WindowBridge.prototype.attributeRemovers["title"] = function(event){
+	this.setTitleAttribute("") ;	
+}
\ No newline at end of file

Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js?view=diff&rev=499884&r1=499883&r2=499884
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/Window.js Thu Jan 25 10:29:28 2007
@@ -420,7 +420,11 @@
 		}
 	},
 	setTitle:function(val){
-		if( !val){
+		// We need to be able to set the
+		// title to the empty string
+		// because that's what we do for 
+		// "removing" the title attribute:
+		if( !val && val != ""){
 			this.setTitle(this.title) ;
 			return ;
 		}



Mime
View raw message