-<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-AbstractManager'>/**
-</span> * @class Ext.AbstractManager
- * @extends Object
- * @ignore
- * Base Manager class
+<!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-AbstractManager'>/**
+</span> * Base Manager class
*/
-
Ext.define('Ext.AbstractManager', {
/* Begin Definitions */
Ext.apply(this, config || {});
<span id='Ext-AbstractManager-property-all'> /**
-</span> * Contains all of the items currently managed
- * @property all
- * @type Ext.util.MixedCollection
+</span> * @property {Ext.util.HashMap} all
+ * Contains all of the items currently managed
*/
this.all = Ext.create('Ext.util.HashMap');
</span> * Returns an item by id.
* For additional details see {@link Ext.util.HashMap#get}.
* @param {String} id The id of the item
- * @return {Mixed} The item, <code>undefined</code> if not found.
+ * @return {Object} The item, undefined if not found.
*/
get : function(id) {
return this.all.get(id);
<span id='Ext-AbstractManager-method-register'> /**
</span> * Registers an item to be managed
- * @param {Mixed} item The item to register
+ * @param {Object} item The item to register
*/
register: function(item) {
+ //<debug>
+ var all = this.all,
+ key = all.getKey(item);
+
+ if (all.containsKey(key)) {
+ Ext.Error.raise('Registering duplicate id "' + key + '" with this manager');
+ }
+ //</debug>
this.all.add(item);
},
<span id='Ext-AbstractManager-method-unregister'> /**
</span> * Unregisters an item by removing it from this manager
- * @param {Mixed} item The item to unregister
+ * @param {Object} item The item to unregister
*/
unregister: function(item) {
this.all.remove(item);
},
<span id='Ext-AbstractManager-method-registerType'> /**
-</span> * <p>Registers a new item constructor, keyed by a type key.
+</span> * Registers a new item constructor, keyed by a type key.
* @param {String} type The mnemonic string by which the class may be looked up.
- * @param {Constructor} cls The new instance class.
+ * @param {Function} cls The new instance class.
*/
registerType : function(type, cls) {
this.types[type] = cls;
},
<span id='Ext-AbstractManager-method-create'> /**
-</span> * Creates and returns an instance of whatever this manager manages, based on the supplied type and config object
+</span> * Creates and returns an instance of whatever this manager manages, based on the supplied type and
+ * config object.
* @param {Object} config The config object
* @param {String} defaultType If no type is discovered in the config object, we fall back to this type
- * @return {Mixed} The instance of whatever this manager is managing
+ * @return {Object} The instance of whatever this manager is managing
*/
create: function(config, defaultType) {
var type = config[this.typeName] || config.type || defaultType,
Constructor = this.types[type];
//<debug>
- if (Constructor == undefined) {
+ if (Constructor === undefined) {
Ext.Error.raise("The '" + type + "' type has not been registered with this manager");
}
//</debug>
},
<span id='Ext-AbstractManager-method-onAvailable'> /**
-</span> * Registers a function that will be called when an item with the specified id is added to the manager. This will happen on instantiation.
+</span> * Registers a function that will be called when an item with the specified id is added to the manager.
+ * This will happen on instantiation.
* @param {String} id The item id
* @param {Function} fn The callback function. Called with a single parameter, the item.
- * @param {Object} scope The scope (<code>this</code> reference) in which the callback is executed. Defaults to the item.
+ * @param {Object} scope The scope (this reference) in which the callback is executed.
+ * Defaults to the item.
*/
onAvailable : function(id, fn, scope){
var all = this.all,
<span id='Ext-AbstractManager-method-each'> /**
</span> * Executes the specified function once for each item in the collection.
- * Returning false from the function will cease iteration.
- *
- * The paramaters passed to the function are:
- * <div class="mdetail-params"><ul>
- * <li><b>key</b> : String<p class="sub-desc">The key of the item</p></li>
- * <li><b>value</b> : Number<p class="sub-desc">The value of the item</p></li>
- * <li><b>length</b> : Number<p class="sub-desc">The total number of items in the collection</p></li>
- * </ul></div>
- * @param {Object} fn The function to execute.
- * @param {Object} scope The scope to execute in. Defaults to <tt>this</tt>.
+ * @param {Function} fn The function to execute.
+ * @param {String} fn.key The key of the item
+ * @param {Number} fn.value The value of the item
+ * @param {Number} fn.length The total number of items in the collection
+ * @param {Boolean} fn.return False to cease iteration.
+ * @param {Object} scope The scope to execute in. Defaults to `this`.
*/
each: function(fn, scope){
this.all.each(fn, scope || this);
return this.all.getCount();
}
});
-</pre></pre></body></html>
\ No newline at end of file
+</pre>
+</body>
+</html>