Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / AbstractPlugin.js
1 /**
2  * @class Ext.AbstractPlugin
3  * @extends Object
4  *
5  * Plugins are injected 
6  */
7 Ext.define('Ext.AbstractPlugin', {
8     disabled: false,
9     
10     constructor: function(config) {
11         //<debug>
12         if (!config.cmp && Ext.global.console) {
13             Ext.global.console.warn("Attempted to attach a plugin ");
14         }
15         //</debug>
16         Ext.apply(this, config);
17     },
18     
19     getCmp: function() {
20         return this.cmp;
21     },
22
23     /**
24      * The init method is invoked after initComponent has been run for the
25      * component which we are injecting the plugin into.
26      */
27     init: Ext.emptyFn,
28
29     /**
30      * The destroy method is invoked by the owning Component at the time the Component is being destroyed.
31      * Use this method to clean up an resources.
32      */
33     destroy: Ext.emptyFn,
34
35     /**
36      * Enable the plugin and set the disabled flag to false.
37      */
38     enable: function() {
39         this.disabled = false;
40     },
41
42     /**
43      * Disable the plugin and set the disabled flag to true.
44      */
45     disable: function() {
46         this.disabled = true;
47     }
48 });