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-ComponentManager'>/**
2 </span> * @class Ext.ComponentManager
3 * @extends Ext.AbstractManager
4 * <p>Provides a registry of all Components (instances of {@link Ext.Component} or any subclass
5 * thereof) on a page so that they can be easily accessed by {@link Ext.Component component}
6 * {@link Ext.Component#id id} (see {@link #get}, or the convenience method {@link Ext#getCmp Ext.getCmp}).</p>
7 * <p>This object also provides a registry of available Component <i>classes</i>
8 * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.
9 * The <code>xtype</code> provides a way to avoid instantiating child Components
10 * when creating a full, nested config object for a complete Ext page.</p>
11 * <p>A child Component may be specified simply as a <i>config object</i>
12 * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
13 * needs rendering, the correct type can be looked up for lazy instantiation.</p>
14 * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
17 Ext.define('Ext.ComponentManager', {
18 extend: 'Ext.AbstractManager',
19 alternateClassName: 'Ext.ComponentMgr',
25 <span id='Ext-ComponentManager-method-create'> /**
26 </span> * Creates a new Component from the specified config object using the
27 * config object's xtype to determine the class to instantiate.
28 * @param {Object} config A configuration object for the Component you wish to create.
29 * @param {Constructor} defaultType The constructor to provide the default Component type if
30 * the config object does not contain a <code>xtype</code>. (Optional if the config contains a <code>xtype</code>).
31 * @return {Ext.Component} The newly instantiated Component.
33 create: function(component, defaultType){
34 if (component instanceof Ext.AbstractComponent) {
37 else if (Ext.isString(component)) {
38 return Ext.createByAlias('widget.' + component);
41 var type = component.xtype || defaultType,
44 return Ext.createByAlias('widget.' + type, config);
48 registerType: function(type, cls) {
49 this.types[type] = cls;
50 cls[this.typeName] = type;
51 cls.prototype[this.typeName] = type;
53 });</pre></pre></body></html>