+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- * @class Ext.ComponentMgr\r
- * <p>Provides a registry of all Components (instances of {@link Ext.Component} or any subclass\r
- * thereof) on a page so that they can be easily accessed by component id (see {@link #get}, or\r
- * the convenience method {@link Ext#getCmp Ext.getCmp}).</p>\r
- * <p>This object also provides a registry of available Component <i>classes</i>\r
- * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.\r
- * The <tt>xtype</tt> provides a way to avoid instantiating child Components\r
- * when creating a full, nested config object for a complete Ext page.</p>\r
- * <p>A child Component may be specified simply as a <i>config object</i>\r
- * as long as the correct xtype is specified so that if and when the Component\r
- * needs rendering, the correct type can be looked up for lazy instantiation.</p>\r
- * <p>For a list of all available xtypes, see {@link Ext.Component}.</p>\r
- * @singleton\r
- */\r
-Ext.ComponentMgr = function(){\r
- var all = new Ext.util.MixedCollection();\r
- var types = {};\r
-\r
- return {\r
- /**\r
- * Registers a component.\r
- * @param {Ext.Component} c The component\r
- */\r
- register : function(c){\r
- all.add(c);\r
- },\r
-\r
- /**\r
- * Unregisters a component.\r
- * @param {Ext.Component} c The component\r
- */\r
- unregister : function(c){\r
- all.remove(c);\r
- },\r
-\r
- /**\r
- * Returns a component by id\r
- * @param {String} id The component id\r
- * @return Ext.Component\r
- */\r
- get : function(id){\r
- return all.get(id);\r
- },\r
-\r
- /**\r
- * Registers a function that will be called when a specified component is added to ComponentMgr\r
- * @param {String} id The component id\r
- * @param {Function} fn The callback function\r
- * @param {Object} scope The scope of the callback\r
- */\r
- onAvailable : function(id, fn, scope){\r
- all.on("add", function(index, o){\r
- if(o.id == id){\r
- fn.call(scope || o, o);\r
- all.un("add", fn, scope);\r
- }\r
- });\r
- },\r
-\r
- /**\r
- * The MixedCollection used internally for the component cache. An example usage may be subscribing to\r
- * events on the MixedCollection to monitor addition or removal. Read-only.\r
- * @type {MixedCollection}\r
- */\r
- all : all,\r
-\r
- /**\r
- * <p>Registers a new Component constructor, keyed by a new\r
- * {@link Ext.Component#xtype}.</p>\r
- * <p>Use this method to register new subclasses of {@link Ext.Component} so\r
- * that lazy instantiation may be used when specifying child Components.\r
- * see {@link Ext.Container#items}</p>\r
- * @param {String} xtype The mnemonic string by which the Component class\r
- * may be looked up.\r
- * @param {Constructor} cls The new Component class.\r
- */\r
- registerType : function(xtype, cls){\r
- types[xtype] = cls;\r
- cls.xtype = xtype;\r
- },\r
-\r
- /**\r
- * Creates a new Component from the specified config object using the\r
- * config object's {@link Ext.component#xtype xtype} to determine the class to instantiate.\r
- * @param config {Object} A configuration object for the Component you wish to create.\r
- * @param defaultType {Constructor} The constructor to provide the default Component type if\r
- * the config object does not contain an xtype. (Optional if the config contains an xtype).\r
- * @return {Ext.Component} The newly instantiated Component.\r
- */\r
- create : function(config, defaultType){\r
- return new types[config.xtype || defaultType](config);\r
- }\r
- };\r
-}();\r
-\r
-/**\r
- * Shorthand for {@link Ext.ComponentMgr#registerType}\r
- * @param {String} xtype The mnemonic string by which the Component class\r
- * may be looked up.\r
- * @param {Constructor} cls The new Component class.\r
- * @member Ext\r
- * @method reg\r
- */\r
-Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally, shorthand to keep the bytes down
\ No newline at end of file