PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/ext-4.1.0_b3/src/layout/component/FieldSet.js

https://bitbucket.org/srogerf/javascript
JavaScript | 49 lines | 27 code | 7 blank | 15 comment | 3 complexity | df09f30de56d089e6a9c7d3859b15ce7 MD5 | raw file
 1/**
 2 * Component layout for Ext.form.FieldSet components
 3 * @private
 4 */
 5Ext.define('Ext.layout.component.FieldSet', {
 6    extend: 'Ext.layout.component.Body',
 7    alias: ['layout.fieldset'],
 8
 9    type: 'fieldset',
10
11    /*beginLayout: function (ownerContext) {
12        this.callParent(arguments);
13
14        var legend = this.owner.legend;
15        if (legend) {
16            ownerContext.legendContext = ownerContext.context.getCmp(legend);
17        }
18    },*/
19
20    beginLayoutCycle: function (ownerContext) {
21        this.callParent(arguments);
22
23        // Each time we begin (2nd+ would be due to invalidate) we need to publish the
24        // known contentHeight if we are collapsed:
25        if (ownerContext.target.collapsed) {
26            ownerContext.setContentHeight(0);
27        }
28    },
29
30    calculateOwnerHeightFromContentHeight: function (ownerContext, contentHeight) {
31        // Height of fieldset is content height plus top border width (which is either the legend height or top border width) plus bottom border width
32        return ownerContext.getProp('contentHeight') + ownerContext.getPaddingInfo().height + (ownerContext.target.legend ? ownerContext.target.legend.getHeight() : ownerContext.getBorderInfo().top) + ownerContext.getBorderInfo().bottom;
33    },
34
35    publishInnerHeight: function (ownerContext, height) {
36        this.callParent(arguments);
37        if (ownerContext.target.legend) {
38            ownerContext.bodyContext.setHeight(ownerContext.bodyContext.getProp('height') - ownerContext.target.legend.getHeight(), !ownerContext.heightModel.natural);
39        }
40    },
41
42    getLayoutItems : function() {
43        var legend = this.owner.legend;
44        if (legend) {
45            return [ legend ];
46        }
47        return [];
48    }
49});