Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / Editor2.html
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="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../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-component-Editor'>/**
19 </span> * Component layout for editors
20  * @class Ext.layout.component.Editor
21  * @extends Ext.layout.component.Component
22  * @private
23  */
24 Ext.define('Ext.layout.component.Editor', {
25
26     /* Begin Definitions */
27
28     alias: ['layout.editor'],
29
30     extend: 'Ext.layout.component.Component',
31
32     /* End Definitions */
33
34     onLayout: function(width, height) {
35         var me = this,
36             owner = me.owner,
37             autoSize = owner.autoSize;
38             
39         if (autoSize === true) {
40             autoSize = {
41                 width: 'field',
42                 height: 'field'    
43             };
44         }
45         
46         if (autoSize) {
47             width = me.getDimension(owner, autoSize.width, 'Width', width);
48             height = me.getDimension(owner, autoSize.height, 'Height', height);
49         }
50         me.setTargetSize(width, height);
51         owner.field.setSize(width, height);
52     },
53     
54     getDimension: function(owner, type, dimension, actual){
55         var method = 'get' + dimension;
56         switch (type) {
57             case 'boundEl':
58                 return owner.boundEl[method]();
59             case 'field':
60                 return owner.field[method]();
61             default:
62                 return actual;
63         }
64     }
65 });</pre>
66 </body>
67 </html>