tvheadend/vendor/ext-3.4.1/docs/source/ComponentMgr.html
Adam Sutton bafcfff42d webui: restructure webui/extjs source files
I want to keep the 3rd-party packages away from the main source
where possible.
2013-06-03 17:11:01 +01:00

209 lines
9.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-ComponentMgr'>/**
</span> * @class Ext.ComponentMgr
* &lt;p&gt;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 {@link Ext.Component component}
* {@link Ext.Component#id id} (see {@link #get}, or the convenience method {@link Ext#getCmp Ext.getCmp}).&lt;/p&gt;
* &lt;p&gt;This object also provides a registry of available Component &lt;i&gt;classes&lt;/i&gt;
* indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.
* The &lt;code&gt;{@link Ext.Component#xtype xtype}&lt;/code&gt; provides a way to avoid instantiating child Components
* when creating a full, nested config object for a complete Ext page.&lt;/p&gt;
* &lt;p&gt;A child Component may be specified simply as a &lt;i&gt;config object&lt;/i&gt;
* as long as the correct &lt;code&gt;{@link Ext.Component#xtype xtype}&lt;/code&gt; is specified so that if and when the Component
* needs rendering, the correct type can be looked up for lazy instantiation.&lt;/p&gt;
* &lt;p&gt;For a list of all available &lt;code&gt;{@link Ext.Component#xtype xtypes}&lt;/code&gt;, see {@link Ext.Component}.&lt;/p&gt;
* @singleton
*/
Ext.ComponentMgr = function(){
var all = new Ext.util.MixedCollection();
var types = {};
var ptypes = {};
return {
<span id='Ext-ComponentMgr-method-register'> /**
</span> * Registers a component.
* @param {Ext.Component} c The component
*/
register : function(c){
all.add(c);
},
<span id='Ext-ComponentMgr-method-unregister'> /**
</span> * Unregisters a component.
* @param {Ext.Component} c The component
*/
unregister : function(c){
all.remove(c);
},
<span id='Ext-ComponentMgr-method-get'> /**
</span> * Returns a component by {@link Ext.Component#id id}.
* For additional details see {@link Ext.util.MixedCollection#get}.
* @param {String} id The component {@link Ext.Component#id id}
* @return Ext.Component The Component, &lt;code&gt;undefined&lt;/code&gt; if not found, or &lt;code&gt;null&lt;/code&gt; if a
* Class was found.
*/
get : function(id){
return all.get(id);
},
<span id='Ext-ComponentMgr-method-onAvailable'> /**
</span> * Registers a function that will be called when a Component with the specified id is added to ComponentMgr. This will happen on instantiation.
* @param {String} id The component {@link Ext.Component#id id}
* @param {Function} fn The callback function
* @param {Object} scope The scope (&lt;code&gt;this&lt;/code&gt; reference) in which the callback is executed. Defaults to the Component.
*/
onAvailable : function(id, fn, scope){
all.on(&quot;add&quot;, function(index, o){
if(o.id == id){
fn.call(scope || o, o);
all.un(&quot;add&quot;, fn, scope);
}
});
},
<span id='Ext-ComponentMgr-property-all'> /**
</span> * 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,
<span id='Ext-ComponentMgr-property-types'> /**
</span> * The xtypes that have been registered with the component manager.
* @type {Object}
*/
types : types,
<span id='Ext-ComponentMgr-property-ptypes'> /**
</span> * The ptypes that have been registered with the component manager.
* @type {Object}
*/
ptypes: ptypes,
<span id='Ext-ComponentMgr-method-isRegistered'> /**
</span> * Checks if a Component type is registered.
* @param {Ext.Component} xtype The mnemonic string by which the Component class may be looked up
* @return {Boolean} Whether the type is registered.
*/
isRegistered : function(xtype){
return types[xtype] !== undefined;
},
<span id='Ext-ComponentMgr-method-isPluginRegistered'> /**
</span> * Checks if a Plugin type is registered.
* @param {Ext.Component} ptype The mnemonic string by which the Plugin class may be looked up
* @return {Boolean} Whether the type is registered.
*/
isPluginRegistered : function(ptype){
return ptypes[ptype] !== undefined;
},
<span id='Ext-ComponentMgr-method-registerType'> /**
</span> * &lt;p&gt;Registers a new Component constructor, keyed by a new
* {@link Ext.Component#xtype}.&lt;/p&gt;
* &lt;p&gt;Use this method (or its alias {@link Ext#reg Ext.reg}) to register new
* subclasses of {@link Ext.Component} so that lazy instantiation may be used when specifying
* child Components.
* see {@link Ext.Container#items}&lt;/p&gt;
* @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;
},
<span id='Ext-ComponentMgr-method-create'> /**
</span> * 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 {Object} config A configuration object for the Component you wish to create.
* @param {Constructor} defaultType The constructor to provide the default Component type if
* the config object does not contain a &lt;code&gt;xtype&lt;/code&gt;. (Optional if the config contains a &lt;code&gt;xtype&lt;/code&gt;).
* @return {Ext.Component} The newly instantiated Component.
*/
create : function(config, defaultType){
return config.render ? config : new types[config.xtype || defaultType](config);
},
<span id='Ext-ComponentMgr-method-registerPlugin'> /**
</span> * &lt;p&gt;Registers a new Plugin constructor, keyed by a new
* {@link Ext.Component#ptype}.&lt;/p&gt;
* &lt;p&gt;Use this method (or its alias {@link Ext#preg Ext.preg}) to register new
* plugins for {@link Ext.Component}s so that lazy instantiation may be used when specifying
* Plugins.&lt;/p&gt;
* @param {String} ptype The mnemonic string by which the Plugin class may be looked up.
* @param {Constructor} cls The new Plugin class.
*/
registerPlugin : function(ptype, cls){
ptypes[ptype] = cls;
cls.ptype = ptype;
},
<span id='Ext-ComponentMgr-method-createPlugin'> /**
</span> * Creates a new Plugin from the specified config object using the
* config object's {@link Ext.component#ptype ptype} to determine the class to instantiate.
* @param {Object} config A configuration object for the Plugin you wish to create.
* @param {Constructor} defaultType The constructor to provide the default Plugin type if
* the config object does not contain a &lt;code&gt;ptype&lt;/code&gt;. (Optional if the config contains a &lt;code&gt;ptype&lt;/code&gt;).
* @return {Ext.Component} The newly instantiated Plugin.
*/
createPlugin : function(config, defaultType){
var PluginCls = ptypes[config.ptype || defaultType];
if (PluginCls.init) {
return PluginCls;
} else {
return new PluginCls(config);
}
}
};
}();
<span id='Ext-method-reg'>/**
</span> * Shorthand for {@link Ext.ComponentMgr#registerType}
* @param {String} xtype The {@link Ext.component#xtype 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
<span id='Ext-method-preg'>/**
</span> * Shorthand for {@link Ext.ComponentMgr#registerPlugin}
* @param {String} ptype The {@link Ext.component#ptype mnemonic string} by which the Plugin class
* may be looked up.
* @param {Constructor} cls The new Plugin class.
* @member Ext
* @method preg
*/
Ext.preg = Ext.ComponentMgr.registerPlugin;
<span id='Ext-method-create'>/**
</span> * Shorthand for {@link Ext.ComponentMgr#create}
* 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 {Object} config A configuration object for the Component you wish to create.
* @param {Constructor} defaultType The constructor to provide the default Component type if
* the config object does not contain a &lt;code&gt;xtype&lt;/code&gt;. (Optional if the config contains a &lt;code&gt;xtype&lt;/code&gt;).
* @return {Ext.Component} The newly instantiated Component.
* @member Ext
* @method create
*/
Ext.create = Ext.ComponentMgr.create;</pre>
</body>
</html>