4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-container-AbstractContainer'>/**
19 </span> * @class Ext.container.AbstractContainer
20 * @extends Ext.Component
21 * <p>An abstract base class which provides shared methods for Containers across the Sencha product line.</p>
22 * Please refer to sub class's documentation
24 Ext.define('Ext.container.AbstractContainer', {
26 /* Begin Definitions */
28 extend: 'Ext.Component',
31 'Ext.util.MixedCollection',
32 'Ext.layout.container.Auto',
37 <span id='Ext-container-AbstractContainer-cfg-layout'> /**
38 </span> * @cfg {String/Object} layout
39 * <p><b>*Important</b>: In order for child items to be correctly sized and
40 * positioned, typically a layout manager <b>must</b> be specified through
41 * the <code>layout</code> configuration option.</p>
42 * <br><p>The sizing and positioning of child {@link #items} is the responsibility of
43 * the Container's layout manager which creates and manages the type of layout
44 * you have in mind. For example:</p>
45 * <p>If the {@link #layout} configuration is not explicitly specified for
46 * a general purpose container (e.g. Container or Panel) the
47 * {@link Ext.layout.container.Auto default layout manager} will be used
48 * which does nothing but render child components sequentially into the
49 * Container (no sizing or positioning will be performed in this situation).</p>
50 * <br><p><b><code>layout</code></b> may be specified as either as an Object or
51 * as a String:</p><div><ul class="mdetail-params">
53 * <li><u>Specify as an Object</u></li>
54 * <div><ul class="mdetail-params">
55 * <li>Example usage:</li>
56 * <pre><code>
61 </code></pre>
63 * <li><code><b>type</b></code></li>
64 * <br/><p>The layout type to be used for this container. If not specified,
65 * a default {@link Ext.layout.container.Auto} will be created and used.</p>
66 * <br/><p>Valid layout <code>type</code> values are:</p>
67 * <div class="sub-desc"><ul class="mdetail-params">
68 * <li><code><b>{@link Ext.layout.container.Auto Auto}</b></code> &nbsp;&nbsp;&nbsp; <b>Default</b></li>
69 * <li><code><b>{@link Ext.layout.container.Card card}</b></code></li>
70 * <li><code><b>{@link Ext.layout.container.Fit fit}</b></code></li>
71 * <li><code><b>{@link Ext.layout.container.HBox hbox}</b></code></li>
72 * <li><code><b>{@link Ext.layout.container.VBox vbox}</b></code></li>
73 * <li><code><b>{@link Ext.layout.container.Anchor anchor}</b></code></li>
74 * <li><code><b>{@link Ext.layout.container.Table table}</b></code></li>
75 * </ul></div>
77 * <li>Layout specific configuration properties</li>
78 * <br/><p>Additional layout specific configuration properties may also be
79 * specified. For complete details regarding the valid config options for
80 * each layout type, see the layout class corresponding to the <code>type</code>
81 * specified.</p>
83 * </ul></div>
85 * <li><u>Specify as a String</u></li>
86 * <div><ul class="mdetail-params">
87 * <li>Example usage:</li>
88 * <pre><code>
94 </code></pre>
95 * <li><code><b>layout</b></code></li>
96 * <br/><p>The layout <code>type</code> to be used for this container (see list
97 * of valid layout type values above).</p><br/>
98 * <br/><p>Additional layout specific configuration properties. For complete
99 * details regarding the valid config options for each layout type, see the
100 * layout class corresponding to the <code>layout</code> specified.</p>
101 * </ul></div></ul></div>
104 <span id='Ext-container-AbstractContainer-cfg-activeItem'> /**
105 </span> * @cfg {String/Number} activeItem
106 * A string component id or the numeric index of the component that should be initially activated within the
107 * container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first
108 * item in the container's collection). activeItem only applies to layout styles that can display
109 * items one at a time (like {@link Ext.layout.container.Card} and {@link Ext.layout.container.Fit}).
111 <span id='Ext-container-AbstractContainer-cfg-items'> /**
112 </span> * @cfg {Object/Array} items
113 * <p>A single item, or an array of child Components to be added to this container</p>
114 * <p><b>Unless configured with a {@link #layout}, a Container simply renders child Components serially into
115 * its encapsulating element and performs no sizing or positioning upon them.</b><p>
116 * <p>Example:</p>
117 * <pre><code>
118 // specifying a single item
120 layout: 'fit', // The single items is sized to fit
122 // specifying multiple items
123 items: [{...}, {...}],
124 layout: 'hbox', // The items are arranged horizontally
125 </code></pre>
126 * <p>Each item may be:</p>
128 * <li>A {@link Ext.Component Component}</li>
129 * <li>A Component configuration object</li>
131 * <p>If a configuration object is specified, the actual type of Component to be
132 * instantiated my be indicated by using the {@link Ext.Component#xtype xtype} option.</p>
133 * <p>Every Component class has its own {@link Ext.Component#xtype xtype}.</p>
134 * <p>If an {@link Ext.Component#xtype xtype} is not explicitly
135 * specified, the {@link #defaultType} for the Container is used, which by default is usually <code>panel</code>.</p>
136 * <p><b>Notes</b>:</p>
137 * <p>Ext uses lazy rendering. Child Components will only be rendered
138 * should it become necessary. Items are automatically laid out when they are first
139 * shown (no sizing is done while hidden), or in response to a {@link #doLayout} call.</p>
140 * <p>Do not specify <code>{@link Ext.panel.Panel#contentEl contentEl}</code> or
141 * <code>{@link Ext.panel.Panel#html html}</code> with <code>items</code>.</p>
143 <span id='Ext-container-AbstractContainer-cfg-defaults'> /**
144 </span> * @cfg {Object|Function} defaults
145 * <p>This option is a means of applying default settings to all added items whether added through the {@link #items}
146 * config or via the {@link #add} or {@link #insert} methods.</p>
147 * <p>If an added item is a config object, and <b>not</b> an instantiated Component, then the default properties are
148 * unconditionally applied. If the added item <b>is</b> an instantiated Component, then the default properties are
149 * applied conditionally so as not to override existing properties in the item.</p>
150 * <p>If the defaults option is specified as a function, then the function will be called using this Container as the
151 * scope (<code>this</code> reference) and passing the added item as the first parameter. Any resulting object
152 * from that call is then applied to the item as default properties.</p>
153 * <p>For example, to automatically apply padding to the body of each of a set of
154 * contained {@link Ext.panel.Panel} items, you could pass: <code>defaults: {bodyStyle:'padding:15px'}</code>.</p>
155 * <p>Usage:</p><pre><code>
156 defaults: { // defaults are applied to items, not the container
161 xtype: 'panel', // defaults <b>do not</b> have precedence over
162 id: 'panel1', // options in config objects, so the defaults
163 autoScroll: false // will not be applied here, panel1 will be autoScroll:false
165 new Ext.panel.Panel({ // defaults <b>do</b> have precedence over options
166 id: 'panel2', // options in components, so the defaults
167 autoScroll: false // will be applied here, panel2 will be autoScroll:true.
169 ]</code></pre>
172 <span id='Ext-container-AbstractContainer-cfg-suspendLayout'> /** @cfg {Boolean} suspendLayout
173 </span> * If true, suspend calls to doLayout. Useful when batching multiple adds to a container and not passing them
174 * as multiple arguments or an array.
176 suspendLayout : false,
178 <span id='Ext-container-AbstractContainer-cfg-autoDestroy'> /** @cfg {Boolean} autoDestroy
179 </span> * If true the container will automatically destroy any contained component that is removed from it, else
180 * destruction must be handled manually.
185 <span id='Ext-container-AbstractContainer-cfg-defaultType'> /** @cfg {String} defaultType
186 </span> * <p>The default {@link Ext.Component xtype} of child Components to create in this Container when
187 * a child item is specified as a raw configuration object, rather than as an instantiated Component.</p>
188 * <p>Defaults to <code>'panel'</code>.</p>
190 defaultType: 'panel',
194 baseCls: Ext.baseCSSPrefix + 'container',
196 <span id='Ext-container-AbstractContainer-cfg-bubbleEvents'> /**
197 </span> * @cfg {Array} bubbleEvents
198 * <p>An array of events that, when fired, should be bubbled to any parent container.
199 * See {@link Ext.util.Observable#enableBubble}.
200 * Defaults to <code>['add', 'remove']</code>.
202 bubbleEvents: ['add', 'remove'],
205 initComponent : function(){
208 <span id='Ext-container-AbstractContainer-event-afterlayout'> /**
209 </span> * @event afterlayout
210 * Fires when the components in this container are arranged by the associated layout manager.
211 * @param {Ext.container.Container} this
212 * @param {ContainerLayout} layout The ContainerLayout implementation for this container
215 <span id='Ext-container-AbstractContainer-event-beforeadd'> /**
216 </span> * @event beforeadd
217 * Fires before any {@link Ext.Component} is added or inserted into the container.
218 * A handler can return false to cancel the add.
219 * @param {Ext.container.Container} this
220 * @param {Ext.Component} component The component being added
221 * @param {Number} index The index at which the component will be added to the container's items collection
224 <span id='Ext-container-AbstractContainer-event-beforeremove'> /**
225 </span> * @event beforeremove
226 * Fires before any {@link Ext.Component} is removed from the container. A handler can return
227 * false to cancel the remove.
228 * @param {Ext.container.Container} this
229 * @param {Ext.Component} component The component being removed
232 <span id='Ext-container-AbstractContainer-event-add'> /**
235 * Fires after any {@link Ext.Component} is added or inserted into the container.
236 * @param {Ext.container.Container} this
237 * @param {Ext.Component} component The component that was added
238 * @param {Number} index The index at which the component was added to the container's items collection
241 <span id='Ext-container-AbstractContainer-event-remove'> /**
242 </span> * @event remove
244 * Fires after any {@link Ext.Component} is removed from the container.
245 * @param {Ext.container.Container} this
246 * @param {Ext.Component} component The component that was removed
249 <span id='Ext-container-AbstractContainer-event-beforecardswitch'> /**
250 </span> * @event beforecardswitch
251 * Fires before this container switches the active card. This event
252 * is only available if this container uses a CardLayout. Note that
253 * TabPanel and Carousel both get a CardLayout by default, so both
254 * will have this event.
255 * A handler can return false to cancel the card switch.
256 * @param {Ext.container.Container} this
257 * @param {Ext.Component} newCard The card that will be switched to
258 * @param {Ext.Component} oldCard The card that will be switched from
259 * @param {Number} index The index of the card that will be switched to
260 * @param {Boolean} animated True if this cardswitch will be animated
263 <span id='Ext-container-AbstractContainer-event-cardswitch'> /**
264 </span> * @event cardswitch
265 * Fires after this container switches the active card. If the card
266 * is switched using an animation, this event will fire after the
267 * animation has finished. This event is only available if this container
268 * uses a CardLayout. Note that TabPanel and Carousel both get a CardLayout
269 * by default, so both will have this event.
270 * @param {Ext.container.Container} this
271 * @param {Ext.Component} newCard The card that has been switched to
272 * @param {Ext.Component} oldCard The card that has been switched from
273 * @param {Number} index The index of the card that has been switched to
274 * @param {Boolean} animated True if this cardswitch was animated
279 // layoutOnShow stack
280 me.layoutOnShow = Ext.create('Ext.util.MixedCollection');
286 initItems : function() {
290 <span id='Ext-container-AbstractContainer-property-items'> /**
291 </span> * The MixedCollection containing all the child items of this container.
293 * @type Ext.util.MixedCollection
295 me.items = Ext.create('Ext.util.MixedCollection', false, me.getComponentId);
298 if (!Ext.isArray(items)) {
307 afterRender : function() {
313 setLayout : function(layout) {
314 var currentLayout = this.layout;
316 if (currentLayout && currentLayout.isLayout && currentLayout != layout) {
317 currentLayout.setOwner(null);
320 this.layout = layout;
321 layout.setOwner(this);
324 <span id='Ext-container-AbstractContainer-method-getLayout'> /**
325 </span> * Returns the {@link Ext.layout.container.AbstractContainer layout} instance currently associated with this Container.
326 * If a layout has not been instantiated yet, that is done first
327 * @return {Ext.layout.container.AbstractContainer} The layout
329 getLayout : function() {
331 if (!me.layout || !me.layout.isLayout) {
332 me.setLayout(Ext.layout.Layout.create(me.layout, 'autocontainer'));
338 <span id='Ext-container-AbstractContainer-method-doLayout'> /**
339 </span> * Manually force this container's layout to be recalculated. The framwork uses this internally to refresh layouts
341 * @return {Ext.container.Container} this
343 doLayout : function() {
345 layout = me.getLayout();
347 if (me.rendered && layout && !me.suspendLayout) {
348 // If either dimension is being auto-set, then it requires a ComponentLayout to be run.
349 if ((!Ext.isNumber(me.width) || !Ext.isNumber(me.height)) && me.componentLayout.type !== 'autocomponent') {
350 // Only run the ComponentLayout if it is not already in progress
351 if (me.componentLayout.layoutBusy !== true) {
352 me.doComponentLayout();
353 if (me.componentLayout.layoutCancelled === true) {
358 // Both dimensions defined, run a ContainerLayout
360 // Only run the ContainerLayout if it is not already in progress
361 if (layout.layoutBusy !== true) {
371 afterLayout : function(layout) {
372 this.fireEvent('afterlayout', this, layout);
376 prepareItems : function(items, applyDefaults) {
377 if (!Ext.isArray(items)) {
381 // Make sure defaults are applied and item is initialized
386 for (; i < len; i++) {
389 item = this.applyDefaults(item);
391 items[i] = this.lookupComponent(item);
397 applyDefaults : function(config) {
398 var defaults = this.defaults;
401 if (Ext.isFunction(defaults)) {
402 defaults = defaults.call(this, config);
405 if (Ext.isString(config)) {
406 config = Ext.ComponentManager.get(config);
407 Ext.applyIf(config, defaults);
408 } else if (!config.isComponent) {
409 Ext.applyIf(config, defaults);
411 Ext.applyIf(config, defaults);
419 lookupComponent : function(comp) {
420 return Ext.isString(comp) ? Ext.ComponentManager.get(comp) : this.createComponent(comp);
424 createComponent : function(config, defaultType) {
425 // // add in ownerCt at creation time but then immediately
426 // // remove so that onBeforeAdd can handle it
427 // var component = Ext.create(Ext.apply({ownerCt: this}, config), defaultType || this.defaultType);
429 // delete component.initialConfig.ownerCt;
430 // delete component.ownerCt;
432 return Ext.ComponentManager.create(config, defaultType || this.defaultType);
435 // @private - used as the key lookup function for the items collection
436 getComponentId : function(comp) {
437 return comp.getItemId();
440 <span id='Ext-container-AbstractContainer-method-add'> /**
442 Adds {@link Ext.Component Component}(s) to this Container.
446 - Fires the {@link #beforeadd} event before adding.
447 - The Container's {@link #defaults default config values} will be applied
448 accordingly (see `{@link #defaults}` for details).
449 - Fires the `{@link #add}` event after the component has been added.
453 If the Container is __already rendered__ when `add`
454 is called, it will render the newly added Component into its content area.
456 __**If**__ the Container was configured with a size-managing {@link #layout} manager, the Container
457 will recalculate its internal layout at this time too.
459 Note that the default layout manager simply renders child Components sequentially into the content area and thereafter performs no sizing.
461 If adding multiple new child Components, pass them as an array to the `add` method, so that only one layout recalculation is performed.
463 tb = new {@link Ext.toolbar.Toolbar}({
464 renderTo: document.body
465 }); // toolbar is rendered
466 tb.add([{text:'Button 1'}, {text:'Button 2'}]); // add multiple items. ({@link #defaultType} for {@link Ext.toolbar.Toolbar Toolbar} is 'button')
470 Components directly managed by the BorderLayout layout manager
471 may not be removed or added. See the Notes for {@link Ext.layout.container.Border BorderLayout}
474 * @param {...Object/Array} Component
475 * Either one or more Components to add or an Array of Components to add.
476 * See `{@link #items}` for additional information.
478 * @return {Ext.Component/Array} The Components that were added.
483 args = Array.prototype.slice.call(arguments),
493 if (typeof args[0] == 'number') {
494 index = args.shift();
497 hasMultipleArgs = args.length > 1;
498 if (hasMultipleArgs || Ext.isArray(args[0])) {
500 items = hasMultipleArgs ? args : args[0];
501 // Suspend Layouts while we add multiple items to the container
502 me.suspendLayout = true;
503 for (i = 0, ln = items.length; i < ln; i++) {
508 Ext.Error.raise("Trying to add a null item as a child of Container with itemId/id: " + me.getItemId());
513 item = me.add(index + i, item);
519 // Resume Layouts now that all items have been added and do a single layout for all the items just added
520 me.suspendLayout = false;
525 cmp = me.prepareItems(args[0], true)[0];
527 // Floating Components are not added into the items collection
528 // But they do get an upward ownerCt link so that they can traverse
529 // up to their z-index parent.
531 cmp.onAdded(me, index);
533 index = (index !== -1) ? index : me.items.length;
534 if (me.fireEvent('beforeadd', me, cmp, index) !== false && me.onBeforeAdd(cmp) !== false) {
535 me.items.insert(index, cmp);
536 cmp.onAdded(me, index);
537 me.onAdd(cmp, index);
538 me.fireEvent('add', me, cmp, index);
545 <span id='Ext-container-AbstractContainer-method-registerFloatingItem'> /**
547 * <p>Called by Component#doAutoRender</p>
548 * <p>Register a Container configured <code>floating: true</code> with this Container's {@link Ext.ZIndexManager ZIndexManager}.</p>
549 * <p>Components added in ths way will not participate in the layout, but will be rendered
550 * upon first show in the way that {@link Ext.window.Window Window}s are.</p>
551 * <p></p>
553 registerFloatingItem: function(cmp) {
555 if (!me.floatingItems) {
556 me.floatingItems = Ext.create('Ext.ZIndexManager', me);
558 me.floatingItems.register(cmp);
562 onRemove : Ext.emptyFn,
564 <span id='Ext-container-AbstractContainer-method-insert'> /**
565 </span> * Inserts a Component into this Container at a specified index. Fires the
566 * {@link #beforeadd} event before inserting, then fires the {@link #add} event after the
567 * Component has been inserted.
568 * @param {Number} index The index at which the Component will be inserted
569 * into the Container's items collection
570 * @param {Ext.Component} component The child Component to insert.<br><br>
571 * Ext uses lazy rendering, and will only render the inserted Component should
572 * it become necessary.<br><br>
573 * A Component config object may be passed in order to avoid the overhead of
574 * constructing a real Component object if lazy rendering might mean that the
575 * inserted Component will not be rendered immediately. To take advantage of
576 * this 'lazy instantiation', set the {@link Ext.Component#xtype} config
577 * property to the registered type of the Component wanted.<br><br>
578 * For a list of all available xtypes, see {@link Ext.Component}.
579 * @return {Ext.Component} component The Component (or config object) that was
580 * inserted with the Container's default config values applied.
582 insert : function(index, comp) {
583 return this.add(index, comp);
586 <span id='Ext-container-AbstractContainer-method-move'> /**
587 </span> * Moves a Component within the Container
588 * @param {Number} fromIdx The index the Component you wish to move is currently at.
589 * @param {Number} toIdx The new index for the Component.
590 * @return {Ext.Component} component The Component (or config object) that was moved.
592 move : function(fromIdx, toIdx) {
593 var items = this.items,
595 item = items.removeAt(fromIdx);
596 if (item === false) {
599 items.insert(toIdx, item);
605 onBeforeAdd : function(item) {
609 item.ownerCt.remove(item, false);
612 if (me.border === false || me.border === 0) {
613 item.border = (item.border === true);
617 <span id='Ext-container-AbstractContainer-method-remove'> /**
618 </span> * Removes a component from this container. Fires the {@link #beforeremove} event before removing, then fires
619 * the {@link #remove} event after the component has been removed.
620 * @param {Component/String} component The component reference or id to remove.
621 * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
622 * Defaults to the value of this Container's {@link #autoDestroy} config.
623 * @return {Ext.Component} component The Component that was removed.
625 remove : function(comp, autoDestroy) {
627 c = me.getComponent(comp);
629 if (Ext.isDefined(Ext.global.console) && !c) {
630 console.warn("Attempted to remove a component that does not exist. Ext.container.Container: remove takes an argument of the component to remove. cmp.remove() is incorrect usage.");
634 if (c && me.fireEvent('beforeremove', me, c) !== false) {
635 me.doRemove(c, autoDestroy);
636 me.fireEvent('remove', me, c);
643 doRemove : function(component, autoDestroy) {
646 hasLayout = layout && me.rendered;
648 me.items.remove(component);
649 component.onRemoved();
652 layout.onRemove(component);
655 me.onRemove(component, autoDestroy);
657 if (autoDestroy === true || (autoDestroy !== false && me.autoDestroy)) {
661 if (hasLayout && !autoDestroy) {
662 layout.afterRemove(component);
665 if (!me.destroying) {
670 <span id='Ext-container-AbstractContainer-method-removeAll'> /**
671 </span> * Removes all components from this container.
672 * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
673 * Defaults to the value of this Container's {@link #autoDestroy} config.
674 * @return {Array} Array of the destroyed components
676 removeAll : function(autoDestroy) {
678 removeItems = me.items.items.slice(),
681 len = removeItems.length,
684 // Suspend Layouts while we remove multiple items from the container
685 me.suspendLayout = true;
686 for (; i < len; i++) {
687 item = removeItems[i];
688 me.remove(item, autoDestroy);
690 if (item.ownerCt !== me) {
695 // Resume Layouts now that all items have been removed and do a single layout
696 me.suspendLayout = false;
701 // Used by ComponentQuery to retrieve all of the items
702 // which can potentially be considered a child of this Container.
703 // This should be overriden by components which have child items
704 // that are not contained in items. For example dockedItems, menu, etc
705 // IMPORTANT note for maintainers:
706 // Items are returned in tree traversal order. Each item is appended to the result array
707 // followed by the results of that child's getRefItems call.
708 // Floating child items are appended after internal child items.
709 getRefItems : function(deep) {
711 items = me.items.items,
717 for (; i < len; i++) {
720 if (deep && item.getRefItems) {
721 result.push.apply(result, item.getRefItems(true));
725 // Append floating items to the list.
726 // These will only be present after they are rendered.
727 if (me.floatingItems && me.floatingItems.accessList) {
728 result.push.apply(result, me.floatingItems.accessList);
734 <span id='Ext-container-AbstractContainer-method-cascade'> /**
735 </span> * Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified function with
736 * each component. The scope (<code>this</code> reference) of the
737 * function call will be the scope provided or the current component. The arguments to the function
738 * will be the args provided or the current component. If the function returns false at any point,
739 * the cascade is stopped on that branch.
740 * @param {Function} fn The function to call
741 * @param {Object} scope (optional) The scope of the function (defaults to current component)
742 * @param {Array} args (optional) The args to call the function with. The current component always passed as the last argument.
743 * @return {Ext.Container} this
745 cascade : function(fn, scope, origArgs){
747 cs = me.items ? me.items.items : [],
751 args = origArgs ? origArgs.concat(me) : [me],
752 componentIndex = args.length - 1;
754 if (fn.apply(scope || me, args) !== false) {
755 for(; i < len; i++){
758 c.cascade(fn, scope, origArgs);
760 args[componentIndex] = c;
761 fn.apply(scope || cs, args);
768 <span id='Ext-container-AbstractContainer-method-getComponent'> /**
769 </span> * Examines this container's <code>{@link #items}</code> <b>property</b>
770 * and gets a direct child component of this container.
771 * @param {String/Number} comp This parameter may be any of the following:
772 * <div><ul class="mdetail-params">
773 * <li>a <b><code>String</code></b> : representing the <code>{@link Ext.Component#itemId itemId}</code>
774 * or <code>{@link Ext.Component#id id}</code> of the child component </li>
775 * <li>a <b><code>Number</code></b> : representing the position of the child component
776 * within the <code>{@link #items}</code> <b>property</b></li>
777 * </ul></div>
778 * <p>For additional information see {@link Ext.util.MixedCollection#get}.
779 * @return Ext.Component The component (if found).
781 getComponent : function(comp) {
782 if (Ext.isObject(comp)) {
783 comp = comp.getItemId();
786 return this.items.get(comp);
789 <span id='Ext-container-AbstractContainer-method-query'> /**
790 </span> * Retrieves all descendant components which match the passed selector.
791 * Executes an Ext.ComponentQuery.query using this container as its root.
792 * @param {String} selector Selector complying to an Ext.ComponentQuery selector
793 * @return {Array} Ext.Component's which matched the selector
795 query : function(selector) {
796 return Ext.ComponentQuery.query(selector, this);
799 <span id='Ext-container-AbstractContainer-method-child'> /**
800 </span> * Retrieves the first direct child of this container which matches the passed selector.
801 * The passed in selector must comply with an Ext.ComponentQuery selector.
802 * @param {String} selector An Ext.ComponentQuery selector
803 * @return Ext.Component
805 child : function(selector) {
806 return this.query('> ' + selector)[0] || null;
809 <span id='Ext-container-AbstractContainer-method-down'> /**
810 </span> * Retrieves the first descendant of this container which matches the passed selector.
811 * The passed in selector must comply with an Ext.ComponentQuery selector.
812 * @param {String} selector An Ext.ComponentQuery selector
813 * @return Ext.Component
815 down : function(selector) {
816 return this.query(selector)[0] || null;
821 this.callParent(arguments);
822 this.performDeferredLayouts();
826 // Lay out any descendant containers who queued a layout operation during the time this was hidden
827 // This is also called by Panel after it expands because descendants of a collapsed Panel allso queue any layout ops.
828 performDeferredLayouts: function() {
829 var layoutCollection = this.layoutOnShow,
830 ln = layoutCollection.getCount(),
835 for (; i < ln; i++) {
836 item = layoutCollection.get(i);
837 needsLayout = item.needsLayout;
839 if (Ext.isObject(needsLayout)) {
840 item.doComponentLayout(needsLayout.width, needsLayout.height, needsLayout.isSetSize, needsLayout.ownerCt);
843 layoutCollection.clear();
847 // Enable all immediate children that was previously disabled
848 onEnable: function() {
849 Ext.Array.each(this.query('[isFormField]'), function(item) {
850 if (item.resetDisable) {
852 delete item.resetDisable;
859 // Disable all immediate children that was previously disabled
860 onDisable: function() {
861 Ext.Array.each(this.query('[isFormField]'), function(item) {
862 if (item.resetDisable !== false && !item.disabled) {
864 item.resetDisable = true;
870 <span id='Ext-container-AbstractContainer-method-beforeLayout'> /**
871 </span> * Occurs before componentLayout is run. Returning false from this method will prevent the containerLayout
872 * from being executed.
874 beforeLayout: function() {
879 beforeDestroy : function() {
885 while ((c = items.first())) {
886 me.doRemove(c, true);