1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-PluginManager'>/**
2 </span> * @class Ext.PluginManager
3 * @extends Ext.AbstractManager
4 * <p>Provides a registry of available Plugin <i>classes</i> indexed by a mnemonic code known as the Plugin's ptype.
5 * The <code>{@link Ext.Component#xtype xtype}</code> provides a way to avoid instantiating child Components
6 * when creating a full, nested config object for a complete Ext page.</p>
7 * <p>A child Component may be specified simply as a <i>config object</i>
8 * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
9 * needs rendering, the correct type can be looked up for lazy instantiation.</p>
10 * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
13 Ext.define('Ext.PluginManager', {
14 extend: 'Ext.AbstractManager',
15 alternateClassName: 'Ext.PluginMgr',
19 <span id='Ext-PluginManager-method-create'> /**
20 </span> * Creates a new Plugin from the specified config object using the
21 * config object's ptype to determine the class to instantiate.
22 * @param {Object} config A configuration object for the Plugin you wish to create.
23 * @param {Constructor} defaultType The constructor to provide the default Plugin type if
24 * the config object does not contain a <code>ptype</code>. (Optional if the config contains a <code>ptype</code>).
25 * @return {Ext.Component} The newly instantiated Plugin.
27 //create: function(plugin, defaultType) {
28 // if (plugin instanceof this) {
31 // var type, config = {};
33 // if (Ext.isString(plugin)) {
37 // type = plugin[this.typeName] || defaultType;
41 // return Ext.createByAlias('plugin.' + type, config);
45 create : function(config, defaultType){
49 return Ext.createByAlias('plugin.' + (config.ptype || defaultType), config);
52 // Prior system supported Singleton plugins.
53 //var PluginCls = this.types[config.ptype || defaultType];
54 //if (PluginCls.init) {
57 // return new PluginCls(config);
61 <span id='Ext-PluginManager-method-findByType'> /**
62 </span> * Returns all plugins registered with the given type. Here, 'type' refers to the type of plugin, not its ptype.
63 * @param {String} type The type to search for
64 * @param {Boolean} defaultsOnly True to only return plugins of this type where the plugin's isDefault property is truthy
65 * @return {Array} All matching plugins
67 findByType: function(type, defaultsOnly) {
71 for (var name in types) {
72 if (!types.hasOwnProperty(name)) {
75 var item = types[name];
77 if (item.type == type && (!defaultsOnly || (defaultsOnly === true && item.isDefault))) {
85 <span id='Ext-method-preg'> /**
86 </span> * Shorthand for {@link Ext.PluginManager#registerType}
87 * @param {String} ptype The ptype mnemonic string by which the Plugin class
89 * @param {Constructor} cls The new Plugin class.
93 Ext.preg = function() {
94 return Ext.PluginManager.registerType.apply(Ext.PluginManager, arguments);
97 </pre></pre></body></html>