AbstractPlugin.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-AbstractPlugin'>/**
  19. </span> * The AbstractPlugin class is the base class from which user-implemented plugins should inherit.
  20. *
  21. * This class defines the essential API of plugins as used by Components by defining the following methods:
  22. *
  23. * - `init` : The plugin initialization method which the owning Component calls at Component initialization time.
  24. *
  25. * The Component passes itself as the sole parameter.
  26. *
  27. * Subclasses should set up bidirectional links between the plugin and its client Component here.
  28. *
  29. * - `destroy` : The plugin cleanup method which the owning Component calls at Component destruction time.
  30. *
  31. * Use this method to break links between the plugin and the Component and to free any allocated resources.
  32. *
  33. * - `enable` : The base implementation just sets the plugin's `disabled` flag to `false`
  34. *
  35. * - `disable` : The base implementation just sets the plugin's `disabled` flag to `true`
  36. */
  37. Ext.define('Ext.AbstractPlugin', {
  38. disabled: false,
  39. constructor: function(config) {
  40. this.initialConfig = config;
  41. Ext.apply(this, config);
  42. },
  43. clone: function() {
  44. return new this.self(this.initialConfig);
  45. },
  46. getCmp: function() {
  47. return this.cmp;
  48. },
  49. <span id='Ext-AbstractPlugin-cfg-pluginId'> /**
  50. </span> * @cfg {String} pluginId
  51. * A name for the plugin that can be set at creation time to then retrieve the plugin
  52. * through {@link Ext.AbstractComponent#getPlugin getPlugin} method. For example:
  53. *
  54. * var grid = Ext.create('Ext.grid.Panel', {
  55. * plugins: [{
  56. * ptype: 'cellediting',
  57. * clicksToEdit: 2,
  58. * pluginId: 'cellplugin'
  59. * }]
  60. * });
  61. *
  62. * // later on:
  63. * var plugin = grid.getPlugin('cellplugin');
  64. */
  65. <span id='Ext-AbstractPlugin-method-init'> /**
  66. </span> * @method
  67. * The init method is invoked after initComponent method has been run for the client Component.
  68. *
  69. * The supplied implementation is empty. Subclasses should perform plugin initialization, and set up bidirectional
  70. * links between the plugin and its client Component in their own implementation of this method.
  71. * @param {Ext.Component} client The client Component which owns this plugin.
  72. */
  73. init: Ext.emptyFn,
  74. <span id='Ext-AbstractPlugin-method-destroy'> /**
  75. </span> * @method
  76. * The destroy method is invoked by the owning Component at the time the Component is being destroyed.
  77. *
  78. * The supplied implementation is empty. Subclasses should perform plugin cleanup in their own implementation of
  79. * this method.
  80. */
  81. destroy: Ext.emptyFn,
  82. <span id='Ext-AbstractPlugin-method-enable'> /**
  83. </span> * The base implementation just sets the plugin's `disabled` flag to `false`
  84. *
  85. * Plugin subclasses which need more complex processing may implement an overriding implementation.
  86. */
  87. enable: function() {
  88. this.disabled = false;
  89. },
  90. <span id='Ext-AbstractPlugin-method-disable'> /**
  91. </span> * The base implementation just sets the plugin's `disabled` flag to `true`
  92. *
  93. * Plugin subclasses which need more complex processing may implement an overriding implementation.
  94. */
  95. disable: function() {
  96. this.disabled = true;
  97. }
  98. });</pre>
  99. </body>
  100. </html>