Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / src / layout / container / AbstractContainer.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 /**
16  * @class Ext.layout.container.AbstractContainer
17  * @extends Ext.layout.Layout
18  * Please refer to sub classes documentation
19  * @private
20  */
21 Ext.define('Ext.layout.container.AbstractContainer', {
22
23     /* Begin Definitions */
24
25     extend: 'Ext.layout.Layout',
26
27     /* End Definitions */
28
29     type: 'container',
30
31     /**
32      * @cfg {Boolean} bindToOwnerCtComponent
33      * Flag to notify the ownerCt Component on afterLayout of a change
34      */
35     bindToOwnerCtComponent: false,
36
37     /**
38      * @cfg {Boolean} bindToOwnerCtContainer
39      * Flag to notify the ownerCt Container on afterLayout of a change
40      */
41     bindToOwnerCtContainer: false,
42
43     /**
44      * @cfg {String} itemCls
45      * <p>An optional extra CSS class that will be added to the container. This can be useful for adding
46      * customized styles to the container or any of its children using standard CSS rules. See
47      * {@link Ext.Component}.{@link Ext.Component#componentCls componentCls} also.</p>
48      * </p>
49      */
50
51     /**
52     * Set the size of an item within the Container.  We should always use setCalculatedSize.
53     * @private
54     */
55     setItemSize: function(item, width, height) {
56         if (Ext.isObject(width)) {
57             height = width.height;
58             width = width.width;
59         }
60         item.setCalculatedSize(width, height, this.owner);
61     },
62
63     /**
64      * <p>Returns an array of child components either for a render phase (Performed in the beforeLayout method of the layout's
65      * base class), or the layout phase (onLayout).</p>
66      * @return {Ext.Component[]} of child components
67      */
68     getLayoutItems: function() {
69         return this.owner && this.owner.items && this.owner.items.items || [];
70     },
71
72     /**
73      * Containers should not lay out child components when collapsed.
74      */
75     beforeLayout: function() {
76         return !this.owner.collapsed && this.callParent(arguments);
77     },
78
79     afterLayout: function() {
80         this.owner.afterLayout(this);
81     },
82     /**
83      * Returns the owner component's resize element.
84      * @return {Ext.Element}
85      */
86      getTarget: function() {
87          return this.owner.getTargetEl();
88      },
89     /**
90      * <p>Returns the element into which rendering must take place. Defaults to the owner Container's target element.</p>
91      * May be overridden in layout managers which implement an inner element.
92      * @return {Ext.Element}
93      */
94      getRenderTarget: function() {
95          return this.owner.getTargetEl();
96      }
97 });
98