OK - I found it out - maybe obvious, but wasn't for me:
qx.Class.include() needs to be called BEFORE the class is instantiated
for the first time. The problem in my code was that the classes had been
used previously.
So what I gathered is that the property system of qooxdoo is
FUNDAMENTALLY different from the normal javascript prototype-based
property inheritance, and that mixins at runtime are much more complex
that simply attaching methods to the prototype.
I hope I'll have the time to write a short notice on this in the wiki.
Cheers,
Christian
Christian Boulanger schrieb:
> Very very strange behaviour:
>
> var log= qx.log.Logger.ROOT_LOGGER;
> log.setMinLevel(qx.log.Logger.LEVEL_ALL);
>
> qx.Class.include(qx.ui.basic.Atom,qx.io.databinding.MDataManager);
> qx.Class.include(qx.ui.basic.Label,qx.io.databinding.MDataManager);
> qx.Class.include(qx.ui.form.List,qx.io.databinding.MDataManager);
>
> qx.Class.include(qx.ui.form.TextField,qx.io.databinding.MDataManager);
>
> var at = new qx.ui.basic.Atom;
> var la = new qx.ui.basic.Label;
> var li = new qx.ui.form.List;
> var tf = new qx.ui.form.TextField;
>
> log.info ("qx.ui.basic.Atom.getDataBinding: " + at.getDataBinding);
> log.info ("qx.ui.basic.Label.getDataBinding: " + la.getDataBinding);
> log.info ("qx.ui.form.List.getDataBinding: " + li.getDataBinding);
> log.info ("qx.ui.form.TextField.getDataBinding: " +
> tf.getDataBinding);
>
>
> INFO: root: qx.ui.basic.Atom.getDataBinding: undefined
> INFO: root: qx.ui.basic.Label.getDataBinding: undefined
> INFO: root: qx.ui.form.List.getDataBinding: function () { return
> qx.core.Property.executeOptimizedGetter(this, clazz, name, "get"); }
> INFO: root: qx.ui.form.TextField.getDataBinding: undefined
>
> So the mixin seems to "stick" only to the qx.ui.form.List, but to none
> of the other classes. Does anyone have an explanation?
>
> Christian
>
>
>
> Christian Boulanger schrieb:
>
>> Very interesting:
>>
>> qx.Class.include(qx.ui.form.List,qx.io.databinding.MDataManager);
>> qx.Class.include(qx.ui.basic.Label,qx.io.databinding.MDataManager);
>>
>> var li = new qx.ui.form.List;
>> var la = new qx.ui.basic.Label;
>>
>> qx.core.Log.error ("qx.ui.form.List.getDataBinding: " +
>> li.getDataBinding);
>> qx.core.Log.error ("qx.ui.basic.Label.getDataBinding: " +
>> la.getDataBinding);
>>
>> results in:
>>
>> qx.ui.form.List.getDataBinding: function () { return
>> qx.core.Property.executeOptimizedGetter(this, clazz, name, "get"); }
>> qx.ui.basic.Label.getDataBinding: undefined
>>
>> this looks very sophisticated! However, why is
>> qx.ui.basic.Label.getDataBinding undefined when
>> qx.ui.form.List.getDataBinding has been correctly set?
>>
>> C.
>>
>>
>> Christian Boulanger schrieb:
>>
>>
>>> Here is something I don't understand:
>>>
>>> qx.Class.include(qx.ui.form.List,qx.io.databinding.MDataManager);
>>> for (var i in qx.ui.form.List)
>>> qx.core.Log.error(i + ": " + qx.ui.form.List[i]);
>>>
>>> I get the following list:
>>>
>>> $$original: function () { <snip/>}
>>> classname: qx.ui.form.List
>>> name: anonymous
>>> basename: List
>>> toString: function () { return "[Class " + this.classname + "]"; }
>>> prototype: [object qx.ui.form.List]
>>> superclass: [Class qx.ui.layout.VerticalBoxLayout]
>>> constructor: [Class qx.ui.form.List]
>>> $$destructor: function () { this._disposeObjects("_manager"); }
>>> $$properties: [object Object]
>>> $$includes: [Mixin qx.io.databinding.MDataManager]
>>> $$flatIncludes: [Mixin qx.io.databinding.MDataManager]
>>>
>>> I am always amazed and surprised once I dive into the internals of
>>> qooxdoo... where are all the getter and setter methods here? why don't
>>> they show up if I do a "for (.. in..)" loop?
>>>
>>> C.
>>>
>>>
>>> Christian Boulanger schrieb:
>>>
>>>
>>>
>>>> Any ideas about this problem? At the moment I am not even getting the
>>>> first option working, so everything might be a problem of my code. Has
>>>> anyone else ever combined mixins and inheritance? Thanks, C.
>>>>
>>>> Christian Boulanger schrieb:
>>>>
>>>>
>>>>
>>>>
>>>>> if I am including the mixin like so:
>>>>>
>>>>>
>>>>> qx.Class.include(qx.ui.basic.Label,qx.io.databinding.MDataManager);
>>>>>
>>>>> everything works. However, trying to achieve the same with
>>>>>
>>>>> qx.Class.include(qx.core.Target,qx.io.databinding.MDataManager);
>>>>>
>>>>> fails. It seems I have to manually include the mixin into each class I
>>>>> want to use it with.
>>>>>
>>>>> No messages in the debug log.
>>>>>
>>>>> It would be great if this could be fixed.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Christian
>>>>>
>>>>>
>>>>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel