Auto2.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-layout-container-Auto'>/**
  19. </span> * @class Ext.layout.container.Auto
  20. *
  21. * The AutoLayout is the default layout manager delegated by {@link Ext.container.Container} to
  22. * render any child Components when no `{@link Ext.container.Container#layout layout}` is configured into
  23. * a `{@link Ext.container.Container Container}.` AutoLayout provides only a passthrough of any layout calls
  24. * to any child containers.
  25. *
  26. * @example
  27. * Ext.create('Ext.Panel', {
  28. * width: 500,
  29. * height: 280,
  30. * title: &quot;AutoLayout Panel&quot;,
  31. * layout: 'auto',
  32. * renderTo: document.body,
  33. * items: [{
  34. * xtype: 'panel',
  35. * title: 'Top Inner Panel',
  36. * width: '75%',
  37. * height: 90
  38. * },
  39. * {
  40. * xtype: 'panel',
  41. * title: 'Bottom Inner Panel',
  42. * width: '75%',
  43. * height: 90
  44. * }]
  45. * });
  46. */
  47. Ext.define('Ext.layout.container.Auto', {
  48. /* Begin Definitions */
  49. alias: ['layout.auto', 'layout.autocontainer'],
  50. extend: 'Ext.layout.container.Container',
  51. /* End Definitions */
  52. type: 'autocontainer',
  53. childEls: [
  54. 'clearEl'
  55. ],
  56. renderTpl: [
  57. '{%this.renderBody(out,values)%}',
  58. // clear element is needed to prevent the bottom margins of the last child element from collapsing
  59. '&lt;div id=&quot;{ownerId}-clearEl&quot; class=&quot;', Ext.baseCSSPrefix, 'clear&quot; role=&quot;presentation&quot;&gt;&lt;/div&gt;'
  60. ],
  61. // TODO - do we need to clear sizes in beginLayout?
  62. calculate: function(ownerContext) {
  63. var me = this,
  64. containerSize;
  65. if (!ownerContext.hasDomProp('containerChildrenDone')) {
  66. me.done = false;
  67. } else {
  68. // Once the child layouts are done we can determine the content sizes...
  69. containerSize = me.getContainerSize(ownerContext);
  70. if (!containerSize.gotAll) {
  71. me.done = false;
  72. }
  73. me.calculateContentSize(ownerContext);
  74. }
  75. }
  76. });
  77. </pre>
  78. </body>
  79. </html>