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 2006/08/23 03:23:09 UTC
svn commit: r433863 - in /incubator/xap/trunk/src/xap/bridges:
basic/AbstractBlackBoxWidgetBridge.js dojo/DojoWidgetBridge.js
Author: mturyn
Date: Tue Aug 22 20:23:08 2006
New Revision: 433863
URL: http://svn.apache.org/viewvc?rev=433863&view=rev
Log:
Shifted name-to-accessor/setter dictionaries to the classes (constructors) from the instances---they're
still accessed using instance methods for heritability, but the data are held on the classes.
Modified:
incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js
incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js
Modified: incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js?rev=433863&r1=433862&r2=433863&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/basic/AbstractBlackBoxWidgetBridge.js Tue Aug 22 20:23:08 2006
@@ -368,14 +368,13 @@
xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype.getAttribute = function(name){
// (Make sure that map's there, first:)
- if ( !this._nameToSetterMap || !this._nameToGetterMap ){
+ if ( !this._getNameToSetterMap() || !this._getNameToGetterMap() ){
this.initialiseAttributeMaps() ;
} //If we needed to initialise the maps.
- var getterName = "get" + name.substring(0,1).toUpperCase() +name.substring(1)+"Attribute" ;
- var result = null ;
- if (this[getterName]){
- result = this[getterName].call(this) ;
+ var getter = this._getNameToSetterMap()[name] ;
+ if ( getter ){
+ result = getter.call(this) ;
} else {
throw new xap.util.Exception("No getter for property: "+name+".") ;
}
@@ -424,7 +423,7 @@
// the list the class/constructor keeps:
// (Make sure that map's there, first:)
- if ( !this._nameToSetterMap || !this._nameToGetterMap ){
+ if ( !this._getNameToSetterMap() || !this._getNameToGetterMap() ){
this.initialiseAttributeMaps() ;
} //If we needed to initialise the maps.
@@ -520,7 +519,7 @@
* <center><code> foo → bridgeClass.prototype.setFooAttribute </code></center>
**/
xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype.getSetterFunctionForAttribute = function( name ) {
- return this._nameToSetterMap[name] ;
+ return this._getNameToSetterMap() [name] ;
}
@@ -536,15 +535,25 @@
xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype.initialiseAttributeMaps = function(){
// Initialise the default name-to[gs]etter map used under attributeSet:
- this._nameToSetterMap = new Object() ;
- this._nameToGetterMap = new Object() ;
+ this.constructor._nameToSetterMap = new Object() ;
+ this.constructor._nameToGetterMap = new Object() ;
var allowed = this.getAllowedAttributes() ;
for( var propName in allowed ){
var capitalisedName = propName.substring(0,1).toUpperCase() ;
if( propName.length > 1 ){
capitalisedName += propName.substring(1) ;
}
- this._nameToSetterMap[propName] = this["set"+capitalisedName+"Attribute"] ;
- this._nameToGetterMap[propName] = this["get"+capitalisedName+"Attribute"] ;
+ this._getNameToSetterMap() [propName] = this["set"+capitalisedName+"Attribute"] ;
+ this._getNameToGetterMap() [propName] = this["get"+capitalisedName+"Attribute"] ;
}
+}
+
+
+
+xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype._getNameToSetterMap = function(){
+ return this.constructor._nameToSetterMap ;
+}
+
+xap.bridges.basic.AbstractBlackBoxWidgetBridge.prototype._getNameToGetterMap = function(){
+ return this.constructor._nameToGetterMap ;
}
Modified: incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js?rev=433863&r1=433862&r2=433863&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/DojoWidgetBridge.js Tue Aug 22 20:23:08 2006
@@ -332,7 +332,7 @@
*
*/
xap.bridges.dojo.DojoWidgetBridge.prototype.getSetterFunctionForAttribute = function( name ) {
- return this._nameToSetterMap[name] ;
+ return this._getNameToSetterMap()[name] ;
}