X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..f5240829880f87e0cf581c6a296e436fdef0ef80:/docs/source/Container.html diff --git a/docs/source/Container.html b/docs/source/Container.html index 46187df0..7c8e27cc 100644 --- a/docs/source/Container.html +++ b/docs/source/Container.html @@ -1,12 +1,18 @@ - - - - The source code - - - - -
/** + + + + The source code + + + + +
/*!
+ * Ext JS Library 3.3.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+
/** * @class Ext.Container * @extends Ext.BoxComponent *

Base class for any {@link Ext.BoxComponent} that may contain other Components. Containers handle the @@ -278,7 +284,6 @@ layoutConfig: { * the frequency it calculates and does a re-layout of components. This is useful for heavy containers or containers * with a large quantity of sub-components for which frequent layout calls would be expensive. Defaults to 50. */ - // Deprecated - will be removed in 3.2.x bufferResize: 50,

/** @@ -443,8 +448,6 @@ items: [ 'remove' ); - this.enableBubble(this.bubbleEvents); -
/** * The collection of components in this container as a {@link Ext.util.MixedCollection} * @type MixedCollection @@ -470,8 +473,8 @@ items: [ if(this.layout && this.layout != layout){ this.layout.setContainer(null); } - this.initItems(); this.layout = layout; + this.initItems(); layout.setContainer(this); }, @@ -492,7 +495,7 @@ items: [ this.setLayout(this.layout); // If a CardLayout, the active item set - if(this.activeItem !== undefined){ + if(this.activeItem !== undefined && this.layout.setActiveItem){ var item = this.activeItem; delete this.activeItem; this.layout.setActiveItem(item); @@ -552,12 +555,10 @@ tb.{@link #doLayout}(); // refresh the layout * may not be removed or added. See the Notes for {@link Ext.layout.BorderLayout BorderLayout} * for more details. * - * @param {Object/Array} component - *

Either a single component or an Array of components to add. See + * @param {...Object/Array} component + *

Either one or more Components to add or an Array of Components to add. See * {@link #items} for additional information.

- * @param {Object} (Optional) component_2 - * @param {Object} (Optional) component_n - * @return {Ext.Component} component The Component (or config object) that was added. + * @return {Ext.Component/Array} The Components that were added. */ add : function(comp){ this.initItems(); @@ -615,20 +616,26 @@ tb.{@link #doLayout}(); // refresh the layout * @return {Ext.Component} component The Component (or config object) that was * inserted with the Container's default config values applied. */ - insert : function(index, comp){ + insert : function(index, comp) { + var args = arguments, + length = args.length, + result = [], + i, c; + this.initItems(); - var a = arguments, len = a.length; - if(len > 2){ - var result = []; - for(var i = len-1; i >= 1; --i) { - result.push(this.insert(index, a[i])); + + if (length > 2) { + for (i = length - 1; i >= 1; --i) { + result.push(this.insert(index, args[i])); } return result; } - var c = this.lookupComponent(this.applyDefaults(comp)); + + c = this.lookupComponent(this.applyDefaults(comp)); index = Math.min(index, this.items.length); - if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){ - if(c.ownerCt == this){ + + if (this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false) { + if (c.ownerCt == this) { this.items.remove(c); } this.items.insert(index, c); @@ -636,6 +643,7 @@ tb.{@link #doLayout}(); // refresh the layout this.onAdd(c); this.fireEvent('add', this, c, index); } + return c; }, @@ -763,21 +771,24 @@ tb.{@link #doLayout}(); // refresh the layout // private createComponent : function(config, defaultType){ + if (config.render) { + return config; + } // add in ownerCt at creation time but then immediately // remove so that onBeforeAdd can handle it - var c = config.render ? config : Ext.create(Ext.apply({ + var c = Ext.create(Ext.apply({ ownerCt: this }, config), defaultType || this.defaultType); + delete c.initialConfig.ownerCt; delete c.ownerCt; return c; }, -
/** - * We can only lay out if there is a view area in which to layout. - * display:none on the layout target, *or any of its parent elements* will mean it has no view area. - */ - - // private + /** + * @private + * We can only lay out if there is a view area in which to layout. + * display:none on the layout target, *or any of its parent elements* will mean it has no view area. + */ canLayout : function() { var el = this.getVisibilityEl(); return el && el.dom && !el.isStyle("display", "none"); @@ -873,7 +884,7 @@ tb.{@link #doLayout}(); // refresh the layout */ getLayout : function(){ if(!this.layout){ - var layout = new Ext.layout.ContainerLayout(this.layoutConfig); + var layout = new Ext.layout.AutoLayout(this.layoutConfig); this.setLayout(layout); } return this.layout; @@ -894,27 +905,6 @@ tb.{@link #doLayout}(); // refresh the layout Ext.Container.superclass.beforeDestroy.call(this); }, -
/** - * Bubbles up the component/container heirarchy, calling the specified function with each component. The scope (this) of - * function call will be the scope provided or the current component. The arguments to the function - * will be the args provided or the current component. If the function returns false at any point, - * the bubble is stopped. - * @param {Function} fn The function to call - * @param {Object} scope (optional) The scope of the function (defaults to current node) - * @param {Array} args (optional) The args to call the function with (default to passing the current component) - * @return {Ext.Container} this - */ - bubble : function(fn, scope, args){ - var p = this; - while(p){ - if(fn.apply(scope || p, args || [p]) === false){ - break; - } - p = p.ownerCt; - } - return this; - }, -
/** * Cascades down the component/container heirarchy from this component (called first), calling the specified function with * each component. The scope (this) of @@ -945,17 +935,20 @@ tb.{@link #doLayout}(); // refresh the layout
/** * Find a component under this container at any level by id * @param {String} id + * @deprecated Fairly useless method, since you can just use Ext.getCmp. Should be removed for 4.0 + * If you need to test if an id belongs to a container, you can use getCmp and findParent*. * @return Ext.Component */ findById : function(id){ - var m, ct = this; + var m = null, + ct = this; this.cascade(function(c){ if(ct != c && c.id === id){ m = c; return false; } }); - return m || null; + return m; },
/** @@ -1003,15 +996,16 @@ tb.{@link #doLayout}(); // refresh the layout
/** * Get a component contained by this container (alias for items.get(key)) * @param {String/Number} key The index or id of the component + * @deprecated Should be removed in 4.0, since getComponent does the same thing. * @return {Ext.Component} Ext.Component */ get : function(key){ - return this.items.get(key); + return this.getComponent(key); } }); Ext.Container.LAYOUTS = {}; Ext.reg('container', Ext.Container); -
- +
+ \ No newline at end of file