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