[
https://issues.apache.org/jira/browse/XAP-80?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477080
]
Turyn, Michael commented on XAP-80:
-----------------------------------
Better yet, I'll just do what Dojo does: put the "superclass" member on the
constructor, leading to code that looks like
xap.bridges.xap.RadioButton.myMethod = function(arg0,arg1,...,argN){
// Do what the superclass does:
xap.bridges.xap.RadioButton.superclass.myMethod.apply(this,arguments) ;
// Do subclass-specific things:
[...]
}
> setupClassAsSubclassOf() has some unexpected behavior
> -----------------------------------------------------
>
> Key: XAP-80
> URL: https://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.
-
You can reply to this email to add a comment to the issue online.