f0b71d0f63fb94a7a6806731b8a201d6ad56cfcf.svn-base 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. /**
  7. * @class Ext.Panel
  8. * @extends Ext.Container Panel is a container that has specific functionality
  9. * and structural components that make it the perfect building block
  10. * for application-oriented user interfaces. The Panel contains bottom
  11. * and top toolbars, along with separate header, footer and body
  12. * sections. It also provides built-in expandable and collapsible
  13. * behavior, along with a variety of prebuilt tool buttons that can be
  14. * wired up to provide other customized behavior. Panels can be easily
  15. * dropped into any Container or layout, and the layout and rendering
  16. * pipeline is completely managed by the framework.
  17. * @constructor
  18. * @param {Object}
  19. * config The config object
  20. */
  21. Ext.Panel = Ext.extend(Ext.Container, {
  22. /**
  23. * The Panel's header {@link Ext.Element Element}. Read-only.
  24. * <p>
  25. * This Element is used to house the {@link #title} and {@link #tools}
  26. * </p>
  27. *
  28. * @type Ext.Element
  29. * @property header
  30. */
  31. /**
  32. * The Panel's body {@link Ext.Element Element} which may be used to contain
  33. * HTML content. The content may be specified in the {@link #html} config,
  34. * or it may be loaded using the {@link autoLoad} config, or through the
  35. * Panel's {@link #getUpdater Updater}. Read-only.
  36. * <p>
  37. * If this is used to load visible HTML elements in either way, then the
  38. * Panel may not be used as a Layout for hosting nested Panels.
  39. * </p>
  40. * <p>
  41. * If this Panel is intended to be used as the host of a Layout (See
  42. * {@link #layout} then the body Element must not be loaded or changed - it
  43. * is under the control of the Panel's Layout.
  44. *
  45. * @type Ext.Element
  46. * @property body
  47. */
  48. /**
  49. * The Panel's footer {@link Ext.Element Element}. Read-only.
  50. * <p>
  51. * This Element is used to house the Panel's {@link #buttons}.
  52. * </p>
  53. *
  54. * @type Ext.Element
  55. * @property footer
  56. */
  57. /**
  58. * @cfg {Mixed} applyTo The id of the node, a DOM node or an existing
  59. * Element corresponding to a DIV that is already present in the
  60. * document that specifies some panel-specific structural markup. When
  61. * applyTo is used, constituent parts of the panel can be specified by
  62. * CSS class name within the main element, and the panel will
  63. * automatically create those components from that markup. Any required
  64. * components not specified in the markup will be autogenerated if
  65. * necessary. The following class names are supported (baseCls will be
  66. * replaced by {@link #baseCls}):
  67. * <ul>
  68. * <li>baseCls + '-header'</li>
  69. * <li>baseCls + '-header-text'</li>
  70. * <li>baseCls + '-bwrap'</li>
  71. * <li>baseCls + '-tbar'</li>
  72. * <li>baseCls + '-body'</li>
  73. * <li>baseCls + '-bbar'</li>
  74. * <li>baseCls + '-footer'</li>
  75. * </ul>
  76. * Using this config, a call to render() is not required. If applyTo is
  77. * specified, any value passed for {@link #renderTo} will be ignored
  78. * and the target element's parent node will automatically be used as
  79. * the panel's container.
  80. */
  81. /**
  82. * @cfg {Object/Array} tbar The top toolbar of the panel. This can be either
  83. * an {@link Ext.Toolbar} object or an array of buttons/button configs
  84. * to be added to the toolbar. Note that this is not available as a
  85. * property after render. To access the top toolbar after render, use
  86. * {@link #getTopToolbar}.
  87. */
  88. /**
  89. * @cfg {Object/Array} bbar The bottom toolbar of the panel. This can be a
  90. * {@link Ext.Toolbar} object, a toolbar config, or an array of
  91. * buttons/button configs to be added to the toolbar. Note that this is
  92. * not available as a property after render. To access the bottom
  93. * toolbar after render, use {@link #getBottomToolbar}.
  94. */
  95. /**
  96. * @cfg {Boolean} header True to create the header element explicitly, false
  97. * to skip creating it. By default, when header is not specified, if a
  98. * {@link #title} is set the header will be created automatically,
  99. * otherwise it will not. If a title is set but header is explicitly
  100. * set to false, the header will not be rendered.
  101. */
  102. /**
  103. * @cfg {Boolean} footer True to create the footer element explicitly, false
  104. * to skip creating it. By default, when footer is not specified, if
  105. * one or more buttons have been added to the panel the footer will be
  106. * created automatically, otherwise it will not.
  107. */
  108. /**
  109. * @cfg {String} title The title text to display in the panel header
  110. * (defaults to ''). When a title is specified the header element will
  111. * automatically be created and displayed unless {@link #header} is
  112. * explicitly set to false. If you don't want to specify a title at
  113. * config time, but you may want one later, you must either specify a
  114. * non-empty title (a blank space ' ' will do) or header:true so that
  115. * the container element will get created.
  116. */
  117. /**
  118. * @cfg {Array} buttons An array of {@link Ext.Button} <b>configs</b> used
  119. * to add buttons to the footer of this panel.
  120. */
  121. /**
  122. * @cfg {Object/String/Function} autoLoad A valid url spec according to the
  123. * Updater {@link Ext.Updater#update} method. If autoLoad is not null,
  124. * the panel will attempt to load its contents immediately upon render.
  125. * <p>
  126. * The URL will become the default URL for this panel's {@link #body}
  127. * element, so it may be {@link Ext.Element#refresh refresh}ed at any
  128. * time.
  129. * </p>
  130. */
  131. /**
  132. * @cfg {Boolean} frame True to render the panel with custom rounded
  133. * borders, false to render with plain 1px square borders (defaults to
  134. * false).
  135. */
  136. /**
  137. * @cfg {Boolean} border True to display the borders of the panel's body
  138. * element, false to hide them (defaults to true). By default, the
  139. * border is a 2px wide inset border, but this can be further altered
  140. * by setting {@link #bodyBorder} to false.
  141. */
  142. /**
  143. * @cfg {Boolean} bodyBorder True to display an interior border on the body
  144. * element of the panel, false to hide it (defaults to true). This only
  145. * applies when {@link #border} == true. If border == true and
  146. * bodyBorder == false, the border will display as a 1px wide inset
  147. * border, giving the entire body element an inset appearance.
  148. */
  149. /**
  150. * @cfg {String/Object/Function} bodyStyle Custom CSS styles to be applied
  151. * to the body element in the format expected by
  152. * {@link Ext.Element#applyStyles} (defaults to null).
  153. */
  154. /**
  155. * @cfg {String} iconCls A CSS class that will provide a background image to
  156. * be used as the panel header icon (defaults to '').
  157. */
  158. /**
  159. * @cfg {Boolean} collapsible True to make the panel collapsible and have
  160. * the expand/collapse toggle button automatically rendered into the
  161. * header tool button area, false to keep the panel statically sized
  162. * with no button (defaults to false).
  163. */
  164. /**
  165. * @cfg {Array} tools An array of tool button configs to be added to the
  166. * header tool area. Each tool config may contain the following
  167. * properties: <div class="mdetail-params">
  168. * <ul>
  169. * <li><b>id</b> : String
  170. * <p class="sub-desc">
  171. * <b>Required.</b> The type of tool to create. Values may be
  172. * <ul>
  173. * <li><tt>toggle</tt> (Created by default when {@link #collapsible}
  174. * is <tt>true</tt>)</li>
  175. * <li><tt>close</tt></li>
  176. * <li><tt>minimize</tt></li>
  177. * <li><tt>maximize</tt></li>
  178. * <li><tt>restore</tt></li>
  179. * <li><tt>gear</tt></li>
  180. * <li><tt>pin</tt></li>
  181. * <li><tt>unpin</tt></li>
  182. * <li><tt>right</tt></li>
  183. * <li><tt>left</tt></li>
  184. * <li><tt>up</tt></li>
  185. * <li><tt>down</tt></li>
  186. * <li><tt>refresh</tt></li>
  187. * <li><tt>minus</tt></li>
  188. * <li><tt>plus</tt></li>
  189. * <li><tt>help</tt></li>
  190. * <li><tt>search</tt></li>
  191. * <li><tt>save</tt></li>
  192. * </ul>
  193. * </div>
  194. * </p>
  195. * </li>
  196. * <li><b>handler</b> : Function
  197. * <p class="sub-desc">
  198. * <b>Required.</b> The function to call when clicked. Arguments
  199. * passed are:
  200. * <ul>
  201. * <li><b>event</b> : Ext.EventObject
  202. * <p class="sub-desc">
  203. * The click event.
  204. * </p>
  205. * </li>
  206. * <li><b>toolEl</b> : Ext.Element
  207. * <p class="sub-desc">
  208. * The tool Element.
  209. * </p>
  210. * </li>
  211. * <li><b>Panel</b> : Ext.Panel
  212. * <p class="sub-desc">
  213. * The host Panel
  214. * </p>
  215. * </li>
  216. * </ul>
  217. * </p>
  218. * </li>
  219. * <li><b>scope</b> : Object
  220. * <p class="sub-desc">
  221. * The scope in which to call the handler.
  222. * </p>
  223. * </li>
  224. * <li><b>qtip</b> : String/Object
  225. * <p class="sub-desc">
  226. * A tip string, or a config argument to {@link Ext.QuickTip#register}
  227. * </p>
  228. * </li>
  229. * <li><b>hidden</b> : Boolean
  230. * <p class="sub-desc">
  231. * True to initially render hidden.
  232. * </p>
  233. * </li>
  234. * <li><b>on</b> : Object
  235. * <p class="sub-desc">
  236. * A listener config object specifiying event listeners in the format
  237. * of an argument to {@link #addListener}
  238. * </p>
  239. * </li>
  240. * </ul>
  241. * Example usage:
  242. *
  243. * <pre><code>
  244. * tools : [{
  245. * id : 'refresh',
  246. * // hidden:true,
  247. * handler : function(event, toolEl, panel) {
  248. * // refresh logic
  249. * }
  250. * }]
  251. * </code></pre>
  252. *
  253. * Note that apart from the toggle tool which is provided when a panel
  254. * is collapsible, these tools only provide the visual button. Any
  255. * required functionality must be provided by adding handlers that
  256. * implement the necessary behavior.
  257. */
  258. /**
  259. * @cfg {Boolean} hideCollapseTool True to hide the expand/collapse toggle
  260. * button when {@link #collapsible} = true, false to display it
  261. * (defaults to false).
  262. */
  263. /**
  264. * @cfg {Boolean} titleCollapse True to allow expanding and collapsing the
  265. * panel (when {@link #collapsible} = true) by clicking anywhere in the
  266. * header bar, false to allow it only by clicking to tool button
  267. * (defaults to false).
  268. */
  269. /**
  270. * @cfg {Boolean} autoScroll True to use overflow:'auto' on the panel's body
  271. * element and show scroll bars automatically when necessary, false to
  272. * clip any overflowing content (defaults to false).
  273. */
  274. /**
  275. * @cfg {Boolean} floating True to float the panel (absolute position it
  276. * with automatic shimming and shadow), false to display it inline
  277. * where it is rendered (defaults to false). Note that by default,
  278. * setting floating to true will cause the panel to display at negative
  279. * offsets so that it is hidden -- because the panel is absolute
  280. * positioned, the position must be set explicitly after render (e.g.,
  281. * myPanel.setPosition(100,100);). Also, when floating a panel you
  282. * should always assign a fixed width, otherwise it will be auto width
  283. * and will expand to fill to the right edge of the viewport.
  284. */
  285. /**
  286. * @cfg {Boolean/String} shadow True (or a valid Ext.Shadow
  287. * {@link Ext.Shadow#mode} value) to display a shadow behind the panel,
  288. * false to display no shadow (defaults to 'sides'). Note that this
  289. * option only applies when floating = true.
  290. */
  291. /**
  292. * @cfg {Number} shadowOffset The number of pixels to offset the shadow if
  293. * displayed (defaults to 4). Note that this option only applies when
  294. * floating = true.
  295. */
  296. /**
  297. * @cfg {Boolean} shim False to disable the iframe shim in browsers which
  298. * need one (defaults to true). Note that this option only applies when
  299. * floating = true.
  300. */
  301. /**
  302. * @cfg {String/Object} html An HTML fragment, or a
  303. * {@link Ext.DomHelper DomHelper} specification to use as the panel's
  304. * body content (defaults to '').
  305. */
  306. /**
  307. * @cfg {String} contentEl The id of an existing HTML node to use as the
  308. * panel's body content (defaults to '').
  309. */
  310. /**
  311. * @cfg {Object/Array} keys A KeyMap config object (in the format expected
  312. * by {@link Ext.KeyMap#addBinding} used to assign custom key handling
  313. * to this panel (defaults to null).
  314. */
  315. /**
  316. * @cfg {Boolean} draggable True to enable dragging of this Panel (defaults
  317. * to false). For custom drag/drop implementations, an Ext.Panel.DD
  318. * config could also be passed in this config instead of true, although
  319. * Ext.Panel.DD is an internal, undocumented class.
  320. */
  321. /**
  322. * @cfg {String} baseCls The base CSS class to apply to this panel's element
  323. * (defaults to 'x-panel').
  324. */
  325. baseCls : 'x-panel',
  326. /**
  327. * @cfg {String} collapsedCls A CSS class to add to the panel's element
  328. * after it has been collapsed (defaults to 'x-panel-collapsed').
  329. */
  330. collapsedCls : 'x-panel-collapsed',
  331. /**
  332. * @cfg {Boolean} maskDisabled True to mask the panel when it is disabled,
  333. * false to not mask it (defaults to true). Either way, the panel will
  334. * always tell its contained elements to disable themselves when it is
  335. * disabled, but masking the panel can provide an additional visual cue
  336. * that the panel is disabled.
  337. */
  338. maskDisabled : true,
  339. /**
  340. * @cfg {Boolean} animCollapse True to animate the transition when the panel
  341. * is collapsed, false to skip the animation (defaults to true if the
  342. * {@link Ext.Fx} class is available, otherwise false).
  343. */
  344. animCollapse : Ext.enableFx,
  345. /**
  346. * @cfg {Boolean} headerAsText True to display the panel title in the
  347. * header, false to hide it (defaults to true).
  348. */
  349. headerAsText : true,
  350. /**
  351. * @cfg {String} buttonAlign The alignment of any buttons added to this
  352. * panel. Valid values are 'right,' 'left' and 'center' (defaults to
  353. * 'right').
  354. */
  355. buttonAlign : 'right',
  356. /**
  357. * @cfg {Boolean} collapsed True to render the panel collapsed, false to
  358. * render it expanded (defaults to false).
  359. */
  360. collapsed : false,
  361. /**
  362. * @cfg {Boolean} collapseFirst True to make sure the collapse/expand toggle
  363. * button always renders first (to the left of) any other tools in the
  364. * panel's title bar, false to render it last (defaults to true).
  365. */
  366. collapseFirst : true,
  367. /**
  368. * @cfg {Number} minButtonWidth Minimum width in pixels of all buttons in
  369. * this panel (defaults to 75)
  370. */
  371. minButtonWidth : 75,
  372. /**
  373. * @cfg {String} elements A comma-delimited list of panel elements to
  374. * initialize when the panel is rendered. Normally, this list will be
  375. * generated automatically based on the items added to the panel at
  376. * config time, but sometimes it might be useful to make sure a
  377. * structural element is rendered even if not specified at config time
  378. * (for example, you may want to add a button or toolbar dynamically
  379. * after the panel has been rendered). Adding those elements to this
  380. * list will allocate the required placeholders in the panel when it is
  381. * rendered. Valid values are
  382. * <ul>
  383. * <li><b>header</b></li>
  384. * <li><b>tbar</b> (top bar)</li>
  385. * <li><b>body</b></li>
  386. * <li><b>bbar</b> (bottom bar)</li>
  387. * <li><b>footer</b>
  388. * <li>
  389. * </ul>
  390. * Defaults to 'body'.
  391. */
  392. elements : 'body',
  393. // protected - these could be used to customize the behavior of the window,
  394. // but changing them would not be useful without further mofifications and
  395. // could lead to unexpected or undesirable results.
  396. toolTarget : 'header',
  397. collapseEl : 'bwrap',
  398. slideAnchor : 't',
  399. // private, notify box this class will handle heights
  400. deferHeight : true,
  401. // private
  402. expandDefaults : {
  403. duration : .25
  404. },
  405. // private
  406. collapseDefaults : {
  407. duration : .25
  408. },
  409. // private
  410. initComponent : function() {
  411. Ext.Panel.superclass.initComponent.call(this);
  412. this.addEvents(
  413. /**
  414. * @event bodyresize Fires after the Panel has been resized.
  415. * @param {Ext.Panel}
  416. * p the Panel which has been resized.
  417. * @param {Number}
  418. * width The Panel's new width.
  419. * @param {Number}
  420. * height The Panel's new height.
  421. */
  422. 'bodyresize',
  423. /**
  424. * @event titlechange Fires after the Panel title has been set
  425. * or changed.
  426. * @param {Ext.Panel}
  427. * p the Panel which has had its title changed.
  428. * @param {String}
  429. * The new title.
  430. */
  431. 'titlechange',
  432. /**
  433. * @event collapse Fires after the Panel has been collapsed.
  434. * @param {Ext.Panel}
  435. * p the Panel that has been collapsed.
  436. */
  437. 'collapse',
  438. /**
  439. * @event expand Fires after the Panel has been expanded.
  440. * @param {Ext.Panel}
  441. * p The Panel that has been expanded.
  442. */
  443. 'expand',
  444. /**
  445. * @event beforecollapse Fires before the Panel is collapsed. A
  446. * handler can return false to cancel the collapse.
  447. * @param {Ext.Panel}
  448. * p the Panel being collapsed.
  449. * @param {Boolean}
  450. * animate True if the collapse is animated, else
  451. * false.
  452. */
  453. 'beforecollapse',
  454. /**
  455. * @event beforeexpand Fires before the Panel is expanded. A
  456. * handler can return false to cancel the expand.
  457. * @param {Ext.Panel}
  458. * p The Panel being expanded.
  459. * @param {Boolean}
  460. * animate True if the expand is animated, else
  461. * false.
  462. */
  463. 'beforeexpand',
  464. /**
  465. * @event beforeclose Fires before the Panel is closed. Note
  466. * that Panels do not directly support being closed, but
  467. * some Panel subclasses do (like {@link Ext.Window}).
  468. * This event only applies to such subclasses. A handler
  469. * can return false to cancel the close.
  470. * @param {Ext.Panel}
  471. * p The Panel being closed.
  472. */
  473. 'beforeclose',
  474. /**
  475. * @event close Fires after the Panel is closed. Note that
  476. * Panels do not directly support being closed, but some
  477. * Panel subclasses do (like {@link Ext.Window}).
  478. * @param {Ext.Panel}
  479. * p The Panel that has been closed.
  480. */
  481. 'close',
  482. /**
  483. * @event activate Fires after the Panel has been visually
  484. * activated. Note that Panels do not directly support
  485. * being activated, but some Panel subclasses do (like
  486. * {@link Ext.Window}). Panels which are child
  487. * Components of a TabPanel fire the activate and
  488. * deactivate events under the control of the TabPanel.
  489. * @param {Ext.Panel}
  490. * p The Panel that has been activated.
  491. */
  492. 'activate',
  493. /**
  494. * @event deactivate Fires after the Panel has been visually
  495. * deactivated. Note that Panels do not directly support
  496. * being deactivated, but some Panel subclasses do (like
  497. * {@link Ext.Window}). Panels which are child
  498. * Components of a TabPanel fire the activate and
  499. * deactivate events under the control of the TabPanel.
  500. * @param {Ext.Panel}
  501. * p The Panel that has been deactivated.
  502. */
  503. 'deactivate');
  504. // shortcuts
  505. if (this.tbar) {
  506. this.elements += ',tbar';
  507. if (typeof this.tbar == 'object') {
  508. this.topToolbar = this.tbar;
  509. }
  510. delete this.tbar;
  511. }
  512. if (this.bbar) {
  513. this.elements += ',bbar';
  514. if (typeof this.bbar == 'object') {
  515. this.bottomToolbar = this.bbar;
  516. }
  517. delete this.bbar;
  518. }
  519. if (this.header === true) {
  520. this.elements += ',header';
  521. delete this.header;
  522. } else if (this.title && this.header !== false) {
  523. this.elements += ',header';
  524. }
  525. if (this.footer === true) {
  526. this.elements += ',footer';
  527. delete this.footer;
  528. }
  529. if (this.buttons) {
  530. var btns = this.buttons;
  531. /**
  532. * This Panel's Array of buttons as created from the
  533. * <tt>buttons</tt> config property. Read only.
  534. *
  535. * @type Array
  536. * @property buttons
  537. */
  538. this.buttons = [];
  539. for (var i = 0, len = btns.length; i < len; i++) {
  540. if (btns[i].render) { // button instance
  541. this.buttons.push(btns[i]);
  542. } else {
  543. this.addButton(btns[i]);
  544. }
  545. }
  546. }
  547. if (this.autoLoad) {
  548. this.on('render', this.doAutoLoad, this, {
  549. delay : 10
  550. });
  551. }
  552. },
  553. // private
  554. createElement : function(name, pnode) {
  555. if (this[name]) {
  556. pnode.appendChild(this[name].dom);
  557. return;
  558. }
  559. if (name === 'bwrap' || this.elements.indexOf(name) != -1) {
  560. if (this[name + 'Cfg']) {
  561. this[name] = Ext.fly(pnode).createChild(this[name + 'Cfg']);
  562. } else {
  563. var el = document.createElement('div');
  564. el.className = this[name + 'Cls'];
  565. this[name] = Ext.get(pnode.appendChild(el));
  566. }
  567. }
  568. },
  569. // private
  570. onRender : function(ct, position) {
  571. Ext.Panel.superclass.onRender.call(this, ct, position);
  572. this.createClasses();
  573. if (this.el) { // existing markup
  574. this.el.addClass(this.baseCls);
  575. this.header = this.el.down('.' + this.headerCls);
  576. this.bwrap = this.el.down('.' + this.bwrapCls);
  577. var cp = this.bwrap ? this.bwrap : this.el;
  578. this.tbar = cp.down('.' + this.tbarCls);
  579. this.body = cp.down('.' + this.bodyCls);
  580. this.bbar = cp.down('.' + this.bbarCls);
  581. this.footer = cp.down('.' + this.footerCls);
  582. this.fromMarkup = true;
  583. } else {
  584. this.el = ct.createChild({
  585. id : this.id,
  586. cls : this.baseCls
  587. }, position);
  588. }
  589. var el = this.el, d = el.dom;
  590. if (this.cls) {
  591. this.el.addClass(this.cls);
  592. }
  593. if (this.buttons) {
  594. this.elements += ',footer';
  595. }
  596. // This block allows for maximum flexibility and performance when using
  597. // existing markup
  598. // framing requires special markup
  599. if (this.frame) {
  600. el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup,
  601. this.baseCls));
  602. this.createElement('header', d.firstChild.firstChild.firstChild);
  603. this.createElement('bwrap', d);
  604. // append the mid and bottom frame to the bwrap
  605. var bw = this.bwrap.dom;
  606. var ml = d.childNodes[1], bl = d.childNodes[2];
  607. bw.appendChild(ml);
  608. bw.appendChild(bl);
  609. var mc = bw.firstChild.firstChild.firstChild;
  610. this.createElement('tbar', mc);
  611. this.createElement('body', mc);
  612. this.createElement('bbar', mc);
  613. this.createElement('footer', bw.lastChild.firstChild.firstChild);
  614. if (!this.footer) {
  615. this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
  616. }
  617. } else {
  618. this.createElement('header', d);
  619. this.createElement('bwrap', d);
  620. // append the mid and bottom frame to the bwrap
  621. var bw = this.bwrap.dom;
  622. this.createElement('tbar', bw);
  623. this.createElement('body', bw);
  624. this.createElement('bbar', bw);
  625. this.createElement('footer', bw);
  626. if (!this.header) {
  627. this.body.addClass(this.bodyCls + '-noheader');
  628. if (this.tbar) {
  629. this.tbar.addClass(this.tbarCls + '-noheader');
  630. }
  631. }
  632. }
  633. if (this.border === false) {
  634. this.el.addClass(this.baseCls + '-noborder');
  635. this.body.addClass(this.bodyCls + '-noborder');
  636. if (this.header) {
  637. this.header.addClass(this.headerCls + '-noborder');
  638. }
  639. if (this.footer) {
  640. this.footer.addClass(this.footerCls + '-noborder');
  641. }
  642. if (this.tbar) {
  643. this.tbar.addClass(this.tbarCls + '-noborder');
  644. }
  645. if (this.bbar) {
  646. this.bbar.addClass(this.bbarCls + '-noborder');
  647. }
  648. }
  649. if (this.bodyBorder === false) {
  650. this.body.addClass(this.bodyCls + '-noborder');
  651. }
  652. if (this.bodyStyle) {
  653. this.body.applyStyles(this.bodyStyle);
  654. }
  655. this.bwrap.enableDisplayMode('block');
  656. if (this.header) {
  657. this.header.unselectable();
  658. // for tools, we need to wrap any existing header markup
  659. if (this.headerAsText) {
  660. this.header.dom.innerHTML = '<span class="'
  661. + this.headerTextCls + '">' + this.header.dom.innerHTML
  662. + '</span>';
  663. if (this.iconCls) {
  664. this.setIconClass(this.iconCls);
  665. }
  666. }
  667. }
  668. if (this.floating) {
  669. this.makeFloating(this.floating);
  670. }
  671. if (this.collapsible) {
  672. this.tools = this.tools ? this.tools.slice(0) : [];
  673. if (!this.hideCollapseTool) {
  674. this.tools[this.collapseFirst ? 'unshift' : 'push']({
  675. id : 'toggle',
  676. handler : this.toggleCollapse,
  677. scope : this
  678. });
  679. }
  680. if (this.titleCollapse && this.header) {
  681. this.header.on('click', this.toggleCollapse, this);
  682. this.header.setStyle('cursor', 'pointer');
  683. }
  684. }
  685. if (this.tools) {
  686. var ts = this.tools;
  687. this.tools = {};
  688. this.addTool.apply(this, ts);
  689. } else {
  690. this.tools = {};
  691. }
  692. if (this.buttons && this.buttons.length > 0) {
  693. // tables are required to maintain order and for correct IE layout
  694. var tb = this.footer.createChild({
  695. cls : 'x-panel-btns-ct',
  696. cn : {
  697. cls : "x-panel-btns x-panel-btns-" + this.buttonAlign,
  698. html : '<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'
  699. }
  700. }, null, true);
  701. var tr = tb.getElementsByTagName('tr')[0];
  702. for (var i = 0, len = this.buttons.length; i < len; i++) {
  703. var b = this.buttons[i];
  704. var td = document.createElement('td');
  705. td.className = 'x-panel-btn-td';
  706. b.render(tr.appendChild(td));
  707. }
  708. }
  709. if (this.tbar && this.topToolbar) {
  710. if (this.topToolbar instanceof Array) {
  711. this.topToolbar = new Ext.Toolbar(this.topToolbar);
  712. }
  713. this.topToolbar.render(this.tbar);
  714. }
  715. if (this.bbar && this.bottomToolbar) {
  716. if (this.bottomToolbar instanceof Array) {
  717. this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);
  718. }
  719. this.bottomToolbar.render(this.bbar);
  720. }
  721. },
  722. /**
  723. * Sets the CSS class that provides the icon image for this panel. This
  724. * method will replace any existing icon class if one has already been set.
  725. *
  726. * @param {String}
  727. * cls The new CSS class name
  728. */
  729. setIconClass : function(cls) {
  730. var old = this.iconCls;
  731. this.iconCls = cls;
  732. if (this.rendered) {
  733. if (this.frame) {
  734. this.header.addClass('x-panel-icon');
  735. this.header.replaceClass(old, this.iconCls);
  736. } else {
  737. var hd = this.header.dom;
  738. var img = hd.firstChild
  739. && String(hd.firstChild.tagName).toLowerCase() == 'img'
  740. ? hd.firstChild
  741. : null;
  742. if (img) {
  743. Ext.fly(img).replaceClass(old, this.iconCls);
  744. } else {
  745. Ext.DomHelper.insertBefore(hd.firstChild, {
  746. tag : 'img',
  747. src : Ext.BLANK_IMAGE_URL,
  748. cls : 'x-panel-inline-icon ' + this.iconCls
  749. });
  750. }
  751. }
  752. }
  753. },
  754. // private
  755. makeFloating : function(cfg) {
  756. this.floating = true;
  757. this.el = new Ext.Layer(typeof cfg == 'object' ? cfg : {
  758. shadow : this.shadow !== undefined ? this.shadow : 'sides',
  759. shadowOffset : this.shadowOffset,
  760. constrain : false,
  761. shim : this.shim === false ? false : undefined
  762. }, this.el);
  763. },
  764. /**
  765. * Returns the toolbar from the top (tbar) section of the panel.
  766. *
  767. * @return {Ext.Toolbar} The toolbar
  768. */
  769. getTopToolbar : function() {
  770. return this.topToolbar;
  771. },
  772. /**
  773. * Returns the toolbar from the bottom (bbar) section of the panel.
  774. *
  775. * @return {Ext.Toolbar} The toolbar
  776. */
  777. getBottomToolbar : function() {
  778. return this.bottomToolbar;
  779. },
  780. /**
  781. * Adds a button to this panel. Note that this method must be called prior
  782. * to rendering. The preferred approach is to add buttons via the
  783. * {@link #buttons} config.
  784. *
  785. * @param {String/Object}
  786. * config A valid {@link Ext.Button} config. A string will become
  787. * the text for a default button config, an object will be
  788. * treated as a button config object.
  789. * @param {Function}
  790. * handler The function to be called on button
  791. * {@link Ext.Button#click}
  792. * @param {Object}
  793. * scope The scope to use for the button handler function
  794. * @return {Ext.Button} The button that was added
  795. */
  796. addButton : function(config, handler, scope) {
  797. var bc = {
  798. handler : handler,
  799. scope : scope,
  800. minWidth : this.minButtonWidth,
  801. hideParent : true
  802. };
  803. if (typeof config == "string") {
  804. bc.text = config;
  805. } else {
  806. Ext.apply(bc, config);
  807. }
  808. var btn = new Ext.Button(bc);
  809. if (!this.buttons) {
  810. this.buttons = [];
  811. }
  812. this.buttons.push(btn);
  813. return btn;
  814. },
  815. // private
  816. addTool : function() {
  817. if (!this[this.toolTarget]) { // no where to render tools!
  818. return;
  819. }
  820. if (!this.toolTemplate) {
  821. // initialize the global tool template on first use
  822. var tt = new Ext.Template('<div class="x-tool x-tool-{id}">&#160;</div>');
  823. tt.disableFormats = true;
  824. tt.compile();
  825. Ext.Panel.prototype.toolTemplate = tt;
  826. }
  827. for (var i = 0, a = arguments, len = a.length; i < len; i++) {
  828. var tc = a[i], overCls = 'x-tool-' + tc.id + '-over';
  829. var t = this.toolTemplate.insertFirst(this[this.toolTarget], tc,
  830. true);
  831. this.tools[tc.id] = t;
  832. t.enableDisplayMode('block');
  833. t.on('click', this.createToolHandler(t, tc, overCls, this));
  834. if (tc.on) {
  835. t.on(tc.on);
  836. }
  837. if (tc.hidden) {
  838. t.hide();
  839. }
  840. if (tc.qtip) {
  841. if (typeof tc.qtip == 'object') {
  842. Ext.QuickTips.register(Ext.apply({
  843. target : t.id
  844. }, tc.qtip));
  845. } else {
  846. t.dom.qtip = tc.qtip;
  847. }
  848. }
  849. t.addClassOnOver(overCls);
  850. }
  851. },
  852. // private
  853. onShow : function() {
  854. if (this.floating) {
  855. return this.el.show();
  856. }
  857. Ext.Panel.superclass.onShow.call(this);
  858. },
  859. // private
  860. onHide : function() {
  861. if (this.floating) {
  862. return this.el.hide();
  863. }
  864. Ext.Panel.superclass.onHide.call(this);
  865. },
  866. // private
  867. createToolHandler : function(t, tc, overCls, panel) {
  868. return function(e) {
  869. t.removeClass(overCls);
  870. e.stopEvent();
  871. if (tc.handler) {
  872. tc.handler.call(tc.scope || t, e, t, panel);
  873. }
  874. };
  875. },
  876. // private
  877. afterRender : function() {
  878. if (this.fromMarkup && this.height === undefined && !this.autoHeight) {
  879. this.height = this.el.getHeight();
  880. }
  881. if (this.floating && !this.hidden && !this.initHidden) {
  882. this.el.show();
  883. }
  884. if (this.title) {
  885. this.setTitle(this.title);
  886. }
  887. if (this.autoScroll) {
  888. this.body.dom.style.overflow = 'auto';
  889. }
  890. if (this.html) {
  891. this.body.update(typeof this.html == 'object' ? Ext.DomHelper
  892. .markup(this.html) : this.html);
  893. delete this.html;
  894. }
  895. if (this.contentEl) {
  896. var ce = Ext.getDom(this.contentEl);
  897. Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
  898. this.body.dom.appendChild(ce);
  899. }
  900. if (this.collapsed) {
  901. this.collapsed = false;
  902. this.collapse(false);
  903. }
  904. Ext.Panel.superclass.afterRender.call(this); // do sizing calcs last
  905. this.initEvents();
  906. },
  907. // private
  908. getKeyMap : function() {
  909. if (!this.keyMap) {
  910. this.keyMap = new Ext.KeyMap(this.el, this.keys);
  911. }
  912. return this.keyMap;
  913. },
  914. // private
  915. initEvents : function() {
  916. if (this.keys) {
  917. this.getKeyMap();
  918. }
  919. if (this.draggable) {
  920. this.initDraggable();
  921. }
  922. },
  923. // private
  924. initDraggable : function() {
  925. this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean'
  926. ? null
  927. : this.draggable);
  928. },
  929. // private
  930. beforeEffect : function() {
  931. if (this.floating) {
  932. this.el.beforeAction();
  933. }
  934. this.el.addClass('x-panel-animated');
  935. },
  936. // private
  937. afterEffect : function() {
  938. this.syncShadow();
  939. this.el.removeClass('x-panel-animated');
  940. },
  941. // private - wraps up an animation param with internal callbacks
  942. createEffect : function(a, cb, scope) {
  943. var o = {
  944. scope : scope,
  945. block : true
  946. };
  947. if (a === true) {
  948. o.callback = cb;
  949. return o;
  950. } else if (!a.callback) {
  951. o.callback = cb;
  952. } else { // wrap it up
  953. o.callback = function() {
  954. cb.call(scope);
  955. Ext.callback(a.callback, a.scope);
  956. };
  957. }
  958. return Ext.applyIf(o, a);
  959. },
  960. /**
  961. * Collapses the panel body so that it becomes hidden. Fires the
  962. * {@link #beforecollapse} event which will cancel the collapse action if it
  963. * returns false.
  964. *
  965. * @param {Boolean}
  966. * animate True to animate the transition, else false (defaults
  967. * to the value of the {@link #animCollapse} panel config)
  968. * @return {Ext.Panel} this
  969. */
  970. collapse : function(animate) {
  971. if (this.collapsed || this.el.hasFxBlock()
  972. || this.fireEvent('beforecollapse', this, animate) === false) {
  973. return;
  974. }
  975. var doAnim = animate === true
  976. || (animate !== false && this.animCollapse);
  977. this.beforeEffect();
  978. this.onCollapse(doAnim, animate);
  979. return this;
  980. },
  981. // private
  982. onCollapse : function(doAnim, animArg) {
  983. if (doAnim) {
  984. this[this.collapseEl].slideOut(this.slideAnchor, Ext.apply(this
  985. .createEffect(animArg || true,
  986. this.afterCollapse, this),
  987. this.collapseDefaults));
  988. } else {
  989. this[this.collapseEl].hide();
  990. this.afterCollapse();
  991. }
  992. },
  993. // private
  994. afterCollapse : function() {
  995. this.collapsed = true;
  996. this.el.addClass(this.collapsedCls);
  997. this.afterEffect();
  998. this.fireEvent('collapse', this);
  999. },
  1000. /**
  1001. * Expands the panel body so that it becomes visible. Fires the
  1002. * {@link #beforeexpand} event which will cancel the expand action if it
  1003. * returns false.
  1004. *
  1005. * @param {Boolean}
  1006. * animate True to animate the transition, else false (defaults
  1007. * to the value of the {@link #animCollapse} panel config)
  1008. * @return {Ext.Panel} this
  1009. */
  1010. expand : function(animate) {
  1011. if (!this.collapsed || this.el.hasFxBlock()
  1012. || this.fireEvent('beforeexpand', this, animate) === false) {
  1013. return;
  1014. }
  1015. var doAnim = animate === true
  1016. || (animate !== false && this.animCollapse);
  1017. this.el.removeClass(this.collapsedCls);
  1018. this.beforeEffect();
  1019. this.onExpand(doAnim, animate);
  1020. return this;
  1021. },
  1022. // private
  1023. onExpand : function(doAnim, animArg) {
  1024. if (doAnim) {
  1025. this[this.collapseEl].slideIn(this.slideAnchor, Ext.apply(this
  1026. .createEffect(animArg || true,
  1027. this.afterExpand, this),
  1028. this.expandDefaults));
  1029. } else {
  1030. this[this.collapseEl].show();
  1031. this.afterExpand();
  1032. }
  1033. },
  1034. // private
  1035. afterExpand : function() {
  1036. this.collapsed = false;
  1037. this.afterEffect();
  1038. this.fireEvent('expand', this);
  1039. },
  1040. /**
  1041. * Shortcut for performing an {@link #expand} or {@link #collapse} based on
  1042. * the current state of the panel.
  1043. *
  1044. * @param {Boolean}
  1045. * animate True to animate the transition, else false (defaults
  1046. * to the value of the {@link #animCollapse} panel config)
  1047. * @return {Ext.Panel} this
  1048. */
  1049. toggleCollapse : function(animate) {
  1050. this[this.collapsed ? 'expand' : 'collapse'](animate);
  1051. return this;
  1052. },
  1053. // private
  1054. onDisable : function() {
  1055. if (this.rendered && this.maskDisabled) {
  1056. this.el.mask();
  1057. }
  1058. Ext.Panel.superclass.onDisable.call(this);
  1059. },
  1060. // private
  1061. onEnable : function() {
  1062. if (this.rendered && this.maskDisabled) {
  1063. this.el.unmask();
  1064. }
  1065. Ext.Panel.superclass.onEnable.call(this);
  1066. },
  1067. // private
  1068. onResize : function(w, h) {
  1069. if (w !== undefined || h !== undefined) {
  1070. if (!this.collapsed) {
  1071. if (typeof w == 'number') {
  1072. this.body.setWidth(this.adjustBodyWidth(w
  1073. - this.getFrameWidth()));
  1074. } else if (w == 'auto') {
  1075. this.body.setWidth(w);
  1076. }
  1077. if (typeof h == 'number') {
  1078. this.body.setHeight(this.adjustBodyHeight(h
  1079. - this.getFrameHeight()));
  1080. } else if (h == 'auto') {
  1081. this.body.setHeight(h);
  1082. }
  1083. } else {
  1084. this.queuedBodySize = {
  1085. width : w,
  1086. height : h
  1087. };
  1088. if (!this.queuedExpand && this.allowQueuedExpand !== false) {
  1089. this.queuedExpand = true;
  1090. this.on('expand', function() {
  1091. delete this.queuedExpand;
  1092. this.onResize(this.queuedBodySize.width,
  1093. this.queuedBodySize.height);
  1094. this.doLayout();
  1095. }, this, {
  1096. single : true
  1097. });
  1098. }
  1099. }
  1100. this.fireEvent('bodyresize', this, w, h);
  1101. }
  1102. this.syncShadow();
  1103. },
  1104. // private
  1105. adjustBodyHeight : function(h) {
  1106. return h;
  1107. },
  1108. // private
  1109. adjustBodyWidth : function(w) {
  1110. return w;
  1111. },
  1112. // private
  1113. onPosition : function() {
  1114. this.syncShadow();
  1115. },
  1116. // private
  1117. onDestroy : function() {
  1118. if (this.tools) {
  1119. for (var k in this.tools) {
  1120. Ext.destroy(this.tools[k]);
  1121. }
  1122. }
  1123. if (this.buttons) {
  1124. for (var b in this.buttons) {
  1125. Ext.destroy(this.buttons[b]);
  1126. }
  1127. }
  1128. Ext.destroy(this.topToolbar, this.bottomToolbar);
  1129. Ext.Panel.superclass.onDestroy.call(this);
  1130. },
  1131. /**
  1132. * Returns the width in pixels of the framing elements of this panel (not
  1133. * including the body width). To retrieve the body width see
  1134. * {@link #getInnerWidth}.
  1135. *
  1136. * @return {Number} The frame width
  1137. */
  1138. getFrameWidth : function() {
  1139. var w = this.el.getFrameWidth('lr');
  1140. if (this.frame) {
  1141. var l = this.bwrap.dom.firstChild;
  1142. w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild)
  1143. .getFrameWidth('r'));
  1144. var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
  1145. w += Ext.fly(mc).getFrameWidth('lr');
  1146. }
  1147. return w;
  1148. },
  1149. /**
  1150. * Returns the height in pixels of the framing elements of this panel
  1151. * (including any top and bottom bars and header and footer elements, but
  1152. * not including the body height). To retrieve the body height see
  1153. * {@link #getInnerHeight}.
  1154. *
  1155. * @return {Number} The frame height
  1156. */
  1157. getFrameHeight : function() {
  1158. var h = this.el.getFrameWidth('tb');
  1159. h += (this.tbar ? this.tbar.getHeight() : 0)
  1160. + (this.bbar ? this.bbar.getHeight() : 0);
  1161. if (this.frame) {
  1162. var hd = this.el.dom.firstChild;
  1163. var ft = this.bwrap.dom.lastChild;
  1164. h += (hd.offsetHeight + ft.offsetHeight);
  1165. var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
  1166. h += Ext.fly(mc).getFrameWidth('tb');
  1167. } else {
  1168. h += (this.header ? this.header.getHeight() : 0)
  1169. + (this.footer ? this.footer.getHeight() : 0);
  1170. }
  1171. return h;
  1172. },
  1173. /**
  1174. * Returns the width in pixels of the body element (not including the width
  1175. * of any framing elements). For the frame width see {@link #getFrameWidth}.
  1176. *
  1177. * @return {Number} The body width
  1178. */
  1179. getInnerWidth : function() {
  1180. return this.getSize().width - this.getFrameWidth();
  1181. },
  1182. /**
  1183. * Returns the height in pixels of the body element (not including the
  1184. * height of any framing elements). For the frame height see
  1185. * {@link #getFrameHeight}.
  1186. *
  1187. * @return {Number} The body height
  1188. */
  1189. getInnerHeight : function() {
  1190. return this.getSize().height - this.getFrameHeight();
  1191. },
  1192. // private
  1193. syncShadow : function() {
  1194. if (this.floating) {
  1195. this.el.sync(true);
  1196. }
  1197. },
  1198. // private
  1199. getLayoutTarget : function() {
  1200. return this.body;
  1201. },
  1202. /**
  1203. * Sets the title text for the panel and optionally the icon class.
  1204. *
  1205. * @param {String}
  1206. * title The title text to set
  1207. * @param {String}
  1208. * (optional) iconCls A custon, user-defined CSS class that
  1209. * provides the icon image for this panel
  1210. */
  1211. setTitle : function(title, iconCls) {
  1212. this.title = title;
  1213. if (this.header && this.headerAsText) {
  1214. this.header.child('span').update(title);
  1215. }
  1216. if (iconCls) {
  1217. this.setIconClass(iconCls);
  1218. }
  1219. this.fireEvent('titlechange', this, title);
  1220. return this;
  1221. },
  1222. /**
  1223. * Get the {@link Ext.Updater} for this panel. Enables you to perform Ajax
  1224. * updates of this panel's body.
  1225. *
  1226. * @return {Ext.Updater} The Updater
  1227. */
  1228. getUpdater : function() {
  1229. return this.body.getUpdater();
  1230. },
  1231. /**
  1232. * Loads this content panel immediately with content returned from an XHR
  1233. * call.
  1234. *
  1235. * @param {Object/String/Function}
  1236. * config A config object containing any of the following
  1237. * options:
  1238. *
  1239. * <pre><code>
  1240. * panel.load({
  1241. * url : &quot;your-url.php&quot;,
  1242. * params : {
  1243. * param1 : &quot;foo&quot;,
  1244. * param2 : &quot;bar&quot;
  1245. * }, // or a URL encoded string
  1246. * callback : yourFunction,
  1247. * scope : yourObject, // optional scope for the callback
  1248. * discardUrl : false,
  1249. * nocache : false,
  1250. * text : &quot;Loading...&quot;,
  1251. * timeout : 30,
  1252. * scripts : false
  1253. * });
  1254. * </code></pre>
  1255. *
  1256. * The only required property is url. The optional properties
  1257. * nocache, text and scripts are shorthand for disableCaching,
  1258. * indicatorText and loadScripts and are used to set their
  1259. * associated property on this panel Updater instance.
  1260. * @return {Ext.Panel} this
  1261. */
  1262. load : function() {
  1263. var um = this.body.getUpdater();
  1264. um.update.apply(um, arguments);
  1265. return this;
  1266. },
  1267. // private
  1268. beforeDestroy : function() {
  1269. Ext.Element.uncache(this.header, this.tbar, this.bbar, this.footer,
  1270. this.body);
  1271. },
  1272. // private
  1273. createClasses : function() {
  1274. this.headerCls = this.baseCls + '-header';
  1275. this.headerTextCls = this.baseCls + '-header-text';
  1276. this.bwrapCls = this.baseCls + '-bwrap';
  1277. this.tbarCls = this.baseCls + '-tbar';
  1278. this.bodyCls = this.baseCls + '-body';
  1279. this.bbarCls = this.baseCls + '-bbar';
  1280. this.footerCls = this.baseCls + '-footer';
  1281. },
  1282. // private
  1283. createGhost : function(cls, useShim, appendTo) {
  1284. var el = document.createElement('div');
  1285. el.className = 'x-panel-ghost ' + (cls ? cls : '');
  1286. if (this.header) {
  1287. el.appendChild(this.el.dom.firstChild.cloneNode(true));
  1288. }
  1289. Ext.fly(el.appendChild(document.createElement('ul')))
  1290. .setHeight(this.bwrap.getHeight());
  1291. el.style.width = this.el.dom.offsetWidth + 'px';;
  1292. if (!appendTo) {
  1293. this.container.dom.appendChild(el);
  1294. } else {
  1295. Ext.getDom(appendTo).appendChild(el);
  1296. }
  1297. if (useShim !== false && this.el.useShim !== false) {
  1298. var layer = new Ext.Layer({
  1299. shadow : false,
  1300. useDisplay : true,
  1301. constrain : false
  1302. }, el);
  1303. layer.show();
  1304. return layer;
  1305. } else {
  1306. return new Ext.Element(el);
  1307. }
  1308. },
  1309. // private
  1310. doAutoLoad : function() {
  1311. this.body.load(typeof this.autoLoad == 'object' ? this.autoLoad : {
  1312. url : this.autoLoad
  1313. });
  1314. }
  1315. });
  1316. Ext.reg('panel', Ext.Panel);