Hi Derrell,

> [EMAIL PROTECTED] writes:
>
>   
>> I have a test application (based on example/TreeVirtual_3.html) that works
>> fine if the tree is instantiated using
>>
>>   tree = new qx.ui.treevirtual.TreeVirtual(headings);
>>
>> It fails, though, if I subclass TreeVirtual like this:
>>
>> qx.Clazz.define("myclass.widget.tree.Tree",
>> {
>>   extend : qx.ui.treevirtual.TreeVirtual,
>>
>>   construct : function(headings)
>>   {
>>     this.base(arguments, headings);
>>   }
>> });
>>
>> and then instantiate the tree using
>>
>>   tree = new myclass.widget.tree.Tree(headings);
>>
>> The error produced is:
>>
>> 002970 ERROR: myclass.widget.tree.Tree[434]: Modification of property 
>> "tableModel" failed with exception: Error - Objects of class 
>> 'myclass.widget.tree.Tree' do not support the event 'appear' 
>>
>> It's failing in Target.js:89 due to the event being "unsupported".
>>
>> Am I doing something wrong, or is this a bug in Clazz.js?
>>     
>
> Hmmm...  It looks like I need to list every event that any superclass listens
> for in an "events" array.  This means that I need to search through all
> superclasses looking for what events are listened for.  I expect that once the
> framework gets 0.7-ized, all of the @event hints will get converted somehow,
> but it seems that it's the addEventListener() that's important here, not the
> dispatchEvents() which are what are associated with the @event hints.  How is
> this going to work?
>   
You only have to list every event of the super class in a mixed qooxdoo 
0.6/0.7 environment. If addEventListener is called on a new style class 
if will search the inheritence hirarchy for a definition a an event 
using the "events" key. The benefits are:

1. every event must be defined in the class the event is introduced
2. if the developer misspelles the event name, this will be detected and 
an error message just like above will be displayed


> Ok, for the benefit of anyone else trying to extend an existing class, you
> need to do something like this (which I've arrived at by trial and error; I'm
> sure I'm not done yet. :-) ...
>
> qx.Clazz.define("myclass.widget.tree.Tree",
> {
>   extend : qx.ui.treevirtual.TreeVirtual,
>
>   construct : function(headings)
>   {
>     this.base(arguments, headings);
>   },
>
>   events :
>   [
>     "appear",
>     "tableWidthChanged",
>     "verticalScrollBarChanged"
>   ]
> });
>   
Doesn't this look sweet ;-)

This is right for your situation since the super classes of your class 
e.g. Widget is still defined using the old class definition. Once 
qooxdoo is migrated (hopefully within the next few days) you only have 
to enumerate the events your class introduces.

> BTW, "events" is not documented at
> <http://qooxdoo.org/documentation/articles/proposed_class_declaration_for_qooxdoo_0.7?s=clazz>
> which is the only place I know of that this structure is documented.  Is there
> additional documentation, or was "events" inadvertently left out of the docs?
>
>   
This is right. They have been added after the wiki article was written 
and we just have not yet updated the article. The API doc of 
qx.Clazz.define however has some information about this.

I hope this helps.

Comments on the new class style are always welcome.

Best Fabian



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to