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/05/02 20:51:23 UTC

svn commit: r534613 - /incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuBarBridge.js

Author: mturyn
Date: Wed May  2 13:51:23 2007
New Revision: 534613

URL: http://svn.apache.org/viewvc?view=rev&rev=534613
Log:
XAP-403:
Class was attempting to set font weight, style, size, color, 
in all the menubar's children using an eval() statement that
included a variable name like this:

var handler=<something> ;
eval( string_0+ "handler"+ string_1)

which breaks as soon as the code is rhino-compacted---"handler" 
stops being the name of the variable.  Changed to 
		var setterFunction = childHandler.getSetterFunctionForAttribute( name ) ;
		setterFunction.call(childHandler,value) ;
and the attribute names changed to the camel-case the getSetter... call wants.


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

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuBarBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuBarBridge.js?view=diff&rev=534613&r1=534612&r2=534613
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuBarBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuBarBridge.js Wed May  2 13:51:23 2007
@@ -138,36 +138,38 @@
 
 /** XML attribute set method for "borderWidth" */
 xap.bridges.dojo.MenuBarBridge.prototype.setColorAttribute = function(value) {
-	this._setAttributeForMenus("Color", value);
+	this._setAttributeForMenus("color", value);
 } 
 
 /** XML attribute set method for "fontFamily" */
 xap.bridges.dojo.MenuBarBridge.prototype.setFontFamilyAttribute = function(value) {
-	this._setAttributeForMenus("FontFamily", value);
+	this._setAttributeForMenus("fontFamily", value);
 }
 
 /** XML attribute set method for "fontSize" */
 xap.bridges.dojo.MenuBarBridge.prototype.setFontSizeAttribute = function(value) {
-	this._setAttributeForMenus("FontSize", value);
+	this._setAttributeForMenus("fontSize", value);
 }
 
 /** XML attribute set method for "fontStyle" */
 xap.bridges.dojo.MenuBarBridge.prototype.setFontStyleAttribute = function(value) {
-	this._setAttributeForMenus("FontStyle", value);
+	this._setAttributeForMenus("fontStyle", value);
 }
 
 /** XML attribute set method for "fontWeight" */
 xap.bridges.dojo.MenuBarBridge.prototype.setFontWeightAttribute = function(value) {
-	this._setAttributeForMenus("FontWeight", value);
+	this._setAttributeForMenus("fontWeight", value);
 }
 
 xap.bridges.dojo.MenuBarBridge.prototype._setAttributeForMenus = function(name, value) {
 	var peer = this.getPeer();
 	var children = peer.children;
 
+	var uiContentHandler = this.getUiContentHandler() ;
 	for (var i = 0; i < children.length; i++) { 
-		var handler = this.getUiContentHandler().getHandlerForPeer(children[i]);
- 		eval("handler.set" + name + "Attribute(\"" + value +"\")");
+		var childHandler = uiContentHandler.getHandlerForPeer(children[i]);
+		var setterFunction = childHandler.getSetterFunctionForAttribute( name ) ;
+		setterFunction.call(childHandler,value) ;
 	}
 }