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>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.Panel"></div>/**
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>
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
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>
36 * @param {Object} config The config object
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>
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>
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.
66 <div id="prop-Ext.Panel-collapsed"></div>/**
67 * True if this panel is collapsed. Read-only.
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
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>
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
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 <center>
96 title: 'Message Title',
97 renderTo: Ext.getBody(),
98 width: 200, height: 130,
101 cls: 'x-panel-body', // Default class not applied if Custom element specified
106 cls: 'x-panel-footer' // same as the Default class
109 footerCssClass: 'custom-footer', // additional css class, see {@link Ext.element#addClass addClass}
110 footerStyle: 'background-color:red' // see {@link #bodyStyle}
113 * <p>The example above also explicitly creates a <code>{@link #footer}</code> with custom markup and
114 * styling applied.</p>
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>
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>
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>
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>
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>
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>.
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>
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>
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>
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>
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:
200 var w = new Ext.Window({
203 bbar: new Ext.Toolbar({
210 {@link #buttonAlign}: 'left', // anything but 'center' or 'right' and you can use '-', and '->'
211 // to control the alignment of fbar items
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>
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.
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.
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.
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.
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>
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>
270 <div id="developer-specified-id-goes-here" class="x-panel">
272 <div class="x-panel-header"><span class="x-panel-header-text">Title: (frame:false)</span></div>
274 <div class="x-panel-bwrap">
275 <div class="x-panel-body"><p>html value goes here</p></div>
279 // frame = true (create 9 elements)
280 <div id="developer-specified-id-goes-here" class="x-panel">
281 <div class="x-panel-tl"><div class="x-panel-tr"><div class="x-panel-tc">
282 <div class="x-panel-header"><span class="x-panel-header-text">Title: (frame:true)</span></div>
283 </div></div></div>
285 <div class="x-panel-bwrap">
286 <div class="x-panel-ml"><div class="x-panel-mr"><div class="x-panel-mc">
287 <div class="x-panel-body"><p>html value goes here</p></div>
288 </div></div></div>
290 <div class="x-panel-bl"><div class="x-panel-br"><div class="x-panel-bc"/>
291 </div></div></div>
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.
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.
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}.
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}.
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:
321 // specify the property in the config for the class:
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; }
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).
334 <div id="cfg-Ext.Panel-tools"></div>/**
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><tool-type></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><tool-type></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:
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>
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>
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>
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>
387 qtip: 'Refresh form Data',
389 handler: function(event, toolEl, panel){
396 handler: function(event, toolEl, panel){
401 * <p>For the custom id of <code>'help'</code> define two relevant css classes with a link to
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;}
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('<div class="x-tool x-tool-{id}">&#160;</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 <a> tag is used to provide a
418 * visual indication when hovering over the tool:</p><pre><code>
419 var win = new Ext.Window({
422 href: '/MyPdfDoc.pdf'
424 toolTemplate: new Ext.XTemplate(
425 '<tpl if="id==\'download\'">',
426 '<a class="x-tool x-tool-pdf" href="{href}"></a>',
428 '<tpl if="id!=\'download\'">',
429 '<div class="x-tool x-tool-{id}">&#160;</div>',
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>
439 a.x-tool-pdf {background-image: url(../shared/extjs/images/pdf.gif)!important;}
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>).
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.
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>
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>
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>.
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>.
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>.
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>).
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.:
509 renderTo: Ext.getBody(),
515 // Config option of Ext.Panel.DD class.
516 // It's a floating Panel, so do not show a placeholder proxy in the original position.
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);
527 // Keep the Shadow aligned if there is one.
528 var s = this.panel.getEl().shadow;
530 s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
534 // Called on the mouseup event.
535 endDrag : function(e){
536 this.panel.setPosition(this.x, this.y);
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:
557 single: true // important, as many layouts can occur
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.
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>
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>).
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
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>).
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>).
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>).
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>).
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>).
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>)
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).
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>
649 * Defaults to '<code>body</code>'.
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,
659 preventBodyReset : false,
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>.
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>.
673 resizeEvent: 'bodyresize',
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',
683 // private, notify box this class will handle heights
695 initComponent : function(){
696 Ext.Panel.superclass.initComponent.call(this);
699 <div id="event-Ext.Panel-bodyresize"></div>/**
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.
707 <div id="event-Ext.Panel-titlechange"></div>/**
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.
714 <div id="event-Ext.Panel-iconchange"></div>/**
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.
722 <div id="event-Ext.Panel-collapse"></div>/**
724 * Fires after the Panel has been collapsed.
725 * @param {Ext.Panel} p the Panel that has been collapsed.
728 <div id="event-Ext.Panel-expand"></div>/**
730 * Fires after the Panel has been expanded.
731 * @param {Ext.Panel} p The Panel that has been expanded.
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.
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.
748 <div id="event-Ext.Panel-beforeclose"></div>/**
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.
757 <div id="event-Ext.Panel-close"></div>/**
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.
764 <div id="event-Ext.Panel-activate"></div>/**
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.
773 <div id="event-Ext.Panel-deactivate"></div>/**
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.
785 this.baseCls = 'x-plain';
792 this.elements += ',tbar';
793 this.topToolbar = this.createToolbar(this.tbar);
798 this.elements += ',bbar';
799 this.bottomToolbar = this.createToolbar(this.bbar);
803 if(this.header === true){
804 this.elements += ',header';
806 }else if(this.headerCfg || (this.title && this.header !== false)){
807 this.elements += ',header';
810 if(this.footerCfg || this.footer === true){
811 this.elements += ',footer';
816 this.fbar = this.buttons;
820 this.createFbar(this.fbar);
823 this.on('render', this.doAutoLoad, this, {delay:10});
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){
837 minWidth: c.minWidth || min
841 // @compat addButton and buttons could possibly be removed
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.
849 this.fbar.items.each(function(c){
850 c.minWidth = c.minWidth || this.minButtonWidth;
852 this.buttons = this.fbar.items.items;
856 createToolbar: function(tb, options){
858 // Convert array to proper toolbar config
864 result = tb.events ? Ext.apply(tb, options) : this.createComponent(Ext.apply({}, tb, options), 'toolbar');
865 this.toolbars.push(result);
870 createElement : function(name, pnode){
872 pnode.appendChild(this[name].dom);
876 if(name === 'bwrap' || this.elements.indexOf(name) != -1){
877 if(this[name+'Cfg']){
878 this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);
880 var el = document.createElement('div');
881 el.className = this[name+'Cls'];
882 this[name] = Ext.get(pnode.appendChild(el));
884 if(this[name+'CssClass']){
885 this[name].addClass(this[name+'CssClass']);
887 if(this[name+'Style']){
888 this[name].applyStyles(this[name+'Style']);
894 onRender : function(ct, position){
895 Ext.Panel.superclass.onRender.call(this, ct, position);
896 this.createClasses();
904 if(this.collapsible && !this.hideCollapseTool){
905 this.tools = this.tools ? this.tools.slice(0) : [];
906 this.tools[this.collapseFirst?'unshift':'push']({
908 handler : this.toggleCollapse,
915 this.elements += (this.header !== false) ? ',header' : '';
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;
930 if (this.preventBodyReset === true) {
931 el.addClass('x-panel-reset');
934 el.addClass(this.cls);
938 this.elements += ',footer';
941 // This block allows for maximum flexibility and performance when using existing markup
943 // framing requires special markup
945 el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));
947 this.createElement('header', d.firstChild.firstChild.firstChild);
948 this.createElement('bwrap', d);
950 // append the mid and bottom frame to the bwrap
952 var ml = d.childNodes[1], bl = d.childNodes[2];
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);
963 this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
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
970 this.ft = Ext.get(this.bwrap.dom.lastChild);
971 this.mc = Ext.get(mc);
973 this.createElement('header', d);
974 this.createElement('bwrap', d);
976 // append the mid and bottom frame to the bwrap
978 this.createElement('tbar', bw);
979 this.createElement('body', bw);
980 this.createElement('bbar', bw);
981 this.createElement('footer', bw);
984 this.body.addClass(this.bodyCls + '-noheader');
986 this.tbar.addClass(this.tbarCls + '-noheader');
991 if(Ext.isDefined(this.padding)){
992 this.body.setStyle('padding', this.body.addUnits(this.padding));
995 if(this.border === false){
996 this.el.addClass(this.baseCls + '-noborder');
997 this.body.addClass(this.bodyCls + '-noborder');
999 this.header.addClass(this.headerCls + '-noborder');
1002 this.footer.addClass(this.footerCls + '-noborder');
1005 this.tbar.addClass(this.tbarCls + '-noborder');
1008 this.bbar.addClass(this.bbarCls + '-noborder');
1012 if(this.bodyBorder === false){
1013 this.body.addClass(this.bodyCls + '-noborder');
1016 this.bwrap.enableDisplayMode('block');
1019 this.header.unselectable();
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>';
1027 this.setIconClass(this.iconCls);
1033 this.makeFloating(this.floating);
1036 if(this.collapsible && this.titleCollapse && this.header){
1037 this.mon(this.header, 'click', this.toggleCollapse, this);
1038 this.header.setStyle('cursor', 'pointer');
1041 this.addTool.apply(this, ts);
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'});
1051 if(this.tbar && this.topToolbar){
1052 this.topToolbar.ownerCt = this;
1053 this.topToolbar.render(this.tbar);
1055 if(this.bbar && this.bottomToolbar){
1056 this.bottomToolbar.ownerCt = this;
1057 this.bottomToolbar.render(this.bbar);
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
1066 setIconClass : function(cls){
1067 var old = this.iconCls;
1069 if(this.rendered && this.header){
1071 this.header.addClass('x-panel-icon');
1072 this.header.replaceClass(old, this.iconCls);
1074 var hd = this.header,
1075 img = hd.child('img.x-panel-inline-icon');
1077 Ext.fly(img).replaceClass(old, this.iconCls);
1079 var hdspan = hd.child('span.' + this.headerTextCls);
1081 Ext.DomHelper.insertBefore(hdspan.dom, {
1082 tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
1088 this.fireEvent('iconchange', this, cls, old);
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,
1098 shim: this.shim === false ? false : undefined
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
1106 getTopToolbar : function(){
1107 return this.topToolbar;
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
1114 getBottomToolbar : function(){
1115 return this.bottomToolbar;
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
1122 getFooterToolbar : function() {
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
1135 addButton : function(config, handler, scope){
1137 this.createFbar([]);
1140 if(Ext.isString(config)){
1141 config = {text: config};
1143 config = Ext.apply({
1148 return this.fbar.add(config);
1152 addTool : function(){
1157 Ext.each(arguments, function(arg){
1158 this.tools.push(arg);
1162 // nowhere to render tools!
1163 if(!this[this.toolTarget]){
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}"> </div>'
1171 tt.disableFormats = true;
1173 Ext.Panel.prototype.toolTemplate = tt;
1175 for(var i = 0, a = arguments, len = a.length; i < len; 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));
1190 if(Ext.isObject(tc.qtip)){
1191 Ext.QuickTips.register(Ext.apply({
1195 t.dom.qtip = tc.qtip;
1198 t.addClassOnOver(overCls);
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);
1213 syncHeight : function(){
1214 var h = this.toolbarHeight,
1216 lsh = this.lastSize.height,
1219 if(this.autoHeight || !Ext.isDefined(lsh) || lsh == 'auto'){
1224 if(h != this.getToolbarHeight()){
1225 h = Math.max(0, lsh - this.getFrameHeight());
1228 this.toolbarHeight = this.getToolbarHeight();
1229 this.onBodyResize(sz.width, sz.height);
1234 onShow : function(){
1236 return this.el.show();
1238 Ext.Panel.superclass.onShow.call(this);
1242 onHide : function(){
1244 return this.el.hide();
1246 Ext.Panel.superclass.onHide.call(this);
1250 createToolHandler : function(t, tc, overCls, panel){
1252 t.removeClass(overCls);
1253 if(tc.stopEvent !== false){
1257 tc.handler.call(tc.scope || t, e, t, panel, tc);
1263 afterRender : function(){
1264 if(this.floating && !this.hidden){
1268 this.setTitle(this.title);
1270 Ext.Panel.superclass.afterRender.call(this); // do sizing calcs last
1271 if (this.collapsed) {
1272 this.collapsed = false;
1273 this.collapse(false);
1279 getKeyMap : function(){
1281 this.keyMap = new Ext.KeyMap(this.el, this.keys);
1287 initEvents : function(){
1292 this.initDraggable();
1294 if(this.toolbars.length > 0){
1295 Ext.each(this.toolbars, function(tb){
1299 afterlayout: this.syncHeight,
1300 remove: this.syncHeight
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.
1318 this.dd = new Ext.Panel.DD(this, Ext.isBoolean(this.draggable) ? null : this.draggable);
1322 beforeEffect : function(anim){
1324 this.el.beforeAction();
1327 this.el.addClass('x-panel-animated');
1332 afterEffect : function(anim){
1334 this.el.removeClass('x-panel-animated');
1337 // private - wraps up an animation param with internal callbacks
1338 createEffect : function(a, cb, scope){
1346 }else if(!a.callback){
1348 }else { // wrap it up
1349 o.callback = function(){
1351 Ext.callback(a.callback, a.scope);
1354 return Ext.applyIf(o, a);
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
1364 collapse : function(animate){
1365 if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
1368 var doAnim = animate === true || (animate !== false && this.animCollapse);
1369 this.beforeEffect(doAnim);
1370 this.onCollapse(doAnim, animate);
1375 onCollapse : function(doAnim, animArg){
1377 this[this.collapseEl].slideOut(this.slideAnchor,
1378 Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),
1379 this.collapseDefaults));
1381 this[this.collapseEl].hide(this.hideMode);
1382 this.afterCollapse(false);
1387 afterCollapse : function(anim){
1388 this.collapsed = true;
1389 this.el.addClass(this.collapsedCls);
1391 this[this.collapseEl].hide(this.hideMode);
1393 this.afterEffect(anim);
1395 // Reset lastSize of all sub-components so they KNOW they are in a collapsed container
1396 this.cascade(function(c) {
1398 c.lastSize = { width: 0, height: 0 };
1401 this.fireEvent('collapse', this);
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
1411 expand : function(animate){
1412 if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
1415 var doAnim = animate === true || (animate !== false && this.animCollapse);
1416 this.el.removeClass(this.collapsedCls);
1417 this.beforeEffect(doAnim);
1418 this.onExpand(doAnim, animate);
1423 onExpand : function(doAnim, animArg){
1425 this[this.collapseEl].slideIn(this.slideAnchor,
1426 Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),
1427 this.expandDefaults));
1429 this[this.collapseEl].show(this.hideMode);
1430 this.afterExpand(false);
1435 afterExpand : function(anim){
1436 this.collapsed = false;
1438 this[this.collapseEl].show(this.hideMode);
1440 this.afterEffect(anim);
1441 if (this.deferLayout) {
1442 delete this.deferLayout;
1443 this.doLayout(true);
1445 this.fireEvent('expand', this);
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
1454 toggleCollapse : function(animate){
1455 this[this.collapsed ? 'expand' : 'collapse'](animate);
1460 onDisable : function(){
1461 if(this.rendered && this.maskDisabled){
1464 Ext.Panel.superclass.onDisable.call(this);
1468 onEnable : function(){
1469 if(this.rendered && this.maskDisabled){
1472 Ext.Panel.superclass.onEnable.call(this);
1476 onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){
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.
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;
1491 w = this.body.dom.offsetWidth;
1495 this.tbar.setWidth(w);
1496 if(this.topToolbar){
1497 this.topToolbar.setSize(w);
1501 this.bbar.setWidth(w);
1502 if(this.bottomToolbar){
1503 this.bottomToolbar.setSize(w);
1504 // The bbar does not move on resize without this.
1506 this.bbar.setStyle('position', 'static');
1507 this.bbar.setStyle('position', '');
1512 this.footer.setWidth(w);
1514 this.fbar.setSize(Ext.isIE ? (w - this.footer.getFrameWidth('lr')) : 'auto');
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);
1527 if(this.disabled && this.el._mask){
1528 this.el._mask.setSize(this.el.dom.clientWidth, this.el.getHeight());
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});
1541 this.onBodyResize(w, h);
1544 Ext.Panel.superclass.onResize.call(this, adjWidth, adjHeight, rawWidth, rawHeight);
1549 onBodyResize: function(w, h){
1550 this.fireEvent('bodyresize', this, w, h);
1554 getToolbarHeight: function(){
1557 Ext.each(this.toolbars, function(tb){
1558 h += tb.getHeight();
1565 adjustBodyHeight : function(h){
1570 adjustBodyWidth : function(w){
1575 onPosition : function(){
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
1584 getFrameWidth : function(){
1585 var w = this.el.getFrameWidth('lr') + this.bwrap.getFrameWidth('lr');
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');
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
1600 getFrameHeight : function() {
1601 var h = Math.max(0, this.getHeight() - this.body.getHeight());
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);
1614 h += this.el.dom.firstChild.offsetHeight + this.ft.dom.offsetHeight + this.mc.getFrameWidth('tb');
1616 h += (this.header ? this.header.getHeight() : 0) +
1617 (this.footer ? this.footer.getHeight() : 0);
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
1628 getInnerWidth : function(){
1629 return this.getSize().width - this.getFrameWidth();
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
1637 getInnerHeight : function(){
1638 return this.body.getHeight();
1640 return this.getSize().height - this.getFrameHeight();
1645 syncShadow : function(){
1652 getLayoutTarget : function(){
1657 getContentTarget : function(){
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
1669 setTitle : function(title, iconCls){
1671 if(this.header && this.headerAsText){
1672 this.header.child('span').update(title);
1675 this.setIconClass(iconCls);
1677 this.fireEvent('titlechange', this, title);
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
1685 getUpdater : function(){
1686 return this.body.getUpdater();
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:
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
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
1711 var um = this.body.getUpdater();
1712 um.update.apply(um, arguments);
1717 beforeDestroy : function(){
1718 Ext.Panel.superclass.beforeDestroy.call(this);
1720 this.header.removeAllListeners();
1723 for(var k in this.tools){
1724 Ext.destroy(this.tools[k]);
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);
1733 if(Ext.isArray(this.buttons)){
1734 while(this.buttons.length) {
1735 Ext.destroy(this.buttons[0]);
1765 createClasses : function(){
1766 this.headerCls = this.baseCls + '-header';
1767 this.headerTextCls = this.baseCls + '-header-text';
1768 this.bwrapCls = this.baseCls + '-bwrap';
1769 this.tbarCls = this.baseCls + '-tbar';
1770 this.bodyCls = this.baseCls + '-body';
1771 this.bbarCls = this.baseCls + '-bbar';
1772 this.footerCls = this.baseCls + '-footer';
1776 createGhost : function(cls, useShim, appendTo){
1777 var el = document.createElement('div');
1778 el.className = 'x-panel-ghost ' + (cls ? cls : '');
1780 el.appendChild(this.el.dom.firstChild.cloneNode(true));
1782 Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());
1783 el.style.width = this.el.dom.offsetWidth + 'px';;
1785 this.container.dom.appendChild(el);
1787 Ext.getDom(appendTo).appendChild(el);
1789 if(useShim !== false && this.el.useShim !== false){
1790 var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);
1794 return new Ext.Element(el);
1799 doAutoLoad : function(){
1800 var u = this.body.getUpdater();
1802 u.setRenderer(this.renderer);
1804 u.update(Ext.isObject(this.autoLoad) ? this.autoLoad : {url: this.autoLoad});
1807 <div id="method-Ext.Panel-getTool"></div>/**
1808 * Retrieve a tool by id.
1809 * @param {String} id
1810 * @return {Object} tool
1812 getTool : function(id) {
1813 return this.tools[id];
1816 <div id="cfg-Ext.Panel-autoEl"></div>/**
1817 * @cfg {String} autoEl @hide
1820 Ext.reg('panel', Ext.Panel);