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-ComponentManager'>/**
19 </span> * @class Ext.ComponentManager
20 * @extends Ext.AbstractManager
21 * <p>Provides a registry of all Components (instances of {@link Ext.Component} or any subclass
22 * thereof) on a page so that they can be easily accessed by {@link Ext.Component component}
23 * {@link Ext.Component#id id} (see {@link #get}, or the convenience method {@link Ext#getCmp Ext.getCmp}).</p>
24 * <p>This object also provides a registry of available Component <i>classes</i>
25 * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.
26 * The <code>xtype</code> provides a way to avoid instantiating child Components
27 * when creating a full, nested config object for a complete Ext page.</p>
28 * <p>A child Component may be specified simply as a <i>config object</i>
29 * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
30 * needs rendering, the correct type can be looked up for lazy instantiation.</p>
31 * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
34 Ext.define('Ext.ComponentManager', {
35 extend: 'Ext.AbstractManager',
36 alternateClassName: 'Ext.ComponentMgr',
42 <span id='Ext-ComponentManager-method-create'> /**
43 </span> * Creates a new Component from the specified config object using the
44 * config object's xtype to determine the class to instantiate.
45 * @param {Object} config A configuration object for the Component you wish to create.
46 * @param {Function} defaultType (optional) The constructor to provide the default Component type if
47 * the config object does not contain a <code>xtype</code>. (Optional if the config contains a <code>xtype</code>).
48 * @return {Ext.Component} The newly instantiated Component.
50 create: function(component, defaultType){
51 if (component instanceof Ext.AbstractComponent) {
54 else if (Ext.isString(component)) {
55 return Ext.createByAlias('widget.' + component);
58 var type = component.xtype || defaultType,
61 return Ext.createByAlias('widget.' + type, config);
65 registerType: function(type, cls) {
66 this.types[type] = cls;
67 cls[this.typeName] = type;
68 cls.prototype[this.typeName] = type;