setupClassAsSubclassOf() has some unexpected behavior
-----------------------------------------------------

                 Key: XAP-80
                 URL: http://issues.apache.org/jira/browse/XAP-80
             Project: XAP
          Issue Type: Bug
            Reporter: James Margaris


In TableBridge I have the following:

xap.bridges.dojo.TableBridge.prototype.init = function() {
        this.superclass.init.call(this);
        //add listener last so we don't fire for the initial set
        dojo.event.connect(this.getPeer(), 
"onActivateRow",this,"onActivateRow");       
        dojo.event.connect(this.getPeer(), "onSelectRow",this,"onSelectRow");   
        dojo.event.connect(this.getPeer(), 
"onDeselectRow",this,"onDeselectRow");
        dojo.event.connect(this.getPeer(), "onExpandRow",this,"onExpandRow");   
}

Now I set up a subclass of table bridge that does NOT override init.:


 /**
 * @fileoverview
 * 
 * A bridge class with dojo toolkit box panel peer.
 */
 
xap.bridges.dojo.TreeBridge= function() {
        xap.bridges.dojo.TableBridge.call(this);
}


Xap.setupClassAsSubclassOf(
                                "xap.bridges.dojo.TreeBridge",
                                "xap.bridges.dojo.TableBridge"                  
                        
);


When you map a tag to treeBridge and run, you get an infinite recursion.

If I change the init call in TableBridge to do:

xap.bridges.dojo.DojoWidgetBridge.prototype.init.call(this);

It works fine.

It seems to me that what is happening here:

We look for an init() and find one in TreeBridge that is actually the version 
from TableBridge
We run that init
The this.superclass call, since we are technically in TreeBridge, maps to the 
TableBridge (?) method
Some recursion occurs ??

We should look at how dojo works, there instead of:

this.superclass

You do:

xap.bridges.TreeBridge.superclass

Avoiding the use of "this" which has some context issues..

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to