4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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'>/**
19 </span> * @class Ext.PluginManager
20 * @extends Ext.AbstractManager
21 * <p>Provides a registry of available Plugin <i>classes</i> indexed by a mnemonic code known as the Plugin's ptype.
22 * The <code>{@link Ext.Component#xtype xtype}</code> provides a way to avoid instantiating child Components
23 * when creating a full, nested config object for a complete Ext page.</p>
24 * <p>A child Component may be specified simply as a <i>config object</i>
25 * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
26 * needs rendering, the correct type can be looked up for lazy instantiation.</p>
27 * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
30 Ext.define('Ext.PluginManager', {
31 extend: 'Ext.AbstractManager',
32 alternateClassName: 'Ext.PluginMgr',
36 <span id='Ext-PluginManager-method-create'> /**
37 </span> * Creates a new Plugin from the specified config object using the
38 * config object's ptype to determine the class to instantiate.
39 * @param {Object} config A configuration object for the Plugin you wish to create.
40 * @param {Constructor} defaultType The constructor to provide the default Plugin type if
41 * the config object does not contain a <code>ptype</code>. (Optional if the config contains a <code>ptype</code>).
42 * @return {Ext.Component} The newly instantiated Plugin.
44 //create: function(plugin, defaultType) {
45 // if (plugin instanceof this) {
48 // var type, config = {};
50 // if (Ext.isString(plugin)) {
54 // type = plugin[this.typeName] || defaultType;
58 // return Ext.createByAlias('plugin.' + type, config);
62 create : function(config, defaultType){
66 return Ext.createByAlias('plugin.' + (config.ptype || defaultType), config);
69 // Prior system supported Singleton plugins.
70 //var PluginCls = this.types[config.ptype || defaultType];
71 //if (PluginCls.init) {
74 // return new PluginCls(config);
78 <span id='Ext-PluginManager-method-findByType'> /**
79 </span> * Returns all plugins registered with the given type. Here, 'type' refers to the type of plugin, not its ptype.
80 * @param {String} type The type to search for
81 * @param {Boolean} defaultsOnly True to only return plugins of this type where the plugin's isDefault property is truthy
82 * @return {Array} All matching plugins
84 findByType: function(type, defaultsOnly) {
88 for (var name in types) {
89 if (!types.hasOwnProperty(name)) {
92 var item = types[name];
94 if (item.type == type && (!defaultsOnly || (defaultsOnly === true && item.isDefault))) {
102 <span id='Ext-method-preg'> /**
103 </span> * Shorthand for {@link Ext.PluginManager#registerType}
104 * @param {String} ptype The ptype mnemonic string by which the Plugin class
106 * @param {Constructor} cls The new Plugin class.
110 Ext.preg = function() {
111 return Ext.PluginManager.registerType.apply(Ext.PluginManager, arguments);