X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/source/widgets/ComponentMgr.js?ds=sidebyside diff --git a/source/widgets/ComponentMgr.js b/source/widgets/ComponentMgr.js deleted file mode 100644 index 44ce3241..00000000 --- a/source/widgets/ComponentMgr.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Ext JS Library 2.2.1 - * Copyright(c) 2006-2009, Ext JS, LLC. - * licensing@extjs.com - * - * http://extjs.com/license - */ - -/** - * @class Ext.ComponentMgr - *

Provides a registry of all Components (instances of {@link Ext.Component} or any subclass - * thereof) on a page so that they can be easily accessed by component id (see {@link #get}, or - * the convenience method {@link Ext#getCmp Ext.getCmp}).

- *

This object also provides a registry of available Component classes - * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}. - * The xtype provides a way to avoid instantiating child Components - * when creating a full, nested config object for a complete Ext page.

- *

A child Component may be specified simply as a config object - * as long as the correct xtype is specified so that if and when the Component - * needs rendering, the correct type can be looked up for lazy instantiation.

- *

For a list of all available xtypes, see {@link Ext.Component}.

- * @singleton - */ -Ext.ComponentMgr = function(){ - var all = new Ext.util.MixedCollection(); - var types = {}; - - return { - /** - * Registers a component. - * @param {Ext.Component} c The component - */ - register : function(c){ - all.add(c); - }, - - /** - * Unregisters a component. - * @param {Ext.Component} c The component - */ - unregister : function(c){ - all.remove(c); - }, - - /** - * Returns a component by id - * @param {String} id The component id - * @return Ext.Component - */ - get : function(id){ - return all.get(id); - }, - - /** - * Registers a function that will be called when a specified component is added to ComponentMgr - * @param {String} id The component id - * @param {Function} fn The callback function - * @param {Object} scope The scope of the callback - */ - onAvailable : function(id, fn, scope){ - all.on("add", function(index, o){ - if(o.id == id){ - fn.call(scope || o, o); - all.un("add", fn, scope); - } - }); - }, - - /** - * The MixedCollection used internally for the component cache. An example usage may be subscribing to - * events on the MixedCollection to monitor addition or removal. Read-only. - * @type {MixedCollection} - */ - all : all, - - /** - *

Registers a new Component constructor, keyed by a new - * {@link Ext.Component#xtype}.

- *

Use this method to register new subclasses of {@link Ext.Component} so - * that lazy instantiation may be used when specifying child Components. - * see {@link Ext.Container#items}

- * @param {String} xtype The mnemonic string by which the Component class - * may be looked up. - * @param {Constructor} cls The new Component class. - */ - registerType : function(xtype, cls){ - types[xtype] = cls; - cls.xtype = xtype; - }, - - /** - * Creates a new Component from the specified config object using the - * config object's {@link Ext.component#xtype xtype} to determine the class to instantiate. - * @param config {Object} A configuration object for the Component you wish to create. - * @param defaultType {Constructor} The constructor to provide the default Component type if - * the config object does not contain an xtype. (Optional if the config contains an xtype). - * @return {Ext.Component} The newly instantiated Component. - */ - create : function(config, defaultType){ - return new types[config.xtype || defaultType](config); - } - }; -}(); - -/** - * Shorthand for {@link Ext.ComponentMgr#registerType} - * @param {String} xtype The mnemonic string by which the Component class - * may be looked up. - * @param {Constructor} cls The new Component class. - * @member Ext - * @method reg - */ -Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally, shorthand to keep the bytes down \ No newline at end of file