+<span id='Ext-container-AbstractContainer-cfg-layout'> /**
+</span> * @cfg {String/Object} layout
+ * <p><b>Important</b>: In order for child items to be correctly sized and
+ * positioned, typically a layout manager <b>must</b> be specified through
+ * the <code>layout</code> configuration option.</p>
+ * <p>The sizing and positioning of child {@link #items} is the responsibility of
+ * the Container's layout manager which creates and manages the type of layout
+ * you have in mind. For example:</p>
+ * <p>If the {@link #layout} configuration is not explicitly specified for
+ * a general purpose container (e.g. Container or Panel) the
+ * {@link Ext.layout.container.Auto default layout manager} will be used
+ * which does nothing but render child components sequentially into the
+ * Container (no sizing or positioning will be performed in this situation).</p>
+ * <p><b><code>layout</code></b> may be specified as either as an Object or as a String:</p>
+ * <div><ul class="mdetail-params">
+ * <li><u>Specify as an Object</u></li>
+ * <div><ul class="mdetail-params">
+ * <li>Example usage:</li>
+ * <pre><code>
+layout: {
+ type: 'vbox',
+ align: 'left'
+}
+ </code></pre>
+ *
+ * <li><code><b>type</b></code></li>
+ * <br/><p>The layout type to be used for this container. If not specified,
+ * a default {@link Ext.layout.container.Auto} will be created and used.</p>
+ * <p>Valid layout <code>type</code> values are:</p>
+ * <div class="sub-desc"><ul class="mdetail-params">
+ * <li><code><b>{@link Ext.layout.container.Auto Auto}</b></code> &nbsp;&nbsp;&nbsp; <b>Default</b></li>
+ * <li><code><b>{@link Ext.layout.container.Card card}</b></code></li>
+ * <li><code><b>{@link Ext.layout.container.Fit fit}</b></code></li>
+ * <li><code><b>{@link Ext.layout.container.HBox hbox}</b></code></li>
+ * <li><code><b>{@link Ext.layout.container.VBox vbox}</b></code></li>
+ * <li><code><b>{@link Ext.layout.container.Anchor anchor}</b></code></li>
+ * <li><code><b>{@link Ext.layout.container.Table table}</b></code></li>
+ * </ul></div>
+ *
+ * <li>Layout specific configuration properties</li>
+ * <p>Additional layout specific configuration properties may also be
+ * specified. For complete details regarding the valid config options for
+ * each layout type, see the layout class corresponding to the <code>type</code>
+ * specified.</p>
+ *
+ * </ul></div>
+ *
+ * <li><u>Specify as a String</u></li>
+ * <div><ul class="mdetail-params">
+ * <li>Example usage:</li>
+ * <pre><code>
+layout: 'vbox'
+ </code></pre>
+ * <li><code><b>layout</b></code></li>
+ * <p>The layout <code>type</code> to be used for this container (see list
+ * of valid layout type values above).</p>
+ * <p>Additional layout specific configuration properties. For complete
+ * details regarding the valid config options for each layout type, see the
+ * layout class corresponding to the <code>layout</code> specified.</p>
+ * </ul></div></ul></div>
+ */
+
+<span id='Ext-container-AbstractContainer-cfg-activeItem'> /**
+</span> * @cfg {String/Number} activeItem
+ * A string component id or the numeric index of the component that should be initially activated within the
+ * container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first
+ * item in the container's collection). activeItem only applies to layout styles that can display
+ * items one at a time (like {@link Ext.layout.container.Card} and {@link Ext.layout.container.Fit}).
+ */
+<span id='Ext-container-AbstractContainer-cfg-items'> /**
+</span> * @cfg {Object/Object[]} items
+ * <p>A single item, or an array of child Components to be added to this container</p>
+ * <p><b>Unless configured with a {@link #layout}, a Container simply renders child Components serially into
+ * its encapsulating element and performs no sizing or positioning upon them.</b><p>
+ * <p>Example:</p>
+ * <pre><code>
+// specifying a single item
+items: {...},
+layout: 'fit', // The single items is sized to fit
+
+// specifying multiple items
+items: [{...}, {...}],
+layout: 'hbox', // The items are arranged horizontally
+ </code></pre>
+ * <p>Each item may be:</p>
+ * <ul>
+ * <li>A {@link Ext.Component Component}</li>
+ * <li>A Component configuration object</li>
+ * </ul>
+ * <p>If a configuration object is specified, the actual type of Component to be
+ * instantiated my be indicated by using the {@link Ext.Component#xtype xtype} option.</p>
+ * <p>Every Component class has its own {@link Ext.Component#xtype xtype}.</p>
+ * <p>If an {@link Ext.Component#xtype xtype} is not explicitly
+ * specified, the {@link #defaultType} for the Container is used, which by default is usually <code>panel</code>.</p>
+ * <p><b>Notes</b>:</p>
+ * <p>Ext uses lazy rendering. Child Components will only be rendered
+ * should it become necessary. Items are automatically laid out when they are first
+ * shown (no sizing is done while hidden), or in response to a {@link #doLayout} call.</p>
+ * <p>Do not specify <code>{@link Ext.panel.Panel#contentEl contentEl}</code> or
+ * <code>{@link Ext.panel.Panel#html html}</code> with <code>items</code>.</p>
+ */
+<span id='Ext-container-AbstractContainer-cfg-defaults'> /**
+</span> * @cfg {Object/Function} defaults
+ * This option is a means of applying default settings to all added items whether added through the {@link #items}
+ * config or via the {@link #add} or {@link #insert} methods.
+ *
+ * Defaults are applied to both config objects and instantiated components conditionally so as not to override
+ * existing properties in the item (see {@link Ext#applyIf}).
+ *
+ * If the defaults option is specified as a function, then the function will be called using this Container as the
+ * scope (`this` reference) and passing the added item as the first parameter. Any resulting object
+ * from that call is then applied to the item as default properties.
+ *
+ * For example, to automatically apply padding to the body of each of a set of
+ * contained {@link Ext.panel.Panel} items, you could pass: `defaults: {bodyStyle:'padding:15px'}`.
+ *
+ * Usage:
+ *
+ * defaults: { // defaults are applied to items, not the container
+ * autoScroll: true
+ * },
+ * items: [
+ * // default will not be applied here, panel1 will be autoScroll: false
+ * {
+ * xtype: 'panel',
+ * id: 'panel1',
+ * autoScroll: false
+ * },
+ * // this component will have autoScroll: true
+ * new Ext.panel.Panel({
+ * id: 'panel2'
+ * })
+ * ]
+ */
+
+<span id='Ext-container-AbstractContainer-cfg-suspendLayout'> /** @cfg {Boolean} suspendLayout
+</span> * If true, suspend calls to doLayout. Useful when batching multiple adds to a container and not passing them
+ * as multiple arguments or an array.
+ */
+ suspendLayout : false,
+
+<span id='Ext-container-AbstractContainer-cfg-autoDestroy'> /** @cfg {Boolean} autoDestroy
+</span> * If true the container will automatically destroy any contained component that is removed from it, else
+ * destruction must be handled manually.
+ * Defaults to true.
+ */
+ autoDestroy : true,
+
+<span id='Ext-container-AbstractContainer-cfg-defaultType'> /** @cfg {String} defaultType
+</span> * <p>The default {@link Ext.Component xtype} of child Components to create in this Container when
+ * a child item is specified as a raw configuration object, rather than as an instantiated Component.</p>
+ * <p>Defaults to <code>'panel'</code>.</p>
+ */
+ defaultType: 'panel',
+
+ isContainer : true,
+
+<span id='Ext-container-AbstractContainer-property-layoutCounter'> /**
+</span> * The number of container layout calls made on this object.
+ * @property layoutCounter
+ * @type {Number}
+ * @private
+ */
+ layoutCounter : 0,
+
+ baseCls: Ext.baseCSSPrefix + 'container',
+
+<span id='Ext-container-AbstractContainer-cfg-bubbleEvents'> /**
+</span> * @cfg {String[]} bubbleEvents
+ * <p>An array of events that, when fired, should be bubbled to any parent container.
+ * See {@link Ext.util.Observable#enableBubble}.
+ * Defaults to <code>['add', 'remove']</code>.
+ */
+ bubbleEvents: ['add', 'remove'],
+
+ // @private
+ initComponent : function(){
+ var me = this;
+ me.addEvents(
+<span id='Ext-container-AbstractContainer-event-afterlayout'> /**
+</span> * @event afterlayout
+ * Fires when the components in this container are arranged by the associated layout manager.
+ * @param {Ext.container.Container} this
+ * @param {Ext.layout.container.Container} layout The ContainerLayout implementation for this container
+ */
+ 'afterlayout',
+<span id='Ext-container-AbstractContainer-event-beforeadd'> /**
+</span> * @event beforeadd
+ * Fires before any {@link Ext.Component} is added or inserted into the container.
+ * A handler can return false to cancel the add.
+ * @param {Ext.container.Container} this
+ * @param {Ext.Component} component The component being added
+ * @param {Number} index The index at which the component will be added to the container's items collection
+ */
+ 'beforeadd',
+<span id='Ext-container-AbstractContainer-event-beforeremove'> /**
+</span> * @event beforeremove
+ * Fires before any {@link Ext.Component} is removed from the container. A handler can return
+ * false to cancel the remove.
+ * @param {Ext.container.Container} this
+ * @param {Ext.Component} component The component being removed
+ */
+ 'beforeremove',
+<span id='Ext-container-AbstractContainer-event-add'> /**
+</span> * @event add
+ * @bubbles
+ * Fires after any {@link Ext.Component} is added or inserted into the container.
+ * @param {Ext.container.Container} this
+ * @param {Ext.Component} component The component that was added
+ * @param {Number} index The index at which the component was added to the container's items collection
+ */
+ 'add',
+<span id='Ext-container-AbstractContainer-event-remove'> /**
+</span> * @event remove
+ * @bubbles
+ * Fires after any {@link Ext.Component} is removed from the container.
+ * @param {Ext.container.Container} this
+ * @param {Ext.Component} component The component that was removed
+ */
+ 'remove'
+ );
+
+ // layoutOnShow stack
+ me.layoutOnShow = Ext.create('Ext.util.MixedCollection');
+ me.callParent();
+ me.initItems();
+ },
+
+ // @private
+ initItems : function() {
+ var me = this,
+ items = me.items;
+
+<span id='Ext-container-AbstractContainer-property-items'> /**
+</span> * The MixedCollection containing all the child items of this container.
+ * @property items
+ * @type Ext.util.MixedCollection
+ */
+ me.items = Ext.create('Ext.util.MixedCollection', false, me.getComponentId);
+
+ if (items) {
+ if (!Ext.isArray(items)) {
+ items = [items];
+ }
+
+ me.add(items);
+ }
+ },
+
+ // @private
+ afterRender : function() {
+ this.getLayout();
+ this.callParent();
+ },
+
+ renderChildren: function () {
+ var me = this,
+ layout = me.getLayout();
+
+ me.callParent();
+ // this component's elements exist, so now create the child components' elements
+
+ if (layout) {
+ me.suspendLayout = true;
+ layout.renderChildren();
+ delete me.suspendLayout;
+ }
+ },
+
+ // @private
+ setLayout : function(layout) {
+ var currentLayout = this.layout;
+
+ if (currentLayout && currentLayout.isLayout && currentLayout != layout) {
+ currentLayout.setOwner(null);
+ }
+
+ this.layout = layout;
+ layout.setOwner(this);
+ },
+
+<span id='Ext-container-AbstractContainer-method-getLayout'> /**
+</span> * Returns the {@link Ext.layout.container.AbstractContainer layout} instance currently associated with this Container.
+ * If a layout has not been instantiated yet, that is done first
+ * @return {Ext.layout.container.AbstractContainer} The layout
+ */
+ getLayout : function() {
+ var me = this;
+ if (!me.layout || !me.layout.isLayout) {
+ me.setLayout(Ext.layout.Layout.create(me.layout, 'autocontainer'));
+ }
+
+ return me.layout;
+ },
+
+<span id='Ext-container-AbstractContainer-method-doLayout'> /**
+</span> * Manually force this container's layout to be recalculated. The framework uses this internally to refresh layouts
+ * form most cases.
+ * @return {Ext.container.Container} this
+ */
+ doLayout : function() {
+ var me = this,
+ layout = me.getLayout();
+
+ if (me.rendered && layout && !me.suspendLayout) {
+ // If either dimension is being auto-set, then it requires a ComponentLayout to be run.
+ if (!me.isFixedWidth() || !me.isFixedHeight()) {
+ // Only run the ComponentLayout if it is not already in progress
+ if (me.componentLayout.layoutBusy !== true) {
+ me.doComponentLayout();
+ if (me.componentLayout.layoutCancelled === true) {
+ layout.layout();
+ }
+ }
+ }
+ // Both dimensions set, either by configuration, or by an owning layout, run a ContainerLayout
+ else {
+ // Only run the ContainerLayout if it is not already in progress
+ if (layout.layoutBusy !== true) {
+ layout.layout();
+ }
+ }
+ }
+
+ return me;
+ },
+
+ // @private
+ afterLayout : function(layout) {
+ ++this.layoutCounter;
+ this.fireEvent('afterlayout', this, layout);
+ },
+
+ // @private
+ prepareItems : function(items, applyDefaults) {
+ if (!Ext.isArray(items)) {
+ items = [items];
+ }
+
+ // Make sure defaults are applied and item is initialized
+ var i = 0,
+ len = items.length,
+ item;
+
+ for (; i < len; i++) {
+ item = items[i];
+ if (applyDefaults) {
+ item = this.applyDefaults(item);
+ }
+ items[i] = this.lookupComponent(item);
+ }
+ return items;
+ },
+
+ // @private
+ applyDefaults : function(config) {
+ var defaults = this.defaults;
+
+ if (defaults) {
+ if (Ext.isFunction(defaults)) {
+ defaults = defaults.call(this, config);
+ }
+
+ if (Ext.isString(config)) {
+ config = Ext.ComponentManager.get(config);
+ }
+ Ext.applyIf(config, defaults);
+ }
+
+ return config;
+ },
+
+ // @private
+ lookupComponent : function(comp) {
+ return Ext.isString(comp) ? Ext.ComponentManager.get(comp) : this.createComponent(comp);
+ },
+
+ // @private
+ createComponent : function(config, defaultType) {
+ // // add in ownerCt at creation time but then immediately
+ // // remove so that onBeforeAdd can handle it
+ // var component = Ext.create(Ext.apply({ownerCt: this}, config), defaultType || this.defaultType);
+ //
+ // delete component.initialConfig.ownerCt;
+ // delete component.ownerCt;
+
+ return Ext.ComponentManager.create(config, defaultType || this.defaultType);
+ },
+
+ // @private - used as the key lookup function for the items collection
+ getComponentId : function(comp) {
+ return comp.getItemId();
+ },
+
+<span id='Ext-container-AbstractContainer-method-add'> /**
+</span>
+Adds {@link Ext.Component Component}(s) to this Container.
+
+##Description:##
+
+- Fires the {@link #beforeadd} event before adding.
+- The Container's {@link #defaults default config values} will be applied
+ accordingly (see `{@link #defaults}` for details).
+- Fires the `{@link #add}` event after the component has been added.
+
+##Notes:##
+
+If the Container is __already rendered__ when `add`
+is called, it will render the newly added Component into its content area.
+
+__**If**__ the Container was configured with a size-managing {@link #layout} manager, the Container
+will recalculate its internal layout at this time too.
+
+Note that the default layout manager simply renders child Components sequentially into the content area and thereafter performs no sizing.
+
+If adding multiple new child Components, pass them as an array to the `add` method, so that only one layout recalculation is performed.
+
+ tb = new {@link Ext.toolbar.Toolbar}({
+ renderTo: document.body
+ }); // toolbar is rendered
+ tb.add([{text:'Button 1'}, {text:'Button 2'}]); // add multiple items. ({@link #defaultType} for {@link Ext.toolbar.Toolbar Toolbar} is 'button')
+
+##Warning:##