Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1809 lines
76 KiB

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