Hi Kent,

thank you for this patch.

However we don't think it's a really useful addon. These alias stuff is just for convenience. And therefor it's enough in my opinion to support only one alias. We also don't support multiple types here. Probably we will change this in the future all in one step. But currently the overhead for the array detection will be added for each property addition. I am sorry, but we won't apply this.

Maybe you can replace it this:

QxSplitPane.addProperty({ name : "leftWidget", getAlias : ["getTopWidget", "getFirstWidget"], setAlias : ["setTopWidget", "setFirstWidget"], type : QxConst.TYPEOF_OBJECT });

with:

QxSplitPane.addProperty({ name : "leftWidget", getAlias : "getTopWidget", setAlias : "setTopWidget, type : QxConst.TYPEOF_OBJECT });

QxSplitPane.prototype.setFirstWidget = QxSplitpane.prototype.setTopWidget;

QxSplitPane.prototype.getFirstWidget = QxSplitpane.prototype.getTopWidget;

Regards,

Sebastian




Kent Olsson schrieb:
setAlias and getAlias are today limited to only one alias each. As it is
needed in many cases, I have extended the class by the attached patch
and propose the change. The syntax is now of two ways:

QxSplitPane.addProperty({ name : "leftWidget", getAlias : "getTopWidget", setAlias : 
"setTopWidget", type : QxConst.TYPEOF_OBJECT });

or the new one

QxSplitPane.addProperty({ name : "leftWidget", getAlias : ["getTopWidget", "getFirstWidget"], 
setAlias : ["setTopWidget", "setFirstWidget"], type : QxConst.TYPEOF_OBJECT });

Additionally, if, for error tracing purposes, the following code can
check for the array type not only that it is an object (not added in the
diff):

function getObjectClass(obj)
{
    if (obj && obj.constructor && obj.constructor.toString)
    {
        var arr = obj.constructor.toString().match(/function\s*(\w+)/);
        return arr && arr.length == 2 ? arr[1] : undefined;
    }
    else
    {
        return undefined;
    }
}

That can also be added for stricter type checking.

Kent


------------------------------------------------------------------------

Index: source/script/core/QxExtend.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/core/QxExtend.js,v
retrieving revision 1.14
diff -u -r1.14 QxExtend.js
--- source/script/core/QxExtend.js      17 Feb 2006 20:42:44 -0000      1.14
+++ source/script/core/QxExtend.js      2 Apr 2006 14:53:13 -0000
@@ -650,11 +650,23 @@
   // building user configured get alias for property
   if (typeof p.getAlias === QxConst.TYPEOF_STRING) {
     pp[p.getAlias] = pp[QxConst.INTERNAL_GET + p.method];
+  }
+  else if(typeof p.getAlias === QxConst.TYPEOF_OBJECT) {
+    for(i = 0; i < p.getAlias.length; i++)
+    {
+      pp[p.getAlias[i]] = pp[QxConst.INTERNAL_GET + p.method];
+    };
   };
// building user configured set alias for property
   if (typeof p.setAlias === QxConst.TYPEOF_STRING) {
     pp[p.setAlias] = pp[QxConst.INTERNAL_SET + p.method];
+  }
+  else if(typeof p.setAlias === QxConst.TYPEOF_OBJECT) {
+    for(i = 0; i < p.setAlias.length; i++)
+    {
+      pp[p.setAlias[i]] = pp[QxConst.INTERNAL_SET + p.method];
+    };
   };
 };



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to