- insert : function(index, comp) {
- return this.add(index, comp);
- },
-
-<span id='Ext-container.AbstractContainer-method-move'> /**
-</span> * Moves a Component within the Container
- * @param {Number} fromIdx The index the Component you wish to move is currently at.
- * @param {Number} toIdx The new index for the Component.
- * @return {Ext.Component} component The Component (or config object) that was moved.
- */
- move : function(fromIdx, toIdx) {
- var items = this.items,
- item;
- item = items.removeAt(fromIdx);
- if (item === false) {
- return false;
- }
- items.insert(toIdx, item);
- this.doLayout();
- return item;
- },
-
- // @private
- onBeforeAdd : function(item) {
- var me = this;
-
- if (item.ownerCt) {
- item.ownerCt.remove(item, false);
- }
-
- if (me.border === false || me.border === 0) {
- item.border = (item.border === true);
- }
- },
-
-<span id='Ext-container.AbstractContainer-method-remove'> /**
-</span> * Removes a component from this container. Fires the {@link #beforeremove} event before removing, then fires
- * the {@link #remove} event after the component has been removed.
- * @param {Component/String} component The component reference or id to remove.
- * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
- * Defaults to the value of this Container's {@link #autoDestroy} config.
- * @return {Ext.Component} component The Component that was removed.
- */
- remove : function(comp, autoDestroy) {
- var me = this,
- c = me.getComponent(comp);
- //<debug>
- if (Ext.isDefined(Ext.global.console) && !c) {
- 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.");
- }
- //</debug>
-
- if (c && me.fireEvent('beforeremove', me, c) !== false) {
- me.doRemove(c, autoDestroy);
- me.fireEvent('remove', me, c);
- }
-
- return c;
- },
-
- // @private
- doRemove : function(component, autoDestroy) {
- var me = this,
- layout = me.layout,
- hasLayout = layout && me.rendered;
-
- me.items.remove(component);
- component.onRemoved();
-
- if (hasLayout) {
- layout.onRemove(component);
- }
-
- me.onRemove(component, autoDestroy);
-
- if (autoDestroy === true || (autoDestroy !== false && me.autoDestroy)) {
- component.destroy();
- }
-
- if (hasLayout && !autoDestroy) {
- layout.afterRemove(component);
- }
-
- if (!me.destroying) {
- me.doLayout();
- }
- },
-
-<span id='Ext-container.AbstractContainer-method-removeAll'> /**
-</span> * Removes all components from this container.
- * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
- * Defaults to the value of this Container's {@link #autoDestroy} config.
- * @return {Array} Array of the destroyed components
- */
- removeAll : function(autoDestroy) {
- var me = this,
- removeItems = me.items.items.slice(),
- items = [],
- i = 0,
- len = removeItems.length,
- item;
-
- // Suspend Layouts while we remove multiple items from the container
- me.suspendLayout = true;
- for (; i < len; i++) {
- item = removeItems[i];
- me.remove(item, autoDestroy);
-
- if (item.ownerCt !== me) {
- items.push(item);
- }
- }
-
- // Resume Layouts now that all items have been removed and do a single layout
- me.suspendLayout = false;
- me.doLayout();
- return items;
- },
-
- // Used by ComponentQuery to retrieve all of the items
- // which can potentially be considered a child of this Container.
- // This should be overriden by components which have child items
- // that are not contained in items. For example dockedItems, menu, etc
- // IMPORTANT note for maintainers:
- // Items are returned in tree traversal order. Each item is appended to the result array
- // followed by the results of that child's getRefItems call.
- // Floating child items are appended after internal child items.
- getRefItems : function(deep) {
- var me = this,
- items = me.items.items,
- len = items.length,
- i = 0,
- item,
- result = [];
-
- for (; i < len; i++) {
- item = items[i];
- result.push(item);
- if (deep && item.getRefItems) {
- result.push.apply(result, item.getRefItems(true));
- }
- }
-
- // Append floating items to the list.
- // These will only be present after they are rendered.
- if (me.floatingItems && me.floatingItems.accessList) {
- result.push.apply(result, me.floatingItems.accessList);
- }
-
- return result;
- },
-
-<span id='Ext-container.AbstractContainer-method-cascade'> /**
-</span> * Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified function with
- * each component. The scope (<code>this</code> reference) of the
- * 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 cascade is stopped on that branch.
- * @param {Function} fn The function to call
- * @param {Object} scope (optional) The scope of the function (defaults to current component)
- * @param {Array} args (optional) The args to call the function with. The current component always passed as the last argument.
- * @return {Ext.Container} this
- */
- cascade : function(fn, scope, origArgs){
- var me = this,
- cs = me.items ? me.items.items : [],
- len = cs.length,
- i = 0,
- c,
- args = origArgs ? origArgs.concat(me) : [me],
- componentIndex = args.length - 1;
-
- if (fn.apply(scope || me, args) !== false) {
- for(; i < len; i++){
- c = cs[i];
- if (c.cascade) {
- c.cascade(fn, scope, origArgs);
- } else {
- args[componentIndex] = c;
- fn.apply(scope || cs, args);
- }
- }
- }
- return this;
- },
-
-<span id='Ext-container.AbstractContainer-method-getComponent'> /**
-</span> * Examines this container's <code>{@link #items}</code> <b>property</b>
- * and gets a direct child component of this container.
- * @param {String/Number} comp This parameter may be any of the following:
- * <div><ul class="mdetail-params">
- * <li>a <b><code>String</code></b> : representing the <code>{@link Ext.Component#itemId itemId}</code>
- * or <code>{@link Ext.Component#id id}</code> of the child component </li>
- * <li>a <b><code>Number</code></b> : representing the position of the child component
- * within the <code>{@link #items}</code> <b>property</b></li>
- * </ul></div>
- * <p>For additional information see {@link Ext.util.MixedCollection#get}.
- * @return Ext.Component The component (if found).
- */
- getComponent : function(comp) {
- if (Ext.isObject(comp)) {
- comp = comp.getItemId();
- }
-
- return this.items.get(comp);
- },
-
-<span id='Ext-container.AbstractContainer-method-query'> /**
-</span> * Retrieves all descendant components which match the passed selector.
- * Executes an Ext.ComponentQuery.query using this container as its root.
- * @param {String} selector Selector complying to an Ext.ComponentQuery selector
- * @return {Array} Ext.Component's which matched the selector
- */
- query : function(selector) {
- return Ext.ComponentQuery.query(selector, this);
- },
-
-<span id='Ext-container.AbstractContainer-method-child'> /**
-</span> * Retrieves the first direct child of this container which matches the passed selector.
- * The passed in selector must comply with an Ext.ComponentQuery selector.
- * @param {String} selector An Ext.ComponentQuery selector
- * @return Ext.Component
- */
- child : function(selector) {
- return this.query('> ' + selector)[0] || null;
- },
-
-<span id='Ext-container.AbstractContainer-method-down'> /**
-</span> * Retrieves the first descendant of this container which matches the passed selector.
- * The passed in selector must comply with an Ext.ComponentQuery selector.
- * @param {String} selector An Ext.ComponentQuery selector
- * @return Ext.Component
- */
- down : function(selector) {
- return this.query(selector)[0] || null;
- },
-
- // inherit docs
- show : function() {
- this.callParent(arguments);
- this.performDeferredLayouts();
- return this;
- },
-
- // Lay out any descendant containers who queued a layout operation during the time this was hidden
- // This is also called by Panel after it expands because descendants of a collapsed Panel allso queue any layout ops.
- performDeferredLayouts: function() {
- var layoutCollection = this.layoutOnShow,
- ln = layoutCollection.getCount(),
- i = 0,
- needsLayout,
- item;
-
- for (; i < ln; i++) {
- item = layoutCollection.get(i);
- needsLayout = item.needsLayout;
-
- if (Ext.isObject(needsLayout)) {
- item.doComponentLayout(needsLayout.width, needsLayout.height, needsLayout.isSetSize, needsLayout.ownerCt);
- }
- }
- layoutCollection.clear();
- },
-
- //@private
- // Enable all immediate children that was previously disabled
- onEnable: function() {
- Ext.Array.each(this.query('[isFormField]'), function(item) {
- if (item.resetDisable) {
- item.enable();
- delete item.resetDisable;
- }
- });
- this.callParent();
- },
-
- // @private
- // Disable all immediate children that was previously disabled
- onDisable: function() {
- Ext.Array.each(this.query('[isFormField]'), function(item) {
- if (item.resetDisable !== false && !item.disabled) {
- item.disable();
- item.resetDisable = true;
- }
- });
- this.callParent();
- },
-
-<span id='Ext-container.AbstractContainer-method-beforeLayout'> /**
-</span> * Occurs before componentLayout is run. Returning false from this method will prevent the containerLayout
- * from being executed.
- */
- beforeLayout: function() {
- return true;
- },
-
- // @private
- beforeDestroy : function() {
- var me = this,
- items = me.items,
- c;
-
- if (items) {
- while ((c = items.first())) {
- me.doRemove(c, true);
- }
- }
-
- Ext.destroy(
- me.layout,
- me.floatingItems
- );
- me.callParent();
- }
-});</pre></pre></body></html>
\ No newline at end of file