Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / src / AbstractPlugin.js
index bc3ebef..01f11b8 100644 (file)
@@ -1,12 +1,39 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact:  http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
 /**
- * @class Ext.AbstractPlugin
- * @extends Object
+ * 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.
  *
- * Plugins are injected 
+ *     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) {
@@ -15,32 +42,43 @@ Ext.define('Ext.AbstractPlugin', {
         //</debug>
         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.
+     * @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.
-     * Use this method to clean up an resources.
+     *
+     * The supplied implementation is empty. Subclasses should perform plugin cleanup in their own implementation of
+     * this method.
      */
     destroy: Ext.emptyFn,
 
     /**
-     * Enable the plugin and set the disabled flag to false.
+     * 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;
     },
 
     /**
-     * Disable the plugin and set the disabled flag to true.
+     * 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;