/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. */
  5. Ext.define('Ext.layout.component.FieldSet', {
  6. extend: 'Ext.layout.component.Body',
  7. alias: ['layout.fieldset'],
  8. type: 'fieldset',
  9. /*beginLayout: function (ownerContext) {
  10. this.callParent(arguments);
  11. var legend = this.owner.legend;
  12. if (legend) {
  13. ownerContext.legendContext = ownerContext.context.getCmp(legend);
  14. }
  15. },*/
  16. beginLayoutCycle: function (ownerContext) {
  17. this.callParent(arguments);
  18. // Each time we begin (2nd+ would be due to invalidate) we need to publish the
  19. // known contentHeight if we are collapsed:
  20. if (ownerContext.target.collapsed) {
  21. ownerContext.setContentHeight(0);
  22. }
  23. },
  24. calculateOwnerHeightFromContentHeight: function (ownerContext, contentHeight) {
  25. // Height of fieldset is content height plus top border width (which is either the legend height or top border width) plus bottom border width
  26. return ownerContext.getProp('contentHeight') + ownerContext.getPaddingInfo().height + (ownerContext.target.legend ? ownerContext.target.legend.getHeight() : ownerContext.getBorderInfo().top) + ownerContext.getBorderInfo().bottom;
  27. },
  28. publishInnerHeight: function (ownerContext, height) {
  29. this.callParent(arguments);
  30. if (ownerContext.target.legend) {
  31. ownerContext.bodyContext.setHeight(ownerContext.bodyContext.getProp('height') - ownerContext.target.legend.getHeight(), !ownerContext.heightModel.natural);
  32. }
  33. },
  34. getLayoutItems : function() {
  35. var legend = this.owner.legend;
  36. if (legend) {
  37. return [ legend ];
  38. }
  39. return [];
  40. }
  41. });