Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
9.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.ComponentMgr"></div>/**
  16. * @class Ext.ComponentMgr
  17. * <p>Provides a registry of all Components (instances of {@link Ext.Component} or any subclass
  18. * thereof) on a page so that they can be easily accessed by {@link Ext.Component component}
  19. * {@link Ext.Component#id id} (see {@link #get}, or the convenience method {@link Ext#getCmp Ext.getCmp}).</p>
  20. * <p>This object also provides a registry of available Component <i>classes</i>
  21. * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.
  22. * The <code>{@link Ext.Component#xtype xtype}</code> provides a way to avoid instantiating child Components
  23. * when creating a full, nested config object for a complete Ext page.</p>
  24. * <p>A child Component may be specified simply as a <i>config object</i>
  25. * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
  26. * needs rendering, the correct type can be looked up for lazy instantiation.</p>
  27. * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
  28. * @singleton
  29. */
  30. Ext.ComponentMgr = function(){
  31. var all = new Ext.util.MixedCollection();
  32. var types = {};
  33. var ptypes = {};
  34. return {
  35. <div id="method-Ext.ComponentMgr-register"></div>/**
  36. * Registers a component.
  37. * @param {Ext.Component} c The component
  38. */
  39. register : function(c){
  40. all.add(c);
  41. },
  42. <div id="method-Ext.ComponentMgr-unregister"></div>/**
  43. * Unregisters a component.
  44. * @param {Ext.Component} c The component
  45. */
  46. unregister : function(c){
  47. all.remove(c);
  48. },
  49. <div id="method-Ext.ComponentMgr-get"></div>/**
  50. * Returns a component by {@link Ext.Component#id id}.
  51. * For additional details see {@link Ext.util.MixedCollection#get}.
  52. * @param {String} id The component {@link Ext.Component#id id}
  53. * @return Ext.Component The Component, <code>undefined</code> if not found, or <code>null</code> if a
  54. * Class was found.
  55. */
  56. get : function(id){
  57. return all.get(id);
  58. },
  59. <div id="method-Ext.ComponentMgr-onAvailable"></div>/**
  60. * Registers a function that will be called when a Component with the specified id is added to ComponentMgr. This will happen on instantiation.
  61. * @param {String} id The component {@link Ext.Component#id id}
  62. * @param {Function} fn The callback function
  63. * @param {Object} scope The scope (<code>this</code> reference) in which the callback is executed. Defaults to the Component.
  64. */
  65. onAvailable : function(id, fn, scope){
  66. all.on("add", function(index, o){
  67. if(o.id == id){
  68. fn.call(scope || o, o);
  69. all.un("add", fn, scope);
  70. }
  71. });
  72. },
  73. <div id="prop-Ext.ComponentMgr-all"></div>/**
  74. * The MixedCollection used internally for the component cache. An example usage may be subscribing to
  75. * events on the MixedCollection to monitor addition or removal. Read-only.
  76. * @type {MixedCollection}
  77. */
  78. all : all,
  79. <div id="prop-Ext.ComponentMgr-types"></div>/**
  80. * The xtypes that have been registered with the component manager.
  81. * @type {Object}
  82. */
  83. types : types,
  84. <div id="prop-Ext.ComponentMgr-ptypes"></div>/**
  85. * The ptypes that have been registered with the component manager.
  86. * @type {Object}
  87. */
  88. ptypes: ptypes,
  89. <div id="method-Ext.ComponentMgr-isRegistered"></div>/**
  90. * Checks if a Component type is registered.
  91. * @param {Ext.Component} xtype The mnemonic string by which the Component class may be looked up
  92. * @return {Boolean} Whether the type is registered.
  93. */
  94. isRegistered : function(xtype){
  95. return types[xtype] !== undefined;
  96. },
  97. <div id="method-Ext.ComponentMgr-isPluginRegistered"></div>/**
  98. * Checks if a Plugin type is registered.
  99. * @param {Ext.Component} ptype The mnemonic string by which the Plugin class may be looked up
  100. * @return {Boolean} Whether the type is registered.
  101. */
  102. isPluginRegistered : function(ptype){
  103. return ptypes[ptype] !== undefined;
  104. },
  105. <div id="method-Ext.ComponentMgr-registerType"></div>/**
  106. * <p>Registers a new Component constructor, keyed by a new
  107. * {@link Ext.Component#xtype}.</p>
  108. * <p>Use this method (or its alias {@link Ext#reg Ext.reg}) to register new
  109. * subclasses of {@link Ext.Component} so that lazy instantiation may be used when specifying
  110. * child Components.
  111. * see {@link Ext.Container#items}</p>
  112. * @param {String} xtype The mnemonic string by which the Component class may be looked up.
  113. * @param {Constructor} cls The new Component class.
  114. */
  115. registerType : function(xtype, cls){
  116. types[xtype] = cls;
  117. cls.xtype = xtype;
  118. },
  119. <div id="method-Ext.ComponentMgr-create"></div>/**
  120. * Creates a new Component from the specified config object using the
  121. * config object's {@link Ext.component#xtype xtype} to determine the class to instantiate.
  122. * @param {Object} config A configuration object for the Component you wish to create.
  123. * @param {Constructor} defaultType The constructor to provide the default Component type if
  124. * the config object does not contain a <code>xtype</code>. (Optional if the config contains a <code>xtype</code>).
  125. * @return {Ext.Component} The newly instantiated Component.
  126. */
  127. create : function(config, defaultType){
  128. return config.render ? config : new types[config.xtype || defaultType](config);
  129. },
  130. <div id="method-Ext.ComponentMgr-registerPlugin"></div>/**
  131. * <p>Registers a new Plugin constructor, keyed by a new
  132. * {@link Ext.Component#ptype}.</p>
  133. * <p>Use this method (or its alias {@link Ext#preg Ext.preg}) to register new
  134. * plugins for {@link Ext.Component}s so that lazy instantiation may be used when specifying
  135. * Plugins.</p>
  136. * @param {String} ptype The mnemonic string by which the Plugin class may be looked up.
  137. * @param {Constructor} cls The new Plugin class.
  138. */
  139. registerPlugin : function(ptype, cls){
  140. ptypes[ptype] = cls;
  141. cls.ptype = ptype;
  142. },
  143. <div id="method-Ext.ComponentMgr-createPlugin"></div>/**
  144. * Creates a new Plugin from the specified config object using the
  145. * config object's {@link Ext.component#ptype ptype} to determine the class to instantiate.
  146. * @param {Object} config A configuration object for the Plugin you wish to create.
  147. * @param {Constructor} defaultType The constructor to provide the default Plugin type if
  148. * the config object does not contain a <code>ptype</code>. (Optional if the config contains a <code>ptype</code>).
  149. * @return {Ext.Component} The newly instantiated Plugin.
  150. */
  151. createPlugin : function(config, defaultType){
  152. var PluginCls = ptypes[config.ptype || defaultType];
  153. if (PluginCls.init) {
  154. return PluginCls;
  155. } else {
  156. return new PluginCls(config);
  157. }
  158. }
  159. };
  160. }();
  161. <div id="method-Ext-reg"></div>/**
  162. * Shorthand for {@link Ext.ComponentMgr#registerType}
  163. * @param {String} xtype The {@link Ext.component#xtype mnemonic string} by which the Component class
  164. * may be looked up.
  165. * @param {Constructor} cls The new Component class.
  166. * @member Ext
  167. * @method reg
  168. */
  169. Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally, shorthand to keep the bytes down
  170. <div id="method-Ext-preg"></div>/**
  171. * Shorthand for {@link Ext.ComponentMgr#registerPlugin}
  172. * @param {String} ptype The {@link Ext.component#ptype mnemonic string} by which the Plugin class
  173. * may be looked up.
  174. * @param {Constructor} cls The new Plugin class.
  175. * @member Ext
  176. * @method preg
  177. */
  178. Ext.preg = Ext.ComponentMgr.registerPlugin;
  179. <div id="method-Ext-create"></div>/**
  180. * Shorthand for {@link Ext.ComponentMgr#create}
  181. * Creates a new Component from the specified config object using the
  182. * config object's {@link Ext.component#xtype xtype} to determine the class to instantiate.
  183. * @param {Object} config A configuration object for the Component you wish to create.
  184. * @param {Constructor} defaultType The constructor to provide the default Component type if
  185. * the config object does not contain a <code>xtype</code>. (Optional if the config contains a <code>xtype</code>).
  186. * @return {Ext.Component} The newly instantiated Component.
  187. * @member Ext
  188. * @method create
  189. */
  190. Ext.create = Ext.ComponentMgr.create;</pre>
  191. </body>
  192. </html>