X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/docs/source/ComponentMgr.html?ds=sidebyside diff --git a/docs/source/ComponentMgr.html b/docs/source/ComponentMgr.html index 55e38d32..ea9ede8a 100644 --- a/docs/source/ComponentMgr.html +++ b/docs/source/ComponentMgr.html @@ -1,5 +1,6 @@
+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 {@link Ext.Component#xtype xtype} provides a way to avoid instantiating child Components
+ * The {@link Ext.Component#xtype 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 {@link Ext.Component#xtype xtype} is specified so that if and when the Component
+ * as long as the correct {@link Ext.Component#xtype 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 {@link Ext.Component#xtype xtypes}, see {@link Ext.Component}.
+ *For a list of all available {@link Ext.Component#xtype xtypes}
, see {@link Ext.Component}.
undefined
if not found, or null
if a
* Class was found.
*/
get : function(id){
@@ -54,10 +55,10 @@ Ext.ComponentMgr = function(){
},
/**
- * Registers a function that will be called when a specified component is added to ComponentMgr
+ * 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 of the callback
+ * @param {Object} scope The scope (this
reference) in which the callback is executed. Defaults to the Component.
*/
onAvailable : function(id, fn, scope){
all.on("add", function(index, o){
@@ -104,7 +105,7 @@ Ext.ComponentMgr = function(){
* 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 xtype. (Optional if the config contains a xtype).
+ * the config object does not contain a xtype
. (Optional if the config contains a xtype
).
* @return {Ext.Component} The newly instantiated Component.
*/
create : function(config, defaultType){
@@ -130,11 +131,16 @@ Ext.ComponentMgr = function(){
* 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 ptype. (Optional if the config contains a ptype).
+ * the config object does not contain a ptype
. (Optional if the config contains a ptype
).
* @return {Ext.Component} The newly instantiated Plugin.
*/
createPlugin : function(config, defaultType){
- return new ptypes[config.ptype || defaultType](config);
+ var PluginCls = ptypes[config.ptype || defaultType];
+ if (PluginCls.init) {
+ return PluginCls;
+ } else {
+ return new PluginCls(config);
+ }
}
};
}();
@@ -157,7 +163,17 @@ Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally
* @method preg
*/
Ext.preg = Ext.ComponentMgr.registerPlugin;
-Ext.create = Ext.ComponentMgr.create;
-
+/**
+ * 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 xtype
. (Optional if the config contains a xtype
).
+ * @return {Ext.Component} The newly instantiated Component.
+ * @member Ext
+ * @method create
+ */
+Ext.create = Ext.ComponentMgr.create;
\ No newline at end of file