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; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-PluginManager'>/**
21 * Provides a registry of available Plugin classes indexed by a mnemonic code known as the Plugin's ptype.
23 * A plugin may be specified simply as a *config object* as long as the correct `ptype` is specified:
26 * ptype: 'gridviewdragdrop',
27 * dragText: 'Drag and drop to reorganize'
30 * Or just use the ptype on its own:
34 * Alternatively you can instantiate the plugin with Ext.create:
36 * Ext.create('Ext.view.plugin.AutoComplete', {
37 * ptype: 'gridviewdragdrop',
38 * dragText: 'Drag and drop to reorganize'
41 Ext.define('Ext.PluginManager', {
42 extend: 'Ext.AbstractManager',
43 alternateClassName: 'Ext.PluginMgr',
47 <span id='Ext-PluginManager-method-create'> /**
48 </span> * Creates a new Plugin from the specified config object using the config object's ptype to determine the class to
50 * @param {Object} config A configuration object for the Plugin you wish to create.
51 * @param {Function} defaultType (optional) The constructor to provide the default Plugin type if the config object does not
52 * contain a `ptype`. (Optional if the config contains a `ptype`).
53 * @return {Ext.Component} The newly instantiated Plugin.
55 //create: function(plugin, defaultType) {
56 // if (plugin instanceof this) {
59 // var type, config = {};
61 // if (Ext.isString(plugin)) {
65 // type = plugin[this.typeName] || defaultType;
69 // return Ext.createByAlias('plugin.' + type, config);
73 create : function(config, defaultType){
77 return Ext.createByAlias('plugin.' + (config.ptype || defaultType), config);
80 // Prior system supported Singleton plugins.
81 //var PluginCls = this.types[config.ptype || defaultType];
82 //if (PluginCls.init) {
85 // return new PluginCls(config);
89 <span id='Ext-PluginManager-method-findByType'> /**
90 </span> * Returns all plugins registered with the given type. Here, 'type' refers to the type of plugin, not its ptype.
91 * @param {String} type The type to search for
92 * @param {Boolean} defaultsOnly True to only return plugins of this type where the plugin's isDefault property is
94 * @return {Ext.AbstractPlugin[]} All matching plugins
96 findByType: function(type, defaultsOnly) {
100 for (var name in types) {
101 if (!types.hasOwnProperty(name)) {
104 var item = types[name];
106 if (item.type == type && (!defaultsOnly || (defaultsOnly === true && item.isDefault))) {
114 <span id='Ext-method-preg'> /**
115 </span> * Shorthand for {@link Ext.PluginManager#registerType}
116 * @param {String} ptype The ptype mnemonic string by which the Plugin class
118 * @param {Function} cls The new Plugin class.
122 Ext.preg = function() {
123 return Ext.PluginManager.registerType.apply(Ext.PluginManager, arguments);