X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/src/AbstractPlugin.js diff --git a/src/AbstractPlugin.js b/src/AbstractPlugin.js new file mode 100644 index 00000000..bc3ebef2 --- /dev/null +++ b/src/AbstractPlugin.js @@ -0,0 +1,48 @@ +/** + * @class Ext.AbstractPlugin + * @extends Object + * + * Plugins are injected + */ +Ext.define('Ext.AbstractPlugin', { + disabled: false, + + constructor: function(config) { + // + if (!config.cmp && Ext.global.console) { + Ext.global.console.warn("Attempted to attach a plugin "); + } + // + Ext.apply(this, config); + }, + + getCmp: function() { + return this.cmp; + }, + + /** + * The init method is invoked after initComponent has been run for the + * component which we are injecting the plugin into. + */ + init: Ext.emptyFn, + + /** + * The destroy method is invoked by the owning Component at the time the Component is being destroyed. + * Use this method to clean up an resources. + */ + destroy: Ext.emptyFn, + + /** + * Enable the plugin and set the disabled flag to false. + */ + enable: function() { + this.disabled = false; + }, + + /** + * Disable the plugin and set the disabled flag to true. + */ + disable: function() { + this.disabled = true; + } +});