1 <!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-container.AbstractContainer'>/**
2 </span> * @class Ext.container.AbstractContainer
3 * @extends Ext.Component
4 * <p>An abstract base class which provides shared methods for Containers across the Sencha product line.</p>
5 * Please refer to sub class's documentation
7 Ext.define('Ext.container.AbstractContainer', {
9 /* Begin Definitions */
11 extend: 'Ext.Component',
14 'Ext.util.MixedCollection',
15 'Ext.layout.container.Auto',
20 <span id='Ext-container.AbstractContainer-cfg-layout'> /**
21 </span> * @cfg {String/Object} layout
22 * <p><b>*Important</b>: In order for child items to be correctly sized and
23 * positioned, typically a layout manager <b>must</b> be specified through
24 * the <code>layout</code> configuration option.</p>
25 * <br><p>The sizing and positioning of child {@link #items} is the responsibility of
26 * the Container's layout manager which creates and manages the type of layout
27 * you have in mind. For example:</p>
28 * <p>If the {@link #layout} configuration is not explicitly specified for
29 * a general purpose container (e.g. Container or Panel) the
30 * {@link Ext.layout.container.Auto default layout manager} will be used
31 * which does nothing but render child components sequentially into the
32 * Container (no sizing or positioning will be performed in this situation).</p>
33 * <br><p><b><code>layout</code></b> may be specified as either as an Object or
34 * as a String:</p><div><ul class="mdetail-params">
36 * <li><u>Specify as an Object</u></li>
37 * <div><ul class="mdetail-params">
38 * <li>Example usage:</li>
39 * <pre><code>
44 </code></pre>
46 * <li><code><b>type</b></code></li>
47 * <br/><p>The layout type to be used for this container. If not specified,
48 * a default {@link Ext.layout.container.Auto} will be created and used.</p>
49 * <br/><p>Valid layout <code>type</code> values are:</p>
50 * <div class="sub-desc"><ul class="mdetail-params">
51 * <li><code><b>{@link Ext.layout.container.Auto Auto}</b></code> &nbsp;&nbsp;&nbsp; <b>Default</b></li>
52 * <li><code><b>{@link Ext.layout.container.Card card}</b></code></li>
53 * <li><code><b>{@link Ext.layout.container.Fit fit}</b></code></li>
54 * <li><code><b>{@link Ext.layout.container.HBox hbox}</b></code></li>
55 * <li><code><b>{@link Ext.layout.container.VBox vbox}</b></code></li>
56 * <li><code><b>{@link Ext.layout.container.Anchor anchor}</b></code></li>
57 * <li><code><b>{@link Ext.layout.container.Table table}</b></code></li>
58 * </ul></div>
60 * <li>Layout specific configuration properties</li>
61 * <br/><p>Additional layout specific configuration properties may also be
62 * specified. For complete details regarding the valid config options for
63 * each layout type, see the layout class corresponding to the <code>type</code>
64 * specified.</p>
66 * </ul></div>
68 * <li><u>Specify as a String</u></li>
69 * <div><ul class="mdetail-params">
70 * <li>Example usage:</li>
71 * <pre><code>
77 </code></pre>
78 * <li><code><b>layout</b></code></li>
79 * <br/><p>The layout <code>type</code> to be used for this container (see list
80 * of valid layout type values above).</p><br/>
81 * <br/><p>Additional layout specific configuration properties. For complete
82 * details regarding the valid config options for each layout type, see the
83 * layout class corresponding to the <code>layout</code> specified.</p>
84 * </ul></div></ul></div>
87 <span id='Ext-container.AbstractContainer-cfg-activeItem'> /**
88 </span> * @cfg {String/Number} activeItem
89 * A string component id or the numeric index of the component that should be initially activated within the
90 * container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first
91 * item in the container's collection). activeItem only applies to layout styles that can display
92 * items one at a time (like {@link Ext.layout.container.Card} and {@link Ext.layout.container.Fit}).
94 <span id='Ext-container.AbstractContainer-cfg-items'> /**
95 </span> * @cfg {Object/Array} items
96 * <p>A single item, or an array of child Components to be added to this container</p>
97 * <p><b>Unless configured with a {@link #layout}, a Container simply renders child Components serially into
98 * its encapsulating element and performs no sizing or positioning upon them.</b><p>
99 * <p>Example:</p>
100 * <pre><code>
101 // specifying a single item
103 layout: 'fit', // The single items is sized to fit
105 // specifying multiple items
106 items: [{...}, {...}],
107 layout: 'hbox', // The items are arranged horizontally
108 </code></pre>
109 * <p>Each item may be:</p>
111 * <li>A {@link Ext.Component Component}</li>
112 * <li>A Component configuration object</li>
114 * <p>If a configuration object is specified, the actual type of Component to be
115 * instantiated my be indicated by using the {@link Ext.Component#xtype xtype} option.</p>
116 * <p>Every Component class has its own {@link Ext.Component#xtype xtype}.</p>
117 * <p>If an {@link Ext.Component#xtype xtype} is not explicitly
118 * specified, the {@link #defaultType} for the Container is used, which by default is usually <code>panel</code>.</p>
119 * <p><b>Notes</b>:</p>
120 * <p>Ext uses lazy rendering. Child Components will only be rendered
121 * should it become necessary. Items are automatically laid out when they are first
122 * shown (no sizing is done while hidden), or in response to a {@link #doLayout} call.</p>
123 * <p>Do not specify <code>{@link Ext.panel.Panel#contentEl contentEl}</code> or
124 * <code>{@link Ext.panel.Panel#html html}</code> with <code>items</code>.</p>
126 <span id='Ext-container.AbstractContainer-cfg-defaults'> /**
127 </span> * @cfg {Object|Function} defaults
128 * <p>This option is a means of applying default settings to all added items whether added through the {@link #items}
129 * config or via the {@link #add} or {@link #insert} methods.</p>
130 * <p>If an added item is a config object, and <b>not</b> an instantiated Component, then the default properties are
131 * unconditionally applied. If the added item <b>is</b> an instantiated Component, then the default properties are
132 * applied conditionally so as not to override existing properties in the item.</p>
133 * <p>If the defaults option is specified as a function, then the function will be called using this Container as the
134 * scope (<code>this</code> reference) and passing the added item as the first parameter. Any resulting object
135 * from that call is then applied to the item as default properties.</p>
136 * <p>For example, to automatically apply padding to the body of each of a set of
137 * contained {@link Ext.panel.Panel} items, you could pass: <code>defaults: {bodyStyle:'padding:15px'}</code>.</p>
138 * <p>Usage:</p><pre><code>
139 defaults: { // defaults are applied to items, not the container
144 xtype: 'panel', // defaults <b>do not</b> have precedence over
145 id: 'panel1', // options in config objects, so the defaults
146 autoScroll: false // will not be applied here, panel1 will be autoScroll:false
148 new Ext.panel.Panel({ // defaults <b>do</b> have precedence over options
149 id: 'panel2', // options in components, so the defaults
150 autoScroll: false // will be applied here, panel2 will be autoScroll:true.
152 ]</code></pre>
155 <span id='Ext-container.AbstractContainer-cfg-suspendLayout'> /** @cfg {Boolean} suspendLayout
156 </span> * If true, suspend calls to doLayout. Useful when batching multiple adds to a container and not passing them
157 * as multiple arguments or an array.
159 suspendLayout : false,
161 <span id='Ext-container.AbstractContainer-cfg-autoDestroy'> /** @cfg {Boolean} autoDestroy
162 </span> * If true the container will automatically destroy any contained component that is removed from it, else
163 * destruction must be handled manually.
168 <span id='Ext-container.AbstractContainer-cfg-defaultType'> /** @cfg {String} defaultType
169 </span> * <p>The default {@link Ext.Component xtype} of child Components to create in this Container when
170 * a child item is specified as a raw configuration object, rather than as an instantiated Component.</p>
171 * <p>Defaults to <code>'panel'</code>.</p>
173 defaultType: 'panel',
177 baseCls: Ext.baseCSSPrefix + 'container',
179 <span id='Ext-container.AbstractContainer-cfg-bubbleEvents'> /**
180 </span> * @cfg {Array} bubbleEvents
181 * <p>An array of events that, when fired, should be bubbled to any parent container.
182 * See {@link Ext.util.Observable#enableBubble}.
183 * Defaults to <code>['add', 'remove']</code>.
185 bubbleEvents: ['add', 'remove'],
188 initComponent : function(){
191 <span id='Ext-container.AbstractContainer-event-afterlayout'> /**
192 </span> * @event afterlayout
193 * Fires when the components in this container are arranged by the associated layout manager.
194 * @param {Ext.container.Container} this
195 * @param {ContainerLayout} layout The ContainerLayout implementation for this container
198 <span id='Ext-container.AbstractContainer-event-beforeadd'> /**
199 </span> * @event beforeadd
200 * Fires before any {@link Ext.Component} is added or inserted into the container.
201 * A handler can return false to cancel the add.
202 * @param {Ext.container.Container} this
203 * @param {Ext.Component} component The component being added
204 * @param {Number} index The index at which the component will be added to the container's items collection
207 <span id='Ext-container.AbstractContainer-event-beforeremove'> /**
208 </span> * @event beforeremove
209 * Fires before any {@link Ext.Component} is removed from the container. A handler can return
210 * false to cancel the remove.
211 * @param {Ext.container.Container} this
212 * @param {Ext.Component} component The component being removed
215 <span id='Ext-container.AbstractContainer-event-add'> /**
218 * Fires after any {@link Ext.Component} is added or inserted into the container.
219 * @param {Ext.container.Container} this
220 * @param {Ext.Component} component The component that was added
221 * @param {Number} index The index at which the component was added to the container's items collection
224 <span id='Ext-container.AbstractContainer-event-remove'> /**
225 </span> * @event remove
227 * Fires after any {@link Ext.Component} is removed from the container.
228 * @param {Ext.container.Container} this
229 * @param {Ext.Component} component The component that was removed
232 <span id='Ext-container.AbstractContainer-event-beforecardswitch'> /**
233 </span> * @event beforecardswitch
234 * Fires before this container switches the active card. This event
235 * is only available if this container uses a CardLayout. Note that
236 * TabPanel and Carousel both get a CardLayout by default, so both
237 * will have this event.
238 * A handler can return false to cancel the card switch.
239 * @param {Ext.container.Container} this
240 * @param {Ext.Component} newCard The card that will be switched to
241 * @param {Ext.Component} oldCard The card that will be switched from
242 * @param {Number} index The index of the card that will be switched to
243 * @param {Boolean} animated True if this cardswitch will be animated
246 <span id='Ext-container.AbstractContainer-event-cardswitch'> /**
247 </span> * @event cardswitch
248 * Fires after this container switches the active card. If the card
249 * is switched using an animation, this event will fire after the
250 * animation has finished. This event is only available if this container
251 * uses a CardLayout. Note that TabPanel and Carousel both get a CardLayout
252 * by default, so both will have this event.
253 * @param {Ext.container.Container} this
254 * @param {Ext.Component} newCard The card that has been switched to
255 * @param {Ext.Component} oldCard The card that has been switched from
256 * @param {Number} index The index of the card that has been switched to
257 * @param {Boolean} animated True if this cardswitch was animated
262 // layoutOnShow stack
263 me.layoutOnShow = Ext.create('Ext.util.MixedCollection');
269 initItems : function() {
273 <span id='Ext-container.AbstractContainer-property-items'> /**
274 </span> * The MixedCollection containing all the child items of this container.
276 * @type Ext.util.MixedCollection
278 me.items = Ext.create('Ext.util.MixedCollection', false, me.getComponentId);
281 if (!Ext.isArray(items)) {
290 afterRender : function() {
296 setLayout : function(layout) {
297 var currentLayout = this.layout;
299 if (currentLayout && currentLayout.isLayout && currentLayout != layout) {
300 currentLayout.setOwner(null);
303 this.layout = layout;
304 layout.setOwner(this);
307 <span id='Ext-container.AbstractContainer-method-getLayout'> /**
308 </span> * Returns the {@link Ext.layout.container.AbstractContainer layout} instance currently associated with this Container.
309 * If a layout has not been instantiated yet, that is done first
310 * @return {Ext.layout.container.AbstractContainer} The layout
312 getLayout : function() {
314 if (!me.layout || !me.layout.isLayout) {
315 me.setLayout(Ext.layout.Layout.create(me.layout, 'autocontainer'));
321 <span id='Ext-container.AbstractContainer-method-doLayout'> /**
322 </span> * Manually force this container's layout to be recalculated. The framwork uses this internally to refresh layouts
324 * @return {Ext.container.Container} this
326 doLayout : function() {
328 layout = me.getLayout();
330 if (me.rendered && layout && !me.suspendLayout) {
331 // If either dimension is being auto-set, then it requires a ComponentLayout to be run.
332 if ((!Ext.isNumber(me.width) || !Ext.isNumber(me.height)) && me.componentLayout.type !== 'autocomponent') {
333 // Only run the ComponentLayout if it is not already in progress
334 if (me.componentLayout.layoutBusy !== true) {
335 me.doComponentLayout();
336 if (me.componentLayout.layoutCancelled === true) {
341 // Both dimensions defined, run a ContainerLayout
343 // Only run the ContainerLayout if it is not already in progress
344 if (layout.layoutBusy !== true) {
354 afterLayout : function(layout) {
355 this.fireEvent('afterlayout', this, layout);
359 prepareItems : function(items, applyDefaults) {
360 if (!Ext.isArray(items)) {
364 // Make sure defaults are applied and item is initialized
369 for (; i < len; i++) {
372 item = this.applyDefaults(item);
374 items[i] = this.lookupComponent(item);
380 applyDefaults : function(config) {
381 var defaults = this.defaults;
384 if (Ext.isFunction(defaults)) {
385 defaults = defaults.call(this, config);
388 if (Ext.isString(config)) {
389 config = Ext.ComponentManager.get(config);
390 Ext.applyIf(config, defaults);
391 } else if (!config.isComponent) {
392 Ext.applyIf(config, defaults);
394 Ext.applyIf(config, defaults);
402 lookupComponent : function(comp) {
403 return Ext.isString(comp) ? Ext.ComponentManager.get(comp) : this.createComponent(comp);
407 createComponent : function(config, defaultType) {
408 // // add in ownerCt at creation time but then immediately
409 // // remove so that onBeforeAdd can handle it
410 // var component = Ext.create(Ext.apply({ownerCt: this}, config), defaultType || this.defaultType);
412 // delete component.initialConfig.ownerCt;
413 // delete component.ownerCt;
415 return Ext.ComponentManager.create(config, defaultType || this.defaultType);
418 // @private - used as the key lookup function for the items collection
419 getComponentId : function(comp) {
420 return comp.getItemId();
423 <span id='Ext-container.AbstractContainer-method-add'> /**
425 Adds {@link Ext.Component Component}(s) to this Container.
429 - Fires the {@link #beforeadd} event before adding.
430 - The Container's {@link #defaults default config values} will be applied
431 accordingly (see `{@link #defaults}` for details).
432 - Fires the `{@link #add}` event after the component has been added.
436 If the Container is __already rendered__ when `add`
437 is called, it will render the newly added Component into its content area.
439 __**If**__ the Container was configured with a size-managing {@link #layout} manager, the Container
440 will recalculate its internal layout at this time too.
442 Note that the default layout manager simply renders child Components sequentially into the content area and thereafter performs no sizing.
444 If adding multiple new child Components, pass them as an array to the `add` method, so that only one layout recalculation is performed.
446 tb = new {@link Ext.toolbar.Toolbar}({
447 renderTo: document.body
448 }); // toolbar is rendered
449 tb.add([{text:'Button 1'}, {text:'Button 2'}]); // add multiple items. ({@link #defaultType} for {@link Ext.toolbar.Toolbar Toolbar} is 'button')
453 Components directly managed by the BorderLayout layout manager
454 may not be removed or added. See the Notes for {@link Ext.layout.container.Border BorderLayout}
457 * @param {...Object/Array} Component
458 * Either one or more Components to add or an Array of Components to add.
459 * See `{@link #items}` for additional information.
461 * @return {Ext.Component/Array} The Components that were added.
466 args = Array.prototype.slice.call(arguments),
476 if (typeof args[0] == 'number') {
477 index = args.shift();
480 hasMultipleArgs = args.length > 1;
481 if (hasMultipleArgs || Ext.isArray(args[0])) {
483 items = hasMultipleArgs ? args : args[0];
484 // Suspend Layouts while we add multiple items to the container
485 me.suspendLayout = true;
486 for (i = 0, ln = items.length; i < ln; i++) {
491 Ext.Error.raise("Trying to add a null item as a child of Container with itemId/id: " + me.getItemId());
496 item = me.add(index + i, item);
502 // Resume Layouts now that all items have been added and do a single layout for all the items just added
503 me.suspendLayout = false;
508 cmp = me.prepareItems(args[0], true)[0];
510 // Floating Components are not added into the items collection
511 // But they do get an upward ownerCt link so that they can traverse
512 // up to their z-index parent.
514 cmp.onAdded(me, index);
516 index = (index !== -1) ? index : me.items.length;
517 if (me.fireEvent('beforeadd', me, cmp, index) !== false && me.onBeforeAdd(cmp) !== false) {
518 me.items.insert(index, cmp);
519 cmp.onAdded(me, index);
520 me.onAdd(cmp, index);
521 me.fireEvent('add', me, cmp, index);
528 <span id='Ext-container.AbstractContainer-method-registerFloatingItem'> /**
530 * <p>Called by Component#doAutoRender</p>
531 * <p>Register a Container configured <code>floating: true</code> with this Container's {@link Ext.ZIndexManager ZIndexManager}.</p>
532 * <p>Components added in ths way will not participate in the layout, but will be rendered
533 * upon first show in the way that {@link Ext.window.Window Window}s are.</p>
534 * <p></p>
536 registerFloatingItem: function(cmp) {
538 if (!me.floatingItems) {
539 me.floatingItems = Ext.create('Ext.ZIndexManager', me);
541 me.floatingItems.register(cmp);
545 onRemove : Ext.emptyFn,
547 <span id='Ext-container.AbstractContainer-method-insert'> /**
548 </span> * Inserts a Component into this Container at a specified index. Fires the
549 * {@link #beforeadd} event before inserting, then fires the {@link #add} event after the
550 * Component has been inserted.
551 * @param {Number} index The index at which the Component will be inserted
552 * into the Container's items collection
553 * @param {Ext.Component} component The child Component to insert.<br><br>
554 * Ext uses lazy rendering, and will only render the inserted Component should
555 * it become necessary.<br><br>
556 * A Component config object may be passed in order to avoid the overhead of
557 * constructing a real Component object if lazy rendering might mean that the
558 * inserted Component will not be rendered immediately. To take advantage of
559 * this 'lazy instantiation', set the {@link Ext.Component#xtype} config
560 * property to the registered type of the Component wanted.<br><br>
561 * For a list of all available xtypes, see {@link Ext.Component}.
562 * @return {Ext.Component} component The Component (or config object) that was
563 * inserted with the Container's default config values applied.
565 insert : function(index, comp) {
566 return this.add(index, comp);
569 <span id='Ext-container.AbstractContainer-method-move'> /**
570 </span> * Moves a Component within the Container
571 * @param {Number} fromIdx The index the Component you wish to move is currently at.
572 * @param {Number} toIdx The new index for the Component.
573 * @return {Ext.Component} component The Component (or config object) that was moved.
575 move : function(fromIdx, toIdx) {
576 var items = this.items,
578 item = items.removeAt(fromIdx);
579 if (item === false) {
582 items.insert(toIdx, item);
588 onBeforeAdd : function(item) {
592 item.ownerCt.remove(item, false);
595 if (me.border === false || me.border === 0) {
596 item.border = (item.border === true);
600 <span id='Ext-container.AbstractContainer-method-remove'> /**
601 </span> * Removes a component from this container. Fires the {@link #beforeremove} event before removing, then fires
602 * the {@link #remove} event after the component has been removed.
603 * @param {Component/String} component The component reference or id to remove.
604 * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
605 * Defaults to the value of this Container's {@link #autoDestroy} config.
606 * @return {Ext.Component} component The Component that was removed.
608 remove : function(comp, autoDestroy) {
610 c = me.getComponent(comp);
612 if (Ext.isDefined(Ext.global.console) && !c) {
613 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.");
617 if (c && me.fireEvent('beforeremove', me, c) !== false) {
618 me.doRemove(c, autoDestroy);
619 me.fireEvent('remove', me, c);
626 doRemove : function(component, autoDestroy) {
629 hasLayout = layout && me.rendered;
631 me.items.remove(component);
632 component.onRemoved();
635 layout.onRemove(component);
638 me.onRemove(component, autoDestroy);
640 if (autoDestroy === true || (autoDestroy !== false && me.autoDestroy)) {
644 if (hasLayout && !autoDestroy) {
645 layout.afterRemove(component);
648 if (!me.destroying) {
653 <span id='Ext-container.AbstractContainer-method-removeAll'> /**
654 </span> * Removes all components from this container.
655 * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
656 * Defaults to the value of this Container's {@link #autoDestroy} config.
657 * @return {Array} Array of the destroyed components
659 removeAll : function(autoDestroy) {
661 removeItems = me.items.items.slice(),
664 len = removeItems.length,
667 // Suspend Layouts while we remove multiple items from the container
668 me.suspendLayout = true;
669 for (; i < len; i++) {
670 item = removeItems[i];
671 me.remove(item, autoDestroy);
673 if (item.ownerCt !== me) {
678 // Resume Layouts now that all items have been removed and do a single layout
679 me.suspendLayout = false;
684 // Used by ComponentQuery to retrieve all of the items
685 // which can potentially be considered a child of this Container.
686 // This should be overriden by components which have child items
687 // that are not contained in items. For example dockedItems, menu, etc
688 // IMPORTANT note for maintainers:
689 // Items are returned in tree traversal order. Each item is appended to the result array
690 // followed by the results of that child's getRefItems call.
691 // Floating child items are appended after internal child items.
692 getRefItems : function(deep) {
694 items = me.items.items,
700 for (; i < len; i++) {
703 if (deep && item.getRefItems) {
704 result.push.apply(result, item.getRefItems(true));
708 // Append floating items to the list.
709 // These will only be present after they are rendered.
710 if (me.floatingItems && me.floatingItems.accessList) {
711 result.push.apply(result, me.floatingItems.accessList);
717 <span id='Ext-container.AbstractContainer-method-cascade'> /**
718 </span> * Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified function with
719 * each component. The scope (<code>this</code> reference) of the
720 * function call will be the scope provided or the current component. The arguments to the function
721 * will be the args provided or the current component. If the function returns false at any point,
722 * the cascade is stopped on that branch.
723 * @param {Function} fn The function to call
724 * @param {Object} scope (optional) The scope of the function (defaults to current component)
725 * @param {Array} args (optional) The args to call the function with. The current component always passed as the last argument.
726 * @return {Ext.Container} this
728 cascade : function(fn, scope, origArgs){
730 cs = me.items ? me.items.items : [],
734 args = origArgs ? origArgs.concat(me) : [me],
735 componentIndex = args.length - 1;
737 if (fn.apply(scope || me, args) !== false) {
738 for(; i < len; i++){
741 c.cascade(fn, scope, origArgs);
743 args[componentIndex] = c;
744 fn.apply(scope || cs, args);
751 <span id='Ext-container.AbstractContainer-method-getComponent'> /**
752 </span> * Examines this container's <code>{@link #items}</code> <b>property</b>
753 * and gets a direct child component of this container.
754 * @param {String/Number} comp This parameter may be any of the following:
755 * <div><ul class="mdetail-params">
756 * <li>a <b><code>String</code></b> : representing the <code>{@link Ext.Component#itemId itemId}</code>
757 * or <code>{@link Ext.Component#id id}</code> of the child component </li>
758 * <li>a <b><code>Number</code></b> : representing the position of the child component
759 * within the <code>{@link #items}</code> <b>property</b></li>
760 * </ul></div>
761 * <p>For additional information see {@link Ext.util.MixedCollection#get}.
762 * @return Ext.Component The component (if found).
764 getComponent : function(comp) {
765 if (Ext.isObject(comp)) {
766 comp = comp.getItemId();
769 return this.items.get(comp);
772 <span id='Ext-container.AbstractContainer-method-query'> /**
773 </span> * Retrieves all descendant components which match the passed selector.
774 * Executes an Ext.ComponentQuery.query using this container as its root.
775 * @param {String} selector Selector complying to an Ext.ComponentQuery selector
776 * @return {Array} Ext.Component's which matched the selector
778 query : function(selector) {
779 return Ext.ComponentQuery.query(selector, this);
782 <span id='Ext-container.AbstractContainer-method-child'> /**
783 </span> * Retrieves the first direct child of this container which matches the passed selector.
784 * The passed in selector must comply with an Ext.ComponentQuery selector.
785 * @param {String} selector An Ext.ComponentQuery selector
786 * @return Ext.Component
788 child : function(selector) {
789 return this.query('> ' + selector)[0] || null;
792 <span id='Ext-container.AbstractContainer-method-down'> /**
793 </span> * Retrieves the first descendant of this container which matches the passed selector.
794 * The passed in selector must comply with an Ext.ComponentQuery selector.
795 * @param {String} selector An Ext.ComponentQuery selector
796 * @return Ext.Component
798 down : function(selector) {
799 return this.query(selector)[0] || null;
804 this.callParent(arguments);
805 this.performDeferredLayouts();
809 // Lay out any descendant containers who queued a layout operation during the time this was hidden
810 // This is also called by Panel after it expands because descendants of a collapsed Panel allso queue any layout ops.
811 performDeferredLayouts: function() {
812 var layoutCollection = this.layoutOnShow,
813 ln = layoutCollection.getCount(),
818 for (; i < ln; i++) {
819 item = layoutCollection.get(i);
820 needsLayout = item.needsLayout;
822 if (Ext.isObject(needsLayout)) {
823 item.doComponentLayout(needsLayout.width, needsLayout.height, needsLayout.isSetSize, needsLayout.ownerCt);
826 layoutCollection.clear();
830 // Enable all immediate children that was previously disabled
831 onEnable: function() {
832 Ext.Array.each(this.query('[isFormField]'), function(item) {
833 if (item.resetDisable) {
835 delete item.resetDisable;
842 // Disable all immediate children that was previously disabled
843 onDisable: function() {
844 Ext.Array.each(this.query('[isFormField]'), function(item) {
845 if (item.resetDisable !== false && !item.disabled) {
847 item.resetDisable = true;
853 <span id='Ext-container.AbstractContainer-method-beforeLayout'> /**
854 </span> * Occurs before componentLayout is run. Returning false from this method will prevent the containerLayout
855 * from being executed.
857 beforeLayout: function() {
862 beforeDestroy : function() {
868 while ((c = items.first())) {
869 me.doRemove(c, true);
879 });</pre></pre></body></html>