Upgrade to ExtJS 4.0.1 - Released 05/18/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      * @method
27      */
28     init: Ext.emptyFn,
29
30     /**
31      * The destroy method is invoked by the owning Component at the time the Component is being destroyed.
32      * Use this method to clean up an resources.
33      * @method
34      */
35     destroy: Ext.emptyFn,
36
37     /**
38      * Enable the plugin and set the disabled flag to false.
39      */
40     enable: function() {
41         this.disabled = false;
42     },
43
44     /**
45      * Disable the plugin and set the disabled flag to true.
46      */
47     disable: function() {
48         this.disabled = true;
49     }
50 });