Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / src / widgets / Panel.js
1 /*!
2  * Ext JS Library 3.0.3
3  * Copyright(c) 2006-2009 Ext JS, LLC
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 /**
8  * @class Ext.Panel
9  * @extends Ext.Container
10  * <p>Panel is a container that has specific functionality and structural components that make
11  * it the perfect building block for application-oriented user interfaces.</p>
12  * <p>Panels are, by virtue of their inheritance from {@link Ext.Container}, capable
13  * of being configured with a {@link Ext.Container#layout layout}, and containing child Components.</p>
14  * <p>When either specifying child {@link Ext.Component#items items} of a Panel, or dynamically {@link Ext.Container#add adding} Components
15  * to a Panel, remember to consider how you wish the Panel to arrange those child elements, and whether
16  * those child elements need to be sized using one of Ext's built-in <code><b>{@link Ext.Container#layout layout}</b></code> schemes. By
17  * default, Panels use the {@link Ext.layout.ContainerLayout ContainerLayout} scheme. This simply renders
18  * child components, appending them one after the other inside the Container, and <b>does not apply any sizing</b>
19  * at all.</p>
20  * <p>A Panel may also contain {@link #bbar bottom} and {@link #tbar top} toolbars, along with separate
21  * {@link #header}, {@link #footer} and {@link #body} sections (see {@link #frame} for additional
22  * information).</p>
23  * <p>Panel also provides built-in {@link #collapsible expandable and collapsible behavior}, along with
24  * a variety of {@link #tools prebuilt tool buttons} that can be wired up to provide other customized
25  * behavior.  Panels can be easily dropped into any {@link Ext.Container Container} or layout, and the
26  * layout and rendering pipeline is {@link Ext.Container#add completely managed by the framework}.</p>
27  * @constructor
28  * @param {Object} config The config object
29  * @xtype panel
30  */
31 Ext.Panel = Ext.extend(Ext.Container, {
32     /**
33      * The Panel's header {@link Ext.Element Element}. Read-only.
34      * <p>This Element is used to house the {@link #title} and {@link #tools}</p>
35      * <br><p><b>Note</b>: see the Note for <code>{@link Ext.Component#el el}</code> also.</p>
36      * @type Ext.Element
37      * @property header
38      */
39     /**
40      * The Panel's body {@link Ext.Element Element} which may be used to contain HTML content.
41      * The content may be specified in the {@link #html} config, or it may be loaded using the
42      * {@link autoLoad} config, or through the Panel's {@link #getUpdater Updater}. Read-only.
43      * <p>If this is used to load visible HTML elements in either way, then
44      * the Panel may not be used as a Layout for hosting nested Panels.</p>
45      * <p>If this Panel is intended to be used as the host of a Layout (See {@link #layout}
46      * then the body Element must not be loaded or changed - it is under the control
47      * of the Panel's Layout.
48      * <br><p><b>Note</b>: see the Note for <code>{@link Ext.Component#el el}</code> also.</p>
49      * @type Ext.Element
50      * @property body
51      */
52     /**
53      * The Panel's bwrap {@link Ext.Element Element} used to contain other Panel elements
54      * (tbar, body, bbar, footer). See {@link #bodyCfg}. Read-only.
55      * @type Ext.Element
56      * @property bwrap
57      */
58     /**
59      * True if this panel is collapsed. Read-only.
60      * @type Boolean
61      * @property collapsed
62      */
63     /**
64      * @cfg {Object} bodyCfg
65      * <p>A {@link Ext.DomHelper DomHelper} element specification object may be specified for any
66      * Panel Element.</p>
67      * <p>By default, the Default element in the table below will be used for the html markup to
68      * create a child element with the commensurate Default class name (<code>baseCls</code> will be
69      * replaced by <code>{@link #baseCls}</code>):</p>
70      * <pre>
71      * Panel      Default  Default             Custom      Additional       Additional
72      * Element    element  class               element     class            style
73      * ========   ==========================   =========   ==============   ===========
74      * {@link #header}     div      {@link #baseCls}+'-header'   {@link #headerCfg}   headerCssClass   headerStyle
75      * {@link #bwrap}      div      {@link #baseCls}+'-bwrap'     {@link #bwrapCfg}    bwrapCssClass    bwrapStyle
76      * + tbar     div      {@link #baseCls}+'-tbar'       {@link #tbarCfg}     tbarCssClass     tbarStyle
77      * + {@link #body}     div      {@link #baseCls}+'-body'       {@link #bodyCfg}     {@link #bodyCssClass}     {@link #bodyStyle}
78      * + bbar     div      {@link #baseCls}+'-bbar'       {@link #bbarCfg}     bbarCssClass     bbarStyle
79      * + {@link #footer}   div      {@link #baseCls}+'-footer'   {@link #footerCfg}   footerCssClass   footerStyle
80      * </pre>
81      * <p>Configuring a Custom element may be used, for example, to force the {@link #body} Element
82      * to use a different form of markup than is created by default. An example of this might be
83      * to {@link Ext.Element#createChild create a child} Panel containing a custom content, such as
84      * a header, or forcing centering of all Panel content by having the body be a &lt;center&gt;
85      * element:</p>
86      * <pre><code>
87 new Ext.Panel({
88     title: 'Message Title',
89     renderTo: Ext.getBody(),
90     width: 200, height: 130,
91     <b>bodyCfg</b>: {
92         tag: 'center',
93         cls: 'x-panel-body',  // Default class not applied if Custom element specified
94         html: 'Message'
95     },
96     footerCfg: {
97         tag: 'h2',
98         cls: 'x-panel-footer'        // same as the Default class
99         html: 'footer html'
100     },
101     footerCssClass: 'custom-footer', // additional css class, see {@link Ext.element#addClass addClass}
102     footerStyle:    'background-color:red' // see {@link #bodyStyle}
103 });
104      * </code></pre>
105      * <p>The example above also explicitly creates a <code>{@link #footer}</code> with custom markup and
106      * styling applied.</p>
107      */
108     /**
109      * @cfg {Object} headerCfg
110      * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
111      * of this Panel's {@link #header} Element.  See <code>{@link #bodyCfg}</code> also.</p>
112      */
113     /**
114      * @cfg {Object} bwrapCfg
115      * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
116      * of this Panel's {@link #bwrap} Element.  See <code>{@link #bodyCfg}</code> also.</p>
117      */
118     /**
119      * @cfg {Object} tbarCfg
120      * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
121      * of this Panel's {@link #tbar} Element.  See <code>{@link #bodyCfg}</code> also.</p>
122      */
123     /**
124      * @cfg {Object} bbarCfg
125      * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
126      * of this Panel's {@link #bbar} Element.  See <code>{@link #bodyCfg}</code> also.</p>
127      */
128     /**
129      * @cfg {Object} footerCfg
130      * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
131      * of this Panel's {@link #footer} Element.  See <code>{@link #bodyCfg}</code> also.</p>
132      */
133     /**
134      * @cfg {Boolean} closable
135      * Panels themselves do not directly support being closed, but some Panel subclasses do (like
136      * {@link Ext.Window}) or a Panel Class within an {@link Ext.TabPanel}.  Specify <code>true</code>
137      * to enable closing in such situations. Defaults to <code>false</code>.
138      */
139     /**
140      * The Panel's footer {@link Ext.Element Element}. Read-only.
141      * <p>This Element is used to house the Panel's <code>{@link #buttons}</code> or <code>{@link #fbar}</code>.</p>
142      * <br><p><b>Note</b>: see the Note for <code>{@link Ext.Component#el el}</code> also.</p>
143      * @type Ext.Element
144      * @property footer
145      */
146     /**
147      * @cfg {Mixed} applyTo
148      * <p>The id of the node, a DOM node or an existing Element corresponding to a DIV that is already present in
149      * the document that specifies some panel-specific structural markup.  When <code>applyTo</code> is used,
150      * constituent parts of the panel can be specified by CSS class name within the main element, and the panel
151      * will automatically create those components from that markup. Any required components not specified in the
152      * markup will be autogenerated if necessary.</p>
153      * <p>The following class names are supported (baseCls will be replaced by {@link #baseCls}):</p>
154      * <ul><li>baseCls + '-header'</li>
155      * <li>baseCls + '-header-text'</li>
156      * <li>baseCls + '-bwrap'</li>
157      * <li>baseCls + '-tbar'</li>
158      * <li>baseCls + '-body'</li>
159      * <li>baseCls + '-bbar'</li>
160      * <li>baseCls + '-footer'</li></ul>
161      * <p>Using this config, a call to render() is not required.  If applyTo is specified, any value passed for
162      * {@link #renderTo} will be ignored and the target element's parent node will automatically be used as the
163      * panel's container.</p>
164      */
165     /**
166      * @cfg {Object/Array} tbar
167      * <p>The top toolbar of the panel. This can be a {@link Ext.Toolbar} object, a toolbar config, or an array of
168      * buttons/button configs to be added to the toolbar.  Note that this is not available as a property after render.
169      * To access the top toolbar after render, use {@link #getTopToolbar}.</p>
170      * <p><b>Note:</b> Although a Toolbar may contain Field components, these will <b>not</b> be updated by a load
171      * of an ancestor FormPanel. A Panel's toolbars are not part of the standard Container->Component hierarchy, and
172      * so are not scanned to collect form items. However, the values <b>will</b> be submitted because form
173      * submission parameters are collected from the DOM tree.</p>
174      */
175     /**
176      * @cfg {Object/Array} bbar
177      * <p>The bottom toolbar of the panel. This can be a {@link Ext.Toolbar} object, a toolbar config, or an array of
178      * buttons/button configs to be added to the toolbar.  Note that this is not available as a property after render.
179      * To access the bottom toolbar after render, use {@link #getBottomToolbar}.</p>
180      * <p><b>Note:</b> Although a Toolbar may contain Field components, these will <b>not</b> be updated by a load
181      * of an ancestor FormPanel. A Panel's toolbars are not part of the standard Container->Component hierarchy, and
182      * so are not scanned to collect form items. However, the values <b>will</b> be submitted because form
183      * submission parameters are collected from the DOM tree.</p>
184      */
185     /** @cfg {Object/Array} fbar
186      * <p>A {@link Ext.Toolbar Toolbar} object, a Toolbar config, or an array of
187      * {@link Ext.Button Button}s/{@link Ext.Button Button} configs, describing a {@link Ext.Toolbar Toolbar} to be rendered into this Panel's footer element.</p>
188      * <p>After render, the <code>fbar</code> property will be an {@link Ext.Toolbar Toolbar} instance.</p>
189      * <p>If <code>{@link #buttons}</code> are specified, they will supersede the <code>fbar</code> configuration property.</p>
190      * The Panel's <code>{@link #buttonAlign}</code> configuration affects the layout of these items, for example:
191      * <pre><code>
192 var w = new Ext.Window({
193     height: 250,
194     width: 500,
195     bbar: new Ext.Toolbar({
196         items: [{
197             text: 'bbar Left'
198         },'->',{
199             text: 'bbar Right'
200         }]
201     }),
202     {@link #buttonAlign}: 'left', // anything but 'center' or 'right' and you can use '-', and '->'
203                                   // to control the alignment of fbar items
204     fbar: [{
205         text: 'fbar Left'
206     },'->',{
207         text: 'fbar Right'
208     }]
209 }).show();
210      * </code></pre>
211      * <p><b>Note:</b> Although a Toolbar may contain Field components, these will <b>not</b> be updated by a load
212      * of an ancestor FormPanel. A Panel's toolbars are not part of the standard Container->Component hierarchy, and
213      * so are not scanned to collect form items. However, the values <b>will</b> be submitted because form
214      * submission parameters are collected from the DOM tree.</p>
215      */
216     /**
217      * @cfg {Boolean} header
218      * <code>true</code> to create the Panel's header element explicitly, <code>false</code> to skip creating
219      * it.  If a <code>{@link #title}</code> is set the header will be created automatically, otherwise it will not.
220      * If a <code>{@link #title}</code> is set but <code>header</code> is explicitly set to <code>false</code>, the header
221      * will not be rendered.
222      */
223     /**
224      * @cfg {Boolean} footer
225      * <code>true</code> to create the footer element explicitly, false to skip creating it. The footer
226      * will be created automatically if <code>{@link #buttons}</code> or a <code>{@link #fbar}</code> have
227      * been configured.  See <code>{@link #bodyCfg}</code> for an example.
228      */
229     /**
230      * @cfg {String} title
231      * The title text to be used as innerHTML (html tags are accepted) to display in the panel
232      * <code>{@link #header}</code> (defaults to ''). When a <code>title</code> is specified the
233      * <code>{@link #header}</code> element will automatically be created and displayed unless
234      * {@link #header} is explicitly set to <code>false</code>.  If you do not want to specify a
235      * <code>title</code> at config time, but you may want one later, you must either specify a non-empty
236      * <code>title</code> (a blank space ' ' will do) or <code>header:true</code> so that the container
237      * element will get created.
238      */
239     /**
240      * @cfg {Array} buttons
241      * <code>buttons</code> will be used as <code>{@link Ext.Container#items items}</code> for the toolbar in
242      * the footer (<code>{@link #fbar}</code>). Typically the value of this configuration property will be
243      * an array of {@link Ext.Button}s or {@link Ext.Button} configuration objects.
244      * If an item is configured with <code>minWidth</code> or the Panel is configured with <code>minButtonWidth</code>,
245      * that width will be applied to the item.
246      */
247     /**
248      * @cfg {Object/String/Function} autoLoad
249      * A valid url spec according to the Updater {@link Ext.Updater#update} method.
250      * If autoLoad is not null, the panel will attempt to load its contents
251      * immediately upon render.<p>
252      * The URL will become the default URL for this panel's {@link #body} element,
253      * so it may be {@link Ext.Element#refresh refresh}ed at any time.</p>
254      */
255     /**
256      * @cfg {Boolean} frame
257      * <code>false</code> by default to render with plain 1px square borders. <code>true</code> to render with
258      * 9 elements, complete with custom rounded corners (also see {@link Ext.Element#boxWrap}).
259      * <p>The template generated for each condition is depicted below:</p><pre><code>
260      *
261 // frame = false
262 &lt;div id="developer-specified-id-goes-here" class="x-panel">
263
264     &lt;div class="x-panel-header">&lt;span class="x-panel-header-text">Title: (frame:false)&lt;/span>&lt;/div>
265
266     &lt;div class="x-panel-bwrap">
267         &lt;div class="x-panel-body">&lt;p>html value goes here&lt;/p>&lt;/div>
268     &lt;/div>
269 &lt;/div>
270
271 // frame = true (create 9 elements)
272 &lt;div id="developer-specified-id-goes-here" class="x-panel">
273     &lt;div class="x-panel-tl">&lt;div class="x-panel-tr">&lt;div class="x-panel-tc">
274         &lt;div class="x-panel-header">&lt;span class="x-panel-header-text">Title: (frame:true)&lt;/span>&lt;/div>
275     &lt;/div>&lt;/div>&lt;/div>
276
277     &lt;div class="x-panel-bwrap">
278         &lt;div class="x-panel-ml">&lt;div class="x-panel-mr">&lt;div class="x-panel-mc">
279             &lt;div class="x-panel-body">&lt;p>html value goes here&lt;/p>&lt;/div>
280         &lt;/div>&lt;/div>&lt;/div>
281
282         &lt;div class="x-panel-bl">&lt;div class="x-panel-br">&lt;div class="x-panel-bc"/>
283         &lt;/div>&lt;/div>&lt;/div>
284 &lt;/div>
285      * </code></pre>
286      */
287     /**
288      * @cfg {Boolean} border
289      * True to display the borders of the panel's body element, false to hide them (defaults to true).  By default,
290      * the border is a 2px wide inset border, but this can be further altered by setting {@link #bodyBorder} to false.
291      */
292     /**
293      * @cfg {Boolean} bodyBorder
294      * True to display an interior border on the body element of the panel, false to hide it (defaults to true).
295      * This only applies when {@link #border} == true.  If border == true and bodyBorder == false, the border will display
296      * as a 1px wide inset border, giving the entire body element an inset appearance.
297      */
298     /**
299      * @cfg {String/Object/Function} bodyCssClass
300      * Additional css class selector to be applied to the {@link #body} element in the format expected by
301      * {@link Ext.Element#addClass} (defaults to null). See {@link #bodyCfg}.
302      */
303     /**
304      * @cfg {String/Object/Function} bodyStyle
305      * Custom CSS styles to be applied to the {@link #body} element in the format expected by
306      * {@link Ext.Element#applyStyles} (defaults to null). See {@link #bodyCfg}.
307      */
308     /**
309      * @cfg {String} iconCls
310      * The CSS class selector that specifies a background image to be used as the header icon (defaults to '').
311      * <p>An example of specifying a custom icon class would be something like:
312      * </p><pre><code>
313 // specify the property in the config for the class:
314      ...
315      iconCls: 'my-icon'
316
317 // css class that specifies background image to be used as the icon image:
318 .my-icon { background-image: url(../images/my-icon.gif) 0 6px no-repeat !important; }
319 </code></pre>
320      */
321     /**
322      * @cfg {Boolean} collapsible
323      * True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into
324      * the header tool button area, false to keep the panel statically sized with no button (defaults to false).
325      */
326     /**
327      * @cfg {Array} tools
328      * An array of tool button configs to be added to the header tool area. When rendered, each tool is
329      * stored as an {@link Ext.Element Element} referenced by a public property called <code><b></b>tools.<i>&lt;tool-type&gt;</i></code>
330      * <p>Each tool config may contain the following properties:
331      * <div class="mdetail-params"><ul>
332      * <li><b>id</b> : String<div class="sub-desc"><b>Required.</b> The type
333      * of tool to create. By default, this assigns a CSS class of the form <code>x-tool-<i>&lt;tool-type&gt;</i></code> to the
334      * resulting tool Element. Ext provides CSS rules, and an icon sprite containing images for the tool types listed below.
335      * The developer may implement custom tools by supplying alternate CSS rules and background images:
336      * <ul>
337      * <div class="x-tool x-tool-toggle" style="float:left; margin-right:5;"> </div><div><code> toggle</code> (Created by default when {@link #collapsible} is <code>true</code>)</div>
338      * <div class="x-tool x-tool-close" style="float:left; margin-right:5;"> </div><div><code> close</code></div>
339      * <div class="x-tool x-tool-minimize" style="float:left; margin-right:5;"> </div><div><code> minimize</code></div>
340      * <div class="x-tool x-tool-maximize" style="float:left; margin-right:5;"> </div><div><code> maximize</code></div>
341      * <div class="x-tool x-tool-restore" style="float:left; margin-right:5;"> </div><div><code> restore</code></div>
342      * <div class="x-tool x-tool-gear" style="float:left; margin-right:5;"> </div><div><code> gear</code></div>
343      * <div class="x-tool x-tool-pin" style="float:left; margin-right:5;"> </div><div><code> pin</code></div>
344      * <div class="x-tool x-tool-unpin" style="float:left; margin-right:5;"> </div><div><code> unpin</code></div>
345      * <div class="x-tool x-tool-right" style="float:left; margin-right:5;"> </div><div><code> right</code></div>
346      * <div class="x-tool x-tool-left" style="float:left; margin-right:5;"> </div><div><code> left</code></div>
347      * <div class="x-tool x-tool-up" style="float:left; margin-right:5;"> </div><div><code> up</code></div>
348      * <div class="x-tool x-tool-down" style="float:left; margin-right:5;"> </div><div><code> down</code></div>
349      * <div class="x-tool x-tool-refresh" style="float:left; margin-right:5;"> </div><div><code> refresh</code></div>
350      * <div class="x-tool x-tool-minus" style="float:left; margin-right:5;"> </div><div><code> minus</code></div>
351      * <div class="x-tool x-tool-plus" style="float:left; margin-right:5;"> </div><div><code> plus</code></div>
352      * <div class="x-tool x-tool-help" style="float:left; margin-right:5;"> </div><div><code> help</code></div>
353      * <div class="x-tool x-tool-search" style="float:left; margin-right:5;"> </div><div><code> search</code></div>
354      * <div class="x-tool x-tool-save" style="float:left; margin-right:5;"> </div><div><code> save</code></div>
355      * <div class="x-tool x-tool-print" style="float:left; margin-right:5;"> </div><div><code> print</code></div>
356      * </ul></div></li>
357      * <li><b>handler</b> : Function<div class="sub-desc"><b>Required.</b> The function to
358      * call when clicked. Arguments passed are:<ul>
359      * <li><b>event</b> : Ext.EventObject<div class="sub-desc">The click event.</div></li>
360      * <li><b>toolEl</b> : Ext.Element<div class="sub-desc">The tool Element.</div></li>
361      * <li><b>panel</b> : Ext.Panel<div class="sub-desc">The host Panel</div></li>
362      * <li><b>tc</b> : Ext.Panel<div class="sub-desc">The tool configuration object</div></li>
363      * </ul></div></li>
364      * <li><b>stopEvent</b> : Boolean<div class="sub-desc">Defaults to true. Specify as false to allow click event to propagate.</div></li>
365      * <li><b>scope</b> : Object<div class="sub-desc">The scope in which to call the handler.</div></li>
366      * <li><b>qtip</b> : String/Object<div class="sub-desc">A tip string, or
367      * a config argument to {@link Ext.QuickTip#register}</div></li>
368      * <li><b>hidden</b> : Boolean<div class="sub-desc">True to initially render hidden.</div></li>
369      * <li><b>on</b> : Object<div class="sub-desc">A listener config object specifiying
370      * event listeners in the format of an argument to {@link #addListener}</div></li>
371      * </ul></div>
372      * <p>Note that, apart from the toggle tool which is provided when a panel is collapsible, these
373      * tools only provide the visual button. Any required functionality must be provided by adding
374      * handlers that implement the necessary behavior.</p>
375      * <p>Example usage:</p>
376      * <pre><code>
377 tools:[{
378     id:'refresh',
379     qtip: 'Refresh form Data',
380     // hidden:true,
381     handler: function(event, toolEl, panel){
382         // refresh logic
383     }
384 },
385 {
386     id:'help',
387     qtip: 'Get Help',
388     handler: function(event, toolEl, panel){
389         // whatever
390     }
391 }]
392 </code></pre>
393      * <p>For the custom id of <code>'help'</code> define two relevant css classes with a link to
394      * a 15x15 image:</p>
395      * <pre><code>
396 .x-tool-help {background-image: url(images/help.png);}
397 .x-tool-help-over {background-image: url(images/help_over.png);}
398 // if using an image sprite:
399 .x-tool-help {background-image: url(images/help.png) no-repeat 0 0;}
400 .x-tool-help-over {background-position:-15px 0;}
401 </code></pre>
402      */
403     /**
404      * @cfg {Ext.Template/Ext.XTemplate} toolTemplate
405      * <p>A Template used to create {@link #tools} in the {@link #header} Element. Defaults to:</p><pre><code>
406 new Ext.Template('&lt;div class="x-tool x-tool-{id}">&amp;#160;&lt;/div>')</code></pre>
407      * <p>This may may be overridden to provide a custom DOM structure for tools based upon a more
408      * complex XTemplate. The template's data is a single tool configuration object (Not the entire Array)
409      * as specified in {@link #tools}.  In the following example an &lt;a> tag is used to provide a
410      * visual indication when hovering over the tool:</p><pre><code>
411 var win = new Ext.Window({
412     tools: [{
413         id: 'download',
414         href: '/MyPdfDoc.pdf'
415     }],
416     toolTemplate: new Ext.XTemplate(
417         '&lt;tpl if="id==\'download\'">',
418             '&lt;a class="x-tool x-tool-pdf" href="{href}">&lt;/a>',
419         '&lt;/tpl>',
420         '&lt;tpl if="id!=\'download\'">',
421             '&lt;div class="x-tool x-tool-{id}">&amp;#160;&lt;/div>',
422         '&lt;/tpl>'
423     ),
424     width:500,
425     height:300,
426     closeAction:'hide'
427 });</code></pre>
428      * <p>Note that the CSS class 'x-tool-pdf' should have an associated style rule which provides an
429      * appropriate background image, something like:</p>
430     <pre><code>
431     a.x-tool-pdf {background-image: url(../shared/extjs/images/pdf.gif)!important;}
432     </code></pre>
433      */
434     /**
435      * @cfg {Boolean} hideCollapseTool
436      * <code>true</code> to hide the expand/collapse toggle button when <code>{@link #collapsible} == true</code>,
437      * <code>false</code> to display it (defaults to <code>false</code>).
438      */
439     /**
440      * @cfg {Boolean} titleCollapse
441      * <code>true</code> to allow expanding and collapsing the panel (when <code>{@link #collapsible} = true</code>)
442      * by clicking anywhere in the header bar, <code>false</code>) to allow it only by clicking to tool button
443      * (defaults to <code>false</code>)). If this panel is a child item of a border layout also see the
444      * {@link Ext.layout.BorderLayout.Region BorderLayout.Region}
445      * <code>{@link Ext.layout.BorderLayout.Region#floatable floatable}</code> config option.
446      */
447     /**
448      * @cfg {Boolean} autoScroll
449      * <code>true</code> to use overflow:'auto' on the panel's body element and show scroll bars automatically when
450      * necessary, <code>false</code> to clip any overflowing content (defaults to <code>false</code>).
451      */
452     /**
453      * @cfg {Mixed} floating
454      * <p>This property is used to configure the underlying {@link Ext.Layer}. Acceptable values for this
455      * configuration property are:</p><div class="mdetail-params"><ul>
456      * <li><b><code>false</code></b> : <b>Default.</b><div class="sub-desc">Display the panel inline where it is
457      * rendered.</div></li>
458      * <li><b><code>true</code></b> : <div class="sub-desc">Float the panel (absolute position it with automatic
459      * shimming and shadow).<ul>
460      * <div class="sub-desc">Setting floating to true will create an Ext.Layer for this panel and display the
461      * panel at negative offsets so that it is hidden.</div>
462      * <div class="sub-desc">Since the panel will be absolute positioned, the position must be set explicitly
463      * <i>after</i> render (e.g., <code>myPanel.setPosition(100,100);</code>).</div>
464      * <div class="sub-desc"><b>Note</b>: when floating a panel you should always assign a fixed width,
465      * otherwise it will be auto width and will expand to fill to the right edge of the viewport.</div>
466      * </ul></div></li>
467      * <li><b><code>{@link Ext.Layer object}</code></b> : <div class="sub-desc">The specified object will be used
468      * as the configuration object for the {@link Ext.Layer} that will be created.</div></li>
469      * </ul></div>
470      */
471     /**
472      * @cfg {Boolean/String} shadow
473      * <code>true</code> (or a valid Ext.Shadow {@link Ext.Shadow#mode} value) to display a shadow behind the
474      * panel, <code>false</code> to display no shadow (defaults to <code>'sides'</code>).  Note that this option
475      * only applies when <code>{@link #floating} = true</code>.
476      */
477     /**
478      * @cfg {Number} shadowOffset
479      * The number of pixels to offset the shadow if displayed (defaults to <code>4</code>). Note that this
480      * option only applies when <code>{@link #floating} = true</code>.
481      */
482     /**
483      * @cfg {Boolean} shim
484      * <code>false</code> to disable the iframe shim in browsers which need one (defaults to <code>true</code>).
485      * Note that this option only applies when <code>{@link #floating} = true</code>.
486      */
487     /**
488      * @cfg {String/Object} html
489      * An HTML fragment, or a {@link Ext.DomHelper DomHelper} specification to use as the panel's body
490      * content (defaults to ''). The HTML content is added by the Panel's {@link #afterRender} method,
491      * and so the document will not contain this HTML at the time the {@link #render} event is fired.
492      * This content is inserted into the body <i>before</i> any configured {@link #contentEl} is appended.
493      */
494     /**
495      * @cfg {String} contentEl
496      * <p>Optional. Specify an existing HTML element, or the <code>id</code> of an existing HTML element to use as this Panel's
497      * <code><b>{@link #body}</b></code> content.</p>
498      * <ul>
499      * <li><b>Description</b> :
500      * <div class="sub-desc">This config option is used to take an existing HTML element and place it in the body
501      * of a new panel (it simply moves the specified DOM element into the body element of the Panel
502      * <i>after the Panel is rendered</i> to use as the content (it is not going to be the actual panel itself).</div></li>
503      * <li><b>Notes</b> :
504      * <div class="sub-desc">The specified HTML element is appended to the Panel's {@link #body} Element by the
505      * Panel's <code>afterRender</code> method <i>after any configured {@link #html HTML} has
506      * been inserted</i>, and so the document will not contain this element at the time the
507      * {@link #render} event is fired.</div>
508      * <div class="sub-desc">The specified HTML element used will not participate in any <code><b>{@link Ext.Container#layout layout}</b></code>
509      * scheme that the Panel may use. It is just HTML. Layouts operate on child <code><b>{@link Ext.Container#items items}</b></code>.</div>
510      * <div class="sub-desc">Add either the <code>x-hidden</code> or the <code>x-hide-display</code> CSS class to
511      * prevent a brief flicker of the content before it is rendered to the panel.</div></li>
512      * </ul>
513      */
514     /**
515      * @cfg {Object/Array} keys
516      * A {@link Ext.KeyMap} config object (in the format expected by {@link Ext.KeyMap#addBinding}
517      * used to assign custom key handling to this panel (defaults to <code>null</code>).
518      */
519     /**
520      * @cfg {Boolean/Object} draggable
521      * <p><code>true</code> to enable dragging of this Panel (defaults to <code>false</code>).</p>
522      * <p>For custom drag/drop implementations, an <b>Ext.Panel.DD</b> config could also be passed
523      * in this config instead of <code>true</code>. Ext.Panel.DD is an internal, undocumented class which
524      * moves a proxy Element around in place of the Panel's element, but provides no other behaviour
525      * during dragging or on drop. It is a subclass of {@link Ext.dd.DragSource}, so behaviour may be
526      * added by implementing the interface methods of {@link Ext.dd.DragDrop} e.g.:
527      * <pre><code>
528 new Ext.Panel({
529     title: 'Drag me',
530     x: 100,
531     y: 100,
532     renderTo: Ext.getBody(),
533     floating: true,
534     frame: true,
535     width: 400,
536     height: 200,
537     draggable: {
538 //      Config option of Ext.Panel.DD class.
539 //      It&#39;s a floating Panel, so do not show a placeholder proxy in the original position.
540         insertProxy: false,
541
542 //      Called for each mousemove event while dragging the DD object.
543         onDrag : function(e){
544 //          Record the x,y position of the drag proxy so that we can
545 //          position the Panel at end of drag.
546             var pel = this.proxy.getEl();
547             this.x = pel.getLeft(true);
548             this.y = pel.getTop(true);
549
550 //          Keep the Shadow aligned if there is one.
551             var s = this.panel.getEl().shadow;
552             if (s) {
553                 s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
554             }
555         },
556
557 //      Called on the mouseup event.
558         endDrag : function(e){
559             this.panel.setPosition(this.x, this.y);
560         }
561     }
562 }).show();
563 </code></pre>
564      */
565     /**
566      * @cfg {Boolean} disabled
567      * Render this panel disabled (default is <code>false</code>). An important note when using the disabled
568      * config on panels is that IE will often fail to initialize the disabled mask element correectly if
569      * the panel's layout has not yet completed by the time the Panel is disabled during the render process.
570      * If you experience this issue, you may need to instead use the {@link #afterlayout} event to initialize
571      * the disabled state:
572      * <pre><code>
573 new Ext.Panel({
574     ...
575     listeners: {
576         'afterlayout': {
577             fn: function(p){
578                 p.disable();
579             },
580             single: true // important, as many layouts can occur
581         }
582     }
583 });
584 </code></pre>
585      */
586     /**
587      * @cfg {Boolean} autoHeight
588      * <code>true</code> to use height:'auto', <code>false</code> to use fixed height (defaults to <code>false</code>).
589      * <b>Note</b>: Setting <code>autoHeight: true</code> means that the browser will manage the panel's height
590      * based on its contents, and that Ext will not manage it at all. If the panel is within a layout that
591      * manages dimensions (<code>fit</code>, <code>border</code>, etc.) then setting <code>autoHeight: true</code>
592      * can cause issues with scrolling and will not generally work as expected since the panel will take
593      * on the height of its contents rather than the height required by the Ext layout.
594      */
595
596
597     /**
598      * @cfg {String} baseCls
599      * The base CSS class to apply to this panel's element (defaults to <code>'x-panel'</code>).
600      * <p>Another option available by default is to specify <code>'x-plain'</code> which strips all styling
601      * except for required attributes for Ext layouts to function (e.g. overflow:hidden).
602      * See <code>{@link #unstyled}</code> also.</p>
603      */
604     baseCls : 'x-panel',
605     /**
606      * @cfg {String} collapsedCls
607      * A CSS class to add to the panel's element after it has been collapsed (defaults to
608      * <code>'x-panel-collapsed'</code>).
609      */
610     collapsedCls : 'x-panel-collapsed',
611     /**
612      * @cfg {Boolean} maskDisabled
613      * <code>true</code> to mask the panel when it is {@link #disabled}, <code>false</code> to not mask it (defaults
614      * to <code>true</code>).  Either way, the panel will always tell its contained elements to disable themselves
615      * when it is disabled, but masking the panel can provide an additional visual cue that the panel is
616      * disabled.
617      */
618     maskDisabled : true,
619     /**
620      * @cfg {Boolean} animCollapse
621      * <code>true</code> to animate the transition when the panel is collapsed, <code>false</code> to skip the
622      * animation (defaults to <code>true</code> if the {@link Ext.Fx} class is available, otherwise <code>false</code>).
623      */
624     animCollapse : Ext.enableFx,
625     /**
626      * @cfg {Boolean} headerAsText
627      * <code>true</code> to display the panel <code>{@link #title}</code> in the <code>{@link #header}</code>,
628      * <code>false</code> to hide it (defaults to <code>true</code>).
629      */
630     headerAsText : true,
631     /**
632      * @cfg {String} buttonAlign
633      * The alignment of any {@link #buttons} added to this panel.  Valid values are <code>'right'</code>,
634      * <code>'left'</code> and <code>'center'</code> (defaults to <code>'right'</code>).
635      */
636     buttonAlign : 'right',
637     /**
638      * @cfg {Boolean} collapsed
639      * <code>true</code> to render the panel collapsed, <code>false</code> to render it expanded (defaults to
640      * <code>false</code>).
641      */
642     collapsed : false,
643     /**
644      * @cfg {Boolean} collapseFirst
645      * <code>true</code> to make sure the collapse/expand toggle button always renders first (to the left of)
646      * any other tools in the panel's title bar, <code>false</code> to render it last (defaults to <code>true</code>).
647      */
648     collapseFirst : true,
649     /**
650      * @cfg {Number} minButtonWidth
651      * Minimum width in pixels of all {@link #buttons} in this panel (defaults to <code>75</code>)
652      */
653     minButtonWidth : 75,
654     /**
655      * @cfg {Boolean} unstyled
656      * Overrides the <code>{@link #baseCls}</code> setting to <code>{@link #baseCls} = 'x-plain'</code> which renders
657      * the panel unstyled except for required attributes for Ext layouts to function (e.g. overflow:hidden).
658      */
659     /**
660      * @cfg {String} elements
661      * A comma-delimited list of panel elements to initialize when the panel is rendered.  Normally, this list will be
662      * generated automatically based on the items added to the panel at config time, but sometimes it might be useful to
663      * make sure a structural element is rendered even if not specified at config time (for example, you may want
664      * to add a button or toolbar dynamically after the panel has been rendered).  Adding those elements to this
665      * list will allocate the required placeholders in the panel when it is rendered.  Valid values are<div class="mdetail-params"><ul>
666      * <li><code>header</code></li>
667      * <li><code>tbar</code> (top bar)</li>
668      * <li><code>body</code></li>
669      * <li><code>bbar</code> (bottom bar)</li>
670      * <li><code>footer</code></li>
671      * </ul></div>
672      * Defaults to '<code>body</code>'.
673      */
674     elements : 'body',
675     /**
676      * @cfg {Boolean} preventBodyReset
677      * Defaults to <code>false</code>.  When set to <code>true</code>, an extra css class <code>'x-panel-normal'</code>
678      * will be added to the panel's element, effectively applying css styles suggested by the W3C
679      * (see http://www.w3.org/TR/CSS21/sample.html) to the Panel's <b>body</b> element (not the header,
680      * footer, etc.).
681      */
682     preventBodyReset : false,
683     
684     /** @cfg {String} resizeEvent
685      * The event to listen to for resizing in layouts. Defaults to <tt>'bodyresize'</tt>.
686      */
687     resizeEvent: 'bodyresize',
688
689     // protected - these could be used to customize the behavior of the window,
690     // but changing them would not be useful without further mofifications and
691     // could lead to unexpected or undesirable results.
692     toolTarget : 'header',
693     collapseEl : 'bwrap',
694     slideAnchor : 't',
695     disabledClass : '',
696
697     // private, notify box this class will handle heights
698     deferHeight : true,
699     // private
700     expandDefaults: {
701         duration : 0.25
702     },
703     // private
704     collapseDefaults : {
705         duration : 0.25
706     },
707
708     // private
709     initComponent : function(){
710         Ext.Panel.superclass.initComponent.call(this);
711
712         this.addEvents(
713             /**
714              * @event bodyresize
715              * Fires after the Panel has been resized.
716              * @param {Ext.Panel} p the Panel which has been resized.
717              * @param {Number} width The Panel's new width.
718              * @param {Number} height The Panel's new height.
719              */
720             'bodyresize',
721             /**
722              * @event titlechange
723              * Fires after the Panel title has been {@link #title set} or {@link #setTitle changed}.
724              * @param {Ext.Panel} p the Panel which has had its title changed.
725              * @param {String} The new title.
726              */
727             'titlechange',
728             /**
729              * @event iconchange
730              * Fires after the Panel icon class has been {@link #iconCls set} or {@link #setIconClass changed}.
731              * @param {Ext.Panel} p the Panel which has had its {@link #iconCls icon class} changed.
732              * @param {String} The new icon class.
733              * @param {String} The old icon class.
734              */
735             'iconchange',
736             /**
737              * @event collapse
738              * Fires after the Panel has been collapsed.
739              * @param {Ext.Panel} p the Panel that has been collapsed.
740              */
741             'collapse',
742             /**
743              * @event expand
744              * Fires after the Panel has been expanded.
745              * @param {Ext.Panel} p The Panel that has been expanded.
746              */
747             'expand',
748             /**
749              * @event beforecollapse
750              * Fires before the Panel is collapsed.  A handler can return false to cancel the collapse.
751              * @param {Ext.Panel} p the Panel being collapsed.
752              * @param {Boolean} animate True if the collapse is animated, else false.
753              */
754             'beforecollapse',
755             /**
756              * @event beforeexpand
757              * Fires before the Panel is expanded.  A handler can return false to cancel the expand.
758              * @param {Ext.Panel} p The Panel being expanded.
759              * @param {Boolean} animate True if the expand is animated, else false.
760              */
761             'beforeexpand',
762             /**
763              * @event beforeclose
764              * Fires before the Panel is closed.  Note that Panels do not directly support being closed, but some
765              * Panel subclasses do (like {@link Ext.Window}) or a Panel within a Ext.TabPanel.  This event only
766              * applies to such subclasses.
767              * A handler can return false to cancel the close.
768              * @param {Ext.Panel} p The Panel being closed.
769              */
770             'beforeclose',
771             /**
772              * @event close
773              * Fires after the Panel is closed.  Note that Panels do not directly support being closed, but some
774              * Panel subclasses do (like {@link Ext.Window}) or a Panel within a Ext.TabPanel.
775              * @param {Ext.Panel} p The Panel that has been closed.
776              */
777             'close',
778             /**
779              * @event activate
780              * Fires after the Panel has been visually activated.
781              * Note that Panels do not directly support being activated, but some Panel subclasses
782              * do (like {@link Ext.Window}). Panels which are child Components of a TabPanel fire the
783              * activate and deactivate events under the control of the TabPanel.
784              * @param {Ext.Panel} p The Panel that has been activated.
785              */
786             'activate',
787             /**
788              * @event deactivate
789              * Fires after the Panel has been visually deactivated.
790              * Note that Panels do not directly support being deactivated, but some Panel subclasses
791              * do (like {@link Ext.Window}). Panels which are child Components of a TabPanel fire the
792              * activate and deactivate events under the control of the TabPanel.
793              * @param {Ext.Panel} p The Panel that has been deactivated.
794              */
795             'deactivate'
796         );
797
798         if(this.unstyled){
799             this.baseCls = 'x-plain';
800         }
801
802         // shortcuts
803         if(this.tbar){
804             this.elements += ',tbar';
805             if(Ext.isObject(this.tbar)){
806                 this.topToolbar = this.tbar;
807             }
808             delete this.tbar;
809         }
810         if(this.bbar){
811             this.elements += ',bbar';
812             if(Ext.isObject(this.bbar)){
813                 this.bottomToolbar = this.bbar;
814             }
815             delete this.bbar;
816         }
817
818         if(this.header === true){
819             this.elements += ',header';
820             delete this.header;
821         }else if(this.headerCfg || (this.title && this.header !== false)){
822             this.elements += ',header';
823         }
824
825         if(this.footerCfg || this.footer === true){
826             this.elements += ',footer';
827             delete this.footer;
828         }
829
830         if(this.buttons){
831             this.elements += ',footer';
832             var btns = this.buttons;
833             /**
834              * This Panel's Array of buttons as created from the <code>{@link #buttons}</code>
835              * config property. Read only.
836              * @type Array
837              * @property buttons
838              */
839             this.buttons = [];
840             Ext.each(btns, function(btn){
841                 if(btn.render){ // button instance
842                     this.buttons.push(btn);
843                 }else if(btn.xtype){
844                     this.buttons.push(Ext.create(btn, 'button'));
845                 }else{
846                     this.addButton(btn);
847                 }
848             }, this);
849         }
850         if(this.fbar){
851             this.elements += ',footer';
852         }
853         if(this.autoLoad){
854             this.on('render', this.doAutoLoad, this, {delay:10});
855         }
856     },
857
858     // private
859     createElement : function(name, pnode){
860         if(this[name]){
861             pnode.appendChild(this[name].dom);
862             return;
863         }
864
865         if(name === 'bwrap' || this.elements.indexOf(name) != -1){
866             if(this[name+'Cfg']){
867                 this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);
868             }else{
869                 var el = document.createElement('div');
870                 el.className = this[name+'Cls'];
871                 this[name] = Ext.get(pnode.appendChild(el));
872             }
873             if(this[name+'CssClass']){
874                 this[name].addClass(this[name+'CssClass']);
875             }
876             if(this[name+'Style']){
877                 this[name].applyStyles(this[name+'Style']);
878             }
879         }
880     },
881
882     // private
883     onRender : function(ct, position){
884         Ext.Panel.superclass.onRender.call(this, ct, position);
885         this.createClasses();
886
887         var el = this.el,
888             d = el.dom,
889             bw,
890             ts;
891             
892             
893         if(this.collapsible && !this.hideCollapseTool){
894             this.tools = this.tools ? this.tools.slice(0) : [];
895             this.tools[this.collapseFirst?'unshift':'push']({
896                 id: 'toggle',
897                 handler : this.toggleCollapse,
898                 scope: this
899             });   
900         }
901         
902         if(this.tools){
903             ts = this.tools;
904             this.elements += (this.header !== false) ? ',header' : '';
905         }
906         this.tools = {};
907             
908         el.addClass(this.baseCls);
909         if(d.firstChild){ // existing markup
910             this.header = el.down('.'+this.headerCls);
911             this.bwrap = el.down('.'+this.bwrapCls);
912             var cp = this.bwrap ? this.bwrap : el;
913             this.tbar = cp.down('.'+this.tbarCls);
914             this.body = cp.down('.'+this.bodyCls);
915             this.bbar = cp.down('.'+this.bbarCls);
916             this.footer = cp.down('.'+this.footerCls);
917             this.fromMarkup = true;
918         }
919         if (this.preventBodyReset === true) {
920             el.addClass('x-panel-reset');
921         }
922         if(this.cls){
923             el.addClass(this.cls);
924         }
925
926         if(this.buttons){
927             this.elements += ',footer';
928         }
929
930         // This block allows for maximum flexibility and performance when using existing markup
931
932         // framing requires special markup
933         if(this.frame){
934             el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));
935
936             this.createElement('header', d.firstChild.firstChild.firstChild);
937             this.createElement('bwrap', d);
938
939             // append the mid and bottom frame to the bwrap
940             bw = this.bwrap.dom;
941             var ml = d.childNodes[1], bl = d.childNodes[2];
942             bw.appendChild(ml);
943             bw.appendChild(bl);
944
945             var mc = bw.firstChild.firstChild.firstChild;
946             this.createElement('tbar', mc);
947             this.createElement('body', mc);
948             this.createElement('bbar', mc);
949             this.createElement('footer', bw.lastChild.firstChild.firstChild);
950
951             if(!this.footer){
952                 this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
953             }
954             /*
955              * Store a reference to this element so:
956              * a) We aren't looking it up all the time
957              * b) The last element is reported incorrectly when using a loadmask
958              */
959             this.ft = Ext.get(this.bwrap.dom.lastChild);
960             this.mc = Ext.get(this.bwrap.dom.firstChild.firstChild.firstChild);
961         }else{
962             this.createElement('header', d);
963             this.createElement('bwrap', d);
964
965             // append the mid and bottom frame to the bwrap
966             bw = this.bwrap.dom;
967             this.createElement('tbar', bw);
968             this.createElement('body', bw);
969             this.createElement('bbar', bw);
970             this.createElement('footer', bw);
971
972             if(!this.header){
973                 this.body.addClass(this.bodyCls + '-noheader');
974                 if(this.tbar){
975                     this.tbar.addClass(this.tbarCls + '-noheader');
976                 }
977             }
978         }
979
980         if(Ext.isDefined(this.padding)){
981             this.body.setStyle('padding', this.body.addUnits(this.padding));
982         }
983
984         if(this.border === false){
985             this.el.addClass(this.baseCls + '-noborder');
986             this.body.addClass(this.bodyCls + '-noborder');
987             if(this.header){
988                 this.header.addClass(this.headerCls + '-noborder');
989             }
990             if(this.footer){
991                 this.footer.addClass(this.footerCls + '-noborder');
992             }
993             if(this.tbar){
994                 this.tbar.addClass(this.tbarCls + '-noborder');
995             }
996             if(this.bbar){
997                 this.bbar.addClass(this.bbarCls + '-noborder');
998             }
999         }
1000
1001         if(this.bodyBorder === false){
1002            this.body.addClass(this.bodyCls + '-noborder');
1003         }
1004
1005         this.bwrap.enableDisplayMode('block');
1006
1007         if(this.header){
1008             this.header.unselectable();
1009
1010             // for tools, we need to wrap any existing header markup
1011             if(this.headerAsText){
1012                 this.header.dom.innerHTML =
1013                     '<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';
1014
1015                 if(this.iconCls){
1016                     this.setIconClass(this.iconCls);
1017                 }
1018             }
1019         }
1020
1021         if(this.floating){
1022             this.makeFloating(this.floating);
1023         }
1024
1025         if(this.collapsible && this.titleCollapse && this.header){
1026             this.mon(this.header, 'click', this.toggleCollapse, this);
1027             this.header.setStyle('cursor', 'pointer');
1028         }
1029         if(ts){
1030             this.addTool.apply(this, ts);
1031         }
1032
1033         if(this.buttons && this.buttons.length > 0){
1034             this.fbar = new Ext.Toolbar({
1035                 items: this.buttons,
1036                 toolbarCls: 'x-panel-fbar'
1037             });
1038         }
1039         this.toolbars = [];
1040         if(this.fbar){
1041             this.fbar = Ext.create(this.fbar, 'toolbar');
1042             this.fbar.enableOverflow = false;
1043             if(this.fbar.items){
1044                 this.fbar.items.each(function(c){
1045                     c.minWidth = c.minWidth || this.minButtonWidth;
1046                 }, this);
1047             }
1048             this.fbar.toolbarCls = 'x-panel-fbar';
1049
1050             var bct = this.footer.createChild({cls: 'x-panel-btns x-panel-btns-'+this.buttonAlign});
1051             this.fbar.ownerCt = this;
1052             this.fbar.render(bct);
1053             bct.createChild({cls:'x-clear'});
1054             this.toolbars.push(this.fbar);
1055         }
1056
1057         if(this.tbar && this.topToolbar){
1058             if(Ext.isArray(this.topToolbar)){
1059                 this.topToolbar = new Ext.Toolbar(this.topToolbar);
1060             }else if(!this.topToolbar.events){
1061                 this.topToolbar = Ext.create(this.topToolbar, 'toolbar');
1062             }
1063             this.topToolbar.ownerCt = this;
1064             this.topToolbar.render(this.tbar);
1065             this.toolbars.push(this.topToolbar);
1066         }
1067         if(this.bbar && this.bottomToolbar){
1068             if(Ext.isArray(this.bottomToolbar)){
1069                 this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);
1070             }else if(!this.bottomToolbar.events){
1071                 this.bottomToolbar = Ext.create(this.bottomToolbar, 'toolbar');
1072             }
1073             this.bottomToolbar.ownerCt = this;
1074             this.bottomToolbar.render(this.bbar);
1075             this.toolbars.push(this.bottomToolbar);
1076         }
1077     },
1078
1079     /**
1080      * Sets the CSS class that provides the icon image for this panel.  This method will replace any existing
1081      * icon class if one has already been set and fire the {@link #iconchange} event after completion.
1082      * @param {String} cls The new CSS class name
1083      */
1084     setIconClass : function(cls){
1085         var old = this.iconCls;
1086         this.iconCls = cls;
1087         if(this.rendered && this.header){
1088             if(this.frame){
1089                 this.header.addClass('x-panel-icon');
1090                 this.header.replaceClass(old, this.iconCls);
1091             }else{
1092                 var hd = this.header,
1093                     img = hd.child('img.x-panel-inline-icon');
1094                 if(img){
1095                     Ext.fly(img).replaceClass(old, this.iconCls);
1096                 }else{
1097                     Ext.DomHelper.insertBefore(hd.dom.firstChild, {
1098                         tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
1099                     });
1100                  }
1101             }
1102         }
1103         this.fireEvent('iconchange', this, cls, old);
1104     },
1105
1106     // private
1107     makeFloating : function(cfg){
1108         this.floating = true;
1109         this.el = new Ext.Layer(
1110             Ext.isObject(cfg) ? cfg : {
1111                 shadow: Ext.isDefined(this.shadow) ? this.shadow : 'sides',
1112                 shadowOffset: this.shadowOffset,
1113                 constrain:false,
1114                 shim: this.shim === false ? false : undefined
1115             }, this.el
1116         );
1117     },
1118
1119     /**
1120      * Returns the {@link Ext.Toolbar toolbar} from the top (<code>{@link #tbar}</code>) section of the panel.
1121      * @return {Ext.Toolbar} The toolbar
1122      */
1123     getTopToolbar : function(){
1124         return this.topToolbar;
1125     },
1126
1127     /**
1128      * Returns the {@link Ext.Toolbar toolbar} from the bottom (<code>{@link #bbar}</code>) section of the panel.
1129      * @return {Ext.Toolbar} The toolbar
1130      */
1131     getBottomToolbar : function(){
1132         return this.bottomToolbar;
1133     },
1134
1135     /**
1136      * Adds a button to this panel.  Note that this method must be called prior to rendering.  The preferred
1137      * approach is to add buttons via the {@link #buttons} config.
1138      * @param {String/Object} config A valid {@link Ext.Button} config.  A string will become the text for a default
1139      * button config, an object will be treated as a button config object.
1140      * @param {Function} handler The function to be called on button {@link Ext.Button#click}
1141      * @param {Object} scope The scope to use for the button handler function
1142      * @return {Ext.Button} The button that was added
1143      */
1144     addButton : function(config, handler, scope){
1145         var bc = {
1146             handler: handler,
1147             scope: scope,
1148             minWidth: this.minButtonWidth,
1149             hideParent:true
1150         };
1151         if(Ext.isString(config)){
1152             bc.text = config;
1153         }else{
1154             Ext.apply(bc, config);
1155         }
1156         var btn = new Ext.Button(bc);
1157         if(!this.buttons){
1158             this.buttons = [];
1159         }
1160         this.buttons.push(btn);
1161         return btn;
1162     },
1163
1164     // private
1165     addTool : function(){
1166         if(!this.rendered){
1167             if(!this.tools){
1168                 this.tools = [];
1169             }
1170             Ext.each(arguments, function(arg){
1171                 this.tools.push(arg)
1172             }, this);
1173             return;
1174         }
1175          // nowhere to render tools!
1176         if(!this[this.toolTarget]){
1177             return;
1178         }
1179         if(!this.toolTemplate){
1180             // initialize the global tool template on first use
1181             var tt = new Ext.Template(
1182                  '<div class="x-tool x-tool-{id}">&#160;</div>'
1183             );
1184             tt.disableFormats = true;
1185             tt.compile();
1186             Ext.Panel.prototype.toolTemplate = tt;
1187         }
1188         for(var i = 0, a = arguments, len = a.length; i < len; i++) {
1189             var tc = a[i];
1190             if(!this.tools[tc.id]){
1191                 var overCls = 'x-tool-'+tc.id+'-over';
1192                 var t = this.toolTemplate.insertFirst((tc.align !== 'left') ? this[this.toolTarget] : this[this.toolTarget].child('span'), tc, true);
1193                 this.tools[tc.id] = t;
1194                 t.enableDisplayMode('block');
1195                 this.mon(t, 'click',  this.createToolHandler(t, tc, overCls, this));
1196                 if(tc.on){
1197                     this.mon(t, tc.on);
1198                 }
1199                 if(tc.hidden){
1200                     t.hide();
1201                 }
1202                 if(tc.qtip){
1203                     if(Ext.isObject(tc.qtip)){
1204                         Ext.QuickTips.register(Ext.apply({
1205                               target: t.id
1206                         }, tc.qtip));
1207                     } else {
1208                         t.dom.qtip = tc.qtip;
1209                     }
1210                 }
1211                 t.addClassOnOver(overCls);
1212             }
1213         }
1214     },
1215
1216     onLayout : function(shallow, force){
1217         if(this.hasLayout && this.toolbars.length > 0){
1218             Ext.each(this.toolbars, function(tb){
1219                 tb.doLayout(undefined, force);
1220             });
1221             this.syncHeight();
1222         }
1223     },
1224
1225     syncHeight : function(){
1226         var h = this.toolbarHeight,
1227                 bd = this.body,
1228                 lsh = this.lastSize.height;
1229                 
1230         if(this.autoHeight || !Ext.isDefined(lsh) || lsh == 'auto'){
1231             return;
1232         }
1233             
1234            
1235         if(h != this.getToolbarHeight()){
1236             h = Math.max(0, this.adjustBodyHeight(lsh - this.getFrameHeight()));
1237             bd.setHeight(h);
1238             sz = bd.getSize();
1239             this.toolbarHeight = this.getToolbarHeight();
1240             this.onBodyResize(sz.width, sz.height);
1241         }
1242     },
1243
1244     // private
1245     onShow : function(){
1246         if(this.floating){
1247             return this.el.show();
1248         }
1249         Ext.Panel.superclass.onShow.call(this);
1250     },
1251
1252     // private
1253     onHide : function(){
1254         if(this.floating){
1255             return this.el.hide();
1256         }
1257         Ext.Panel.superclass.onHide.call(this);
1258     },
1259
1260     // private
1261     createToolHandler : function(t, tc, overCls, panel){
1262         return function(e){
1263             t.removeClass(overCls);
1264             if(tc.stopEvent !== false){
1265                 e.stopEvent();
1266             }
1267             if(tc.handler){
1268                 tc.handler.call(tc.scope || t, e, t, panel, tc);
1269             }
1270         };
1271     },
1272
1273     // private
1274     afterRender : function(){
1275         if(this.floating && !this.hidden){
1276             this.el.show();
1277         }
1278         if(this.title){
1279             this.setTitle(this.title);
1280         }
1281         this.setAutoScroll();
1282         if(this.html){
1283             this.body.update(Ext.isObject(this.html) ?
1284                              Ext.DomHelper.markup(this.html) :
1285                              this.html);
1286             delete this.html;
1287         }
1288         if(this.contentEl){
1289             var ce = Ext.getDom(this.contentEl);
1290             Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
1291             this.body.dom.appendChild(ce);
1292         }
1293         if(this.collapsed){
1294             this.collapsed = false;
1295             this.collapse(false);
1296         }
1297         Ext.Panel.superclass.afterRender.call(this); // do sizing calcs last
1298         this.initEvents();
1299     },
1300
1301     // private
1302     setAutoScroll : function(){
1303         if(this.rendered && this.autoScroll){
1304             var el = this.body || this.el;
1305             if(el){
1306                 el.setOverflow('auto');
1307             }
1308         }
1309     },
1310
1311     // private
1312     getKeyMap : function(){
1313         if(!this.keyMap){
1314             this.keyMap = new Ext.KeyMap(this.el, this.keys);
1315         }
1316         return this.keyMap;
1317     },
1318
1319     // private
1320     initEvents : function(){
1321         if(this.keys){
1322             this.getKeyMap();
1323         }
1324         if(this.draggable){
1325             this.initDraggable();
1326         }
1327         if(this.toolbars.length > 0){
1328             Ext.each(this.toolbars, function(tb){
1329                 tb.doLayout();
1330                 tb.on({
1331                     scope: this,
1332                     afterlayout: this.syncHeight,
1333                     remove: this.syncHeight
1334                 });
1335             }, this);
1336             if(!this.ownerCt){
1337                 this.syncHeight();
1338             }
1339         }
1340     },
1341
1342     // private
1343     initDraggable : function(){
1344         /**
1345          * <p>If this Panel is configured {@link #draggable}, this property will contain
1346          * an instance of {@link Ext.dd.DragSource} which handles dragging the Panel.</p>
1347          * The developer must provide implementations of the abstract methods of {@link Ext.dd.DragSource}
1348          * in order to supply behaviour for each stage of the drag/drop process. See {@link #draggable}.
1349          * @type Ext.dd.DragSource.
1350          * @property dd
1351          */
1352         this.dd = new Ext.Panel.DD(this, Ext.isBoolean(this.draggable) ? null : this.draggable);
1353     },
1354
1355     // private
1356     beforeEffect : function(anim){
1357         if(this.floating){
1358             this.el.beforeAction();
1359         }
1360         if(anim !== false){
1361             this.el.addClass('x-panel-animated');
1362         }
1363     },
1364
1365     // private
1366     afterEffect : function(anim){
1367         this.syncShadow();
1368         if(anim !== false){
1369             this.el.removeClass('x-panel-animated');
1370         }
1371     },
1372
1373     // private - wraps up an animation param with internal callbacks
1374     createEffect : function(a, cb, scope){
1375         var o = {
1376             scope:scope,
1377             block:true
1378         };
1379         if(a === true){
1380             o.callback = cb;
1381             return o;
1382         }else if(!a.callback){
1383             o.callback = cb;
1384         }else { // wrap it up
1385             o.callback = function(){
1386                 cb.call(scope);
1387                 Ext.callback(a.callback, a.scope);
1388             };
1389         }
1390         return Ext.applyIf(o, a);
1391     },
1392
1393     /**
1394      * Collapses the panel body so that it becomes hidden.  Fires the {@link #beforecollapse} event which will
1395      * cancel the collapse action if it returns false.
1396      * @param {Boolean} animate True to animate the transition, else false (defaults to the value of the
1397      * {@link #animCollapse} panel config)
1398      * @return {Ext.Panel} this
1399      */
1400     collapse : function(animate){
1401         if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
1402             return;
1403         }
1404         var doAnim = animate === true || (animate !== false && this.animCollapse);
1405         this.beforeEffect(doAnim);
1406         this.onCollapse(doAnim, animate);
1407         return this;
1408     },
1409
1410     // private
1411     onCollapse : function(doAnim, animArg){
1412         if(doAnim){
1413             this[this.collapseEl].slideOut(this.slideAnchor,
1414                     Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),
1415                         this.collapseDefaults));
1416         }else{
1417             this[this.collapseEl].hide();
1418             this.afterCollapse(false);
1419         }
1420     },
1421
1422     // private
1423     afterCollapse : function(anim){
1424         this.collapsed = true;
1425         this.el.addClass(this.collapsedCls);
1426         this.afterEffect(anim);
1427         this.fireEvent('collapse', this);
1428     },
1429
1430     /**
1431      * Expands the panel body so that it becomes visible.  Fires the {@link #beforeexpand} event which will
1432      * cancel the expand action if it returns false.
1433      * @param {Boolean} animate True to animate the transition, else false (defaults to the value of the
1434      * {@link #animCollapse} panel config)
1435      * @return {Ext.Panel} this
1436      */
1437     expand : function(animate){
1438         if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
1439             return;
1440         }
1441         var doAnim = animate === true || (animate !== false && this.animCollapse);
1442         this.el.removeClass(this.collapsedCls);
1443         this.beforeEffect(doAnim);
1444         this.onExpand(doAnim, animate);
1445         return this;
1446     },
1447
1448     // private
1449     onExpand : function(doAnim, animArg){
1450         if(doAnim){
1451             this[this.collapseEl].slideIn(this.slideAnchor,
1452                     Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),
1453                         this.expandDefaults));
1454         }else{
1455             this[this.collapseEl].show();
1456             this.afterExpand(false);
1457         }
1458     },
1459
1460     // private
1461     afterExpand : function(anim){
1462         this.collapsed = false;
1463         this.afterEffect(anim);
1464         if(Ext.isDefined(this.deferLayout)){
1465             this.doLayout(true);
1466         }
1467         this.fireEvent('expand', this);
1468     },
1469
1470     /**
1471      * Shortcut for performing an {@link #expand} or {@link #collapse} based on the current state of the panel.
1472      * @param {Boolean} animate True to animate the transition, else false (defaults to the value of the
1473      * {@link #animCollapse} panel config)
1474      * @return {Ext.Panel} this
1475      */
1476     toggleCollapse : function(animate){
1477         this[this.collapsed ? 'expand' : 'collapse'](animate);
1478         return this;
1479     },
1480
1481     // private
1482     onDisable : function(){
1483         if(this.rendered && this.maskDisabled){
1484             this.el.mask();
1485         }
1486         Ext.Panel.superclass.onDisable.call(this);
1487     },
1488
1489     // private
1490     onEnable : function(){
1491         if(this.rendered && this.maskDisabled){
1492             this.el.unmask();
1493         }
1494         Ext.Panel.superclass.onEnable.call(this);
1495     },
1496
1497     // private
1498     onResize : function(w, h){
1499         if(Ext.isDefined(w) || Ext.isDefined(h)){
1500             if(!this.collapsed){
1501                 if(Ext.isNumber(w)){
1502                     w = this.adjustBodyWidth(w - this.getFrameWidth());
1503                     if(this.tbar){
1504                         this.tbar.setWidth(w);
1505                         if(this.topToolbar){
1506                             this.topToolbar.setSize(w);
1507                         }
1508                     }
1509                     if(this.bbar){
1510                         this.bbar.setWidth(w);
1511                         if(this.bottomToolbar){
1512                             this.bottomToolbar.setSize(w);
1513                         }
1514                     }
1515                     if(this.fbar){
1516                         var f = this.fbar,
1517                             fWidth = 1,
1518                             strict = Ext.isStrict;
1519                         if(this.buttonAlign == 'left'){
1520                            fWidth = w - f.container.getFrameWidth('lr');
1521                         }else{
1522                             //center/right alignment off in webkit
1523                             if(Ext.isIE || Ext.isWebKit){
1524                                 //center alignment ok on webkit.
1525                                 //right broken in both, center on IE
1526                                 if(!(this.buttonAlign == 'center' && Ext.isWebKit) && (!strict || (!Ext.isIE8 && strict))){
1527                                     (function(){
1528                                         f.setWidth(f.getEl().child('.x-toolbar-ct').getWidth());
1529                                     }).defer(1);
1530                                 }else{
1531                                     fWidth = 'auto';
1532                                 }
1533                             }else{
1534                                 fWidth = 'auto';
1535                             }
1536                         }
1537                         f.setWidth(fWidth);
1538                     }
1539                     this.body.setWidth(w);
1540                 }else if(w == 'auto'){
1541                     this.body.setWidth(w);
1542                 }
1543
1544                 if(Ext.isNumber(h)){
1545                     h = Math.max(0, this.adjustBodyHeight(h - this.getFrameHeight()));
1546                     this.body.setHeight(h);
1547                 }else if(h == 'auto'){
1548                     this.body.setHeight(h);
1549                 }
1550
1551                 if(this.disabled && this.el._mask){
1552                     this.el._mask.setSize(this.el.dom.clientWidth, this.el.getHeight());
1553                 }
1554             }else{
1555                 this.queuedBodySize = {width: w, height: h};
1556                 if(!this.queuedExpand && this.allowQueuedExpand !== false){
1557                     this.queuedExpand = true;
1558                     this.on('expand', function(){
1559                         delete this.queuedExpand;
1560                         this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);
1561                         this.doLayout();
1562                     }, this, {single:true});
1563                 }
1564             }
1565             this.onBodyResize(w, h);
1566         }
1567         this.syncShadow();
1568     },
1569     
1570     // private
1571     onBodyResize: function(w, h){
1572         this.fireEvent('bodyresize', this, w, h);
1573     },
1574     
1575     // private
1576     getToolbarHeight: function(){
1577         var h = 0;
1578         if(this.rendered){
1579             Ext.each(this.toolbars, function(tb){
1580                 h += tb.getHeight();
1581             }, this);
1582         }
1583         return h;
1584     },
1585
1586     // private
1587     adjustBodyHeight : function(h){
1588         return h;
1589     },
1590
1591     // private
1592     adjustBodyWidth : function(w){
1593         return w;
1594     },
1595
1596     // private
1597     onPosition : function(){
1598         this.syncShadow();
1599     },
1600
1601     /**
1602      * Returns the width in pixels of the framing elements of this panel (not including the body width).  To
1603      * retrieve the body width see {@link #getInnerWidth}.
1604      * @return {Number} The frame width
1605      */
1606     getFrameWidth : function(){
1607         var w = this.el.getFrameWidth('lr') + this.bwrap.getFrameWidth('lr');
1608
1609         if(this.frame){
1610             var l = this.bwrap.dom.firstChild;
1611             w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));
1612             w += this.mc.getFrameWidth('lr');
1613         }
1614         return w;
1615     },
1616
1617     /**
1618      * Returns the height in pixels of the framing elements of this panel (including any top and bottom bars and
1619      * header and footer elements, but not including the body height).  To retrieve the body height see {@link #getInnerHeight}.
1620      * @return {Number} The frame height
1621      */
1622     getFrameHeight : function(){
1623         var h  = this.el.getFrameWidth('tb') + this.bwrap.getFrameWidth('tb');
1624         h += (this.tbar ? this.tbar.getHeight() : 0) +
1625              (this.bbar ? this.bbar.getHeight() : 0);
1626
1627         if(this.frame){
1628             h += this.el.dom.firstChild.offsetHeight + this.ft.dom.offsetHeight + this.mc.getFrameWidth('tb');
1629         }else{
1630             h += (this.header ? this.header.getHeight() : 0) +
1631                 (this.footer ? this.footer.getHeight() : 0);
1632         }
1633         return h;
1634     },
1635
1636     /**
1637      * Returns the width in pixels of the body element (not including the width of any framing elements).
1638      * For the frame width see {@link #getFrameWidth}.
1639      * @return {Number} The body width
1640      */
1641     getInnerWidth : function(){
1642         return this.getSize().width - this.getFrameWidth();
1643     },
1644
1645     /**
1646      * Returns the height in pixels of the body element (not including the height of any framing elements).
1647      * For the frame height see {@link #getFrameHeight}.
1648      * @return {Number} The body height
1649      */
1650     getInnerHeight : function(){
1651         return this.getSize().height - this.getFrameHeight();
1652     },
1653
1654     // private
1655     syncShadow : function(){
1656         if(this.floating){
1657             this.el.sync(true);
1658         }
1659     },
1660
1661     // private
1662     getLayoutTarget : function(){
1663         return this.body;
1664     },
1665
1666     /**
1667      * <p>Sets the title text for the panel and optionally the {@link #iconCls icon class}.</p>
1668      * <p>In order to be able to set the title, a header element must have been created
1669      * for the Panel. This is triggered either by configuring the Panel with a non-blank <code>{@link #title}</code>,
1670      * or configuring it with <code><b>{@link #header}: true</b></code>.</p>
1671      * @param {String} title The title text to set
1672      * @param {String} iconCls (optional) {@link #iconCls iconCls} A user-defined CSS class that provides the icon image for this panel
1673      */
1674     setTitle : function(title, iconCls){
1675         this.title = title;
1676         if(this.header && this.headerAsText){
1677             this.header.child('span').update(title);
1678         }
1679         if(iconCls){
1680             this.setIconClass(iconCls);
1681         }
1682         this.fireEvent('titlechange', this, title);
1683         return this;
1684     },
1685
1686     /**
1687      * Get the {@link Ext.Updater} for this panel. Enables you to perform Ajax updates of this panel's body.
1688      * @return {Ext.Updater} The Updater
1689      */
1690     getUpdater : function(){
1691         return this.body.getUpdater();
1692     },
1693
1694      /**
1695      * Loads this content panel immediately with content returned from an XHR call.
1696      * @param {Object/String/Function} config A config object containing any of the following options:
1697 <pre><code>
1698 panel.load({
1699     url: 'your-url.php',
1700     params: {param1: 'foo', param2: 'bar'}, // or a URL encoded string
1701     callback: yourFunction,
1702     scope: yourObject, // optional scope for the callback
1703     discardUrl: false,
1704     nocache: false,
1705     text: 'Loading...',
1706     timeout: 30,
1707     scripts: false
1708 });
1709 </code></pre>
1710      * The only required property is url. The optional properties nocache, text and scripts
1711      * are shorthand for disableCaching, indicatorText and loadScripts and are used to set their
1712      * associated property on this panel Updater instance.
1713      * @return {Ext.Panel} this
1714      */
1715     load : function(){
1716         var um = this.body.getUpdater();
1717         um.update.apply(um, arguments);
1718         return this;
1719     },
1720
1721     // private
1722     beforeDestroy : function(){
1723         if(this.header){
1724             this.header.removeAllListeners();
1725             if(this.headerAsText){
1726                 Ext.Element.uncache(this.header.child('span'));
1727             }
1728         }
1729         Ext.Element.uncache(
1730             this.ft,
1731             this.mc,
1732             this.header,
1733             this.tbar,
1734             this.bbar,
1735             this.footer,
1736             this.body,
1737             this.bwrap
1738         );
1739         if(this.tools){
1740             for(var k in this.tools){
1741                 Ext.destroy(this.tools[k]);
1742             }
1743         }
1744         if(this.buttons){
1745             for(var b in this.buttons){
1746                 Ext.destroy(this.buttons[b]);
1747             }
1748         }
1749         if(this.rendered){
1750             Ext.destroy(this.toolbars);
1751         }else{
1752             Ext.destroy(this.topToolbar, this.bottomToolbar);
1753         }
1754         Ext.Panel.superclass.beforeDestroy.call(this);
1755     },
1756
1757     // private
1758     createClasses : function(){
1759         this.headerCls = this.baseCls + '-header';
1760         this.headerTextCls = this.baseCls + '-header-text';
1761         this.bwrapCls = this.baseCls + '-bwrap';
1762         this.tbarCls = this.baseCls + '-tbar';
1763         this.bodyCls = this.baseCls + '-body';
1764         this.bbarCls = this.baseCls + '-bbar';
1765         this.footerCls = this.baseCls + '-footer';
1766     },
1767
1768     // private
1769     createGhost : function(cls, useShim, appendTo){
1770         var el = document.createElement('div');
1771         el.className = 'x-panel-ghost ' + (cls ? cls : '');
1772         if(this.header){
1773             el.appendChild(this.el.dom.firstChild.cloneNode(true));
1774         }
1775         Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());
1776         el.style.width = this.el.dom.offsetWidth + 'px';;
1777         if(!appendTo){
1778             this.container.dom.appendChild(el);
1779         }else{
1780             Ext.getDom(appendTo).appendChild(el);
1781         }
1782         if(useShim !== false && this.el.useShim !== false){
1783             var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);
1784             layer.show();
1785             return layer;
1786         }else{
1787             return new Ext.Element(el);
1788         }
1789     },
1790
1791     // private
1792     doAutoLoad : function(){
1793         var u = this.body.getUpdater();
1794         if(this.renderer){
1795             u.setRenderer(this.renderer);
1796         }
1797         u.update(Ext.isObject(this.autoLoad) ? this.autoLoad : {url: this.autoLoad});
1798     },
1799
1800     /**
1801      * Retrieve a tool by id.
1802      * @param {String} id
1803      * @return {Object} tool
1804      */
1805     getTool : function(id) {
1806         return this.tools[id];
1807     }
1808
1809 /**
1810  * @cfg {String} autoEl @hide
1811  */
1812 });
1813 Ext.reg('panel', Ext.Panel);