Quantcast

Override a mixin method

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Override a mixin method

voger
I want to override a method in qx.ui.core.MBlocker mixin. I want the

  _createBlocker : function() {
       return new qx.ui.core.Blocker(this);
     },

to use another provided widget instead of this.

One option I guess is to call qx.Class.patch() and patch it. I don't
want that because this would patch it for the whole application.

Another idea was to define a _createBlocker function in the class that
uses the mixin but this is not allowed.

Another idea was to subclass the mixin but "The configuration key
"extend" in mixin "qssite.ui.dialog.MBlocker" is not allowed!"

The last option is to copy the contents of that mixin in a new separate
mixin and do whatever I want with it.

Are there any better options?

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Override a mixin method

Dietrich Streifert
Hi voger,

You are able to override mixin methods, not in the class which includes the mixin, but in a subclass of that class.

So if class A uses mixin MA having the method _createBlocker, derive class subA from class A and override in subA method _createBlocker.

Regards
Dietrich


> Am 29.11.2015 um 10:27 schrieb voger <[hidden email]>:
>
> I want to override a method in qx.ui.core.MBlocker mixin. I want the
>
>  _createBlocker : function() {
>       return new qx.ui.core.Blocker(this);
>     },
>
> to use another provided widget instead of this.
>
> One option I guess is to call qx.Class.patch() and patch it. I don't
> want that because this would patch it for the whole application.
>
> Another idea was to define a _createBlocker function in the class that
> uses the mixin but this is not allowed.
>
> Another idea was to subclass the mixin but "The configuration key
> "extend" in mixin "qssite.ui.dialog.MBlocker" is not allowed!"
>
> The last option is to copy the contents of that mixin in a new separate
> mixin and do whatever I want with it.
>
> Are there any better options?
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Override a mixin method

voger
Thanks. This is a very handy tip.

On 29/11/2015 01:54 μμ, Dietrich Streifert wrote:

> Hi voger,
>
> You are able to override mixin methods, not in the class which includes the mixin, but in a subclass of that class.
>
> So if class A uses mixin MA having the method _createBlocker, derive class subA from class A and override in subA method _createBlocker.
>
> Regards
> Dietrich
>
>
>> Am 29.11.2015 um 10:27 schrieb voger <[hidden email]>:
>>
>> I want to override a method in qx.ui.core.MBlocker mixin. I want the
>>
>>   _createBlocker : function() {
>>        return new qx.ui.core.Blocker(this);
>>      },
>>
>> to use another provided widget instead of this.
>>
>> One option I guess is to call qx.Class.patch() and patch it. I don't
>> want that because this would patch it for the whole application.
>>
>> Another idea was to define a _createBlocker function in the class that
>> uses the mixin but this is not allowed.
>>
>> Another idea was to subclass the mixin but "The configuration key
>> "extend" in mixin "qssite.ui.dialog.MBlocker" is not allowed!"
>>
>> The last option is to copy the contents of that mixin in a new separate
>> mixin and do whatever I want with it.
>>
>> Are there any better options?
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Loading...