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.

121 lines
4.6 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.AbstractManager"></div>/**
  16. * @class Ext.AbstractManager
  17. * @extends Object
  18. * Base Manager class - extended by ComponentMgr and PluginMgr
  19. */
  20. Ext.AbstractManager = Ext.extend(Object, {
  21. typeName: 'type',
  22. constructor: function(config) {
  23. Ext.apply(this, config || {});
  24. <div id="prop-Ext.AbstractManager-all"></div>/**
  25. * Contains all of the items currently managed
  26. * @property all
  27. * @type Ext.util.MixedCollection
  28. */
  29. this.all = new Ext.util.MixedCollection();
  30. this.types = {};
  31. },
  32. <div id="method-Ext.AbstractManager-get"></div>/**
  33. * Returns a component by {@link Ext.Component#id id}.
  34. * For additional details see {@link Ext.util.MixedCollection#get}.
  35. * @param {String} id The component {@link Ext.Component#id id}
  36. * @return Ext.Component The Component, <code>undefined</code> if not found, or <code>null</code> if a
  37. * Class was found.
  38. */
  39. get : function(id){
  40. return this.all.get(id);
  41. },
  42. <div id="method-Ext.AbstractManager-register"></div>/**
  43. * Registers an item to be managed
  44. * @param {Mixed} item The item to register
  45. */
  46. register: function(item) {
  47. this.all.add(item);
  48. },
  49. <div id="method-Ext.AbstractManager-unregister"></div>/**
  50. * Unregisters a component by removing it from this manager
  51. * @param {Mixed} item The item to unregister
  52. */
  53. unregister: function(item) {
  54. this.all.remove(item);
  55. },
  56. <div id="method-Ext.AbstractManager-registerType"></div>/**
  57. * <p>Registers a new Component constructor, keyed by a new
  58. * {@link Ext.Component#xtype}.</p>
  59. * <p>Use this method (or its alias {@link Ext#reg Ext.reg}) to register new
  60. * subclasses of {@link Ext.Component} so that lazy instantiation may be used when specifying
  61. * child Components.
  62. * see {@link Ext.Container#items}</p>
  63. * @param {String} xtype The mnemonic string by which the Component class may be looked up.
  64. * @param {Constructor} cls The new Component class.
  65. */
  66. registerType : function(type, cls){
  67. this.types[type] = cls;
  68. cls[this.typeName] = type;
  69. },
  70. <div id="method-Ext.AbstractManager-isRegistered"></div>/**
  71. * Checks if a Component type is registered.
  72. * @param {Ext.Component} xtype The mnemonic string by which the Component class may be looked up
  73. * @return {Boolean} Whether the type is registered.
  74. */
  75. isRegistered : function(type){
  76. return this.types[type] !== undefined;
  77. },
  78. <div id="method-Ext.AbstractManager-create"></div>/**
  79. * Creates and returns an instance of whatever this manager manages, based on the supplied type and config object
  80. * @param {Object} config The config object
  81. * @param {String} defaultType If no type is discovered in the config object, we fall back to this type
  82. * @return {Mixed} The instance of whatever this manager is managing
  83. */
  84. create: function(config, defaultType) {
  85. var type = config[this.typeName] || config.type || defaultType,
  86. Constructor = this.types[type];
  87. if (Constructor == undefined) {
  88. throw new Error(String.format("The '{0}' type has not been registered with this manager", type));
  89. }
  90. return new Constructor(config);
  91. },
  92. <div id="method-Ext.AbstractManager-onAvailable"></div>/**
  93. * Registers a function that will be called when a Component with the specified id is added to the manager. This will happen on instantiation.
  94. * @param {String} id The component {@link Ext.Component#id id}
  95. * @param {Function} fn The callback function
  96. * @param {Object} scope The scope (<code>this</code> reference) in which the callback is executed. Defaults to the Component.
  97. */
  98. onAvailable : function(id, fn, scope){
  99. var all = this.all;
  100. all.on("add", function(index, o){
  101. if (o.id == id) {
  102. fn.call(scope || o, o);
  103. all.un("add", fn, scope);
  104. }
  105. });
  106. }
  107. });</pre>
  108. </body>
  109. </html>