forked from NewbridgeGreen/extjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbstractPlugin.js
72 lines (66 loc) · 2.53 KB
/
AbstractPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* The AbstractPlugin class is the base class from which user-implemented plugins should inherit.
*
* This class defines the essential API of plugins as used by Components by defining the following methods:
*
* - `init` : The plugin initialization method which the owning Component calls at Component initialization time.
*
* The Component passes itself as the sole parameter.
*
* Subclasses should set up bidirectional links between the plugin and its client Component here.
*
* - `destroy` : The plugin cleanup method which the owning Component calls at Component destruction time.
*
* Use this method to break links between the plugin and the Component and to free any allocated resources.
*
* - `enable` : The base implementation just sets the plugin's `disabled` flag to `false`
*
* - `disable` : The base implementation just sets the plugin's `disabled` flag to `true`
*/
Ext.define('Ext.AbstractPlugin', {
disabled: false,
constructor: function(config) {
//<debug>
if (!config.cmp && Ext.global.console) {
Ext.global.console.warn("Attempted to attach a plugin ");
}
//</debug>
Ext.apply(this, config);
},
getCmp: function() {
return this.cmp;
},
/**
* @method
* The init method is invoked after initComponent method has been run for the client Component.
*
* The supplied implementation is empty. Subclasses should perform plugin initialization, and set up bidirectional
* links between the plugin and its client Component in their own implementation of this method.
* @param {Ext.Component} client The client Component which owns this plugin.
*/
init: Ext.emptyFn,
/**
* @method
* The destroy method is invoked by the owning Component at the time the Component is being destroyed.
*
* The supplied implementation is empty. Subclasses should perform plugin cleanup in their own implementation of
* this method.
*/
destroy: Ext.emptyFn,
/**
* The base implementation just sets the plugin's `disabled` flag to `false`
*
* Plugin subclasses which need more complex processing may implement an overriding implementation.
*/
enable: function() {
this.disabled = false;
},
/**
* The base implementation just sets the plugin's `disabled` flag to `true`
*
* Plugin subclasses which need more complex processing may implement an overriding implementation.
*/
disable: function() {
this.disabled = true;
}
});