Web UI for ARGUS server
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.

1142 lines
43 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.TabPanel"></div>/**
  16. * @class Ext.TabPanel
  17. * <p>A basic tab container. TabPanels can be used exactly like a standard {@link Ext.Panel}
  18. * for layout purposes, but also have special support for containing child Components
  19. * (<tt>{@link Ext.Container#items items}</tt>) that are managed using a
  20. * {@link Ext.layout.CardLayout CardLayout layout manager}, and displayed as separate tabs.</p>
  21. *
  22. * <b>Note:</b> By default, a tab's close tool <i>destroys</i> the child tab Component
  23. * and all its descendants. This makes the child tab Component, and all its descendants <b>unusable</b>. To enable
  24. * re-use of a tab, configure the TabPanel with <b><code>{@link #autoDestroy autoDestroy: false}</code></b>.
  25. *
  26. * <p><b><u>TabPanel header/footer elements</u></b></p>
  27. * <p>TabPanels use their {@link Ext.Panel#header header} or {@link Ext.Panel#footer footer} element
  28. * (depending on the {@link #tabPosition} configuration) to accommodate the tab selector buttons.
  29. * This means that a TabPanel will not display any configured title, and will not display any
  30. * configured header {@link Ext.Panel#tools tools}.</p>
  31. * <p>To display a header, embed the TabPanel in a {@link Ext.Panel Panel} which uses
  32. * <b><tt>{@link Ext.Container#layout layout:'fit'}</tt></b>.</p>
  33. *
  34. * <p><b><u>Tab Events</u></b></p>
  35. * <p>There is no actual tab class &mdash; each tab is simply a {@link Ext.BoxComponent Component}
  36. * such as a {@link Ext.Panel Panel}. However, when rendered in a TabPanel, each child Component
  37. * can fire additional events that only exist for tabs and are not available from other Components.
  38. * These events are:</p>
  39. * <div><ul class="mdetail-params">
  40. * <li><tt><b>{@link Ext.Panel#activate activate}</b></tt> : Fires when this Component becomes
  41. * the active tab.</li>
  42. * <li><tt><b>{@link Ext.Panel#deactivate deactivate}</b></tt> : Fires when the Component that
  43. * was the active tab becomes deactivated.</li>
  44. * <li><tt><b>{@link Ext.Panel#beforeclose beforeclose}</b></tt> : Fires when the user clicks on the close tool of a closeable tab.
  45. * May be vetoed by returning <code>false</code> from a handler.</li>
  46. * <li><tt><b>{@link Ext.Panel#close close}</b></tt> : Fires a closeable tab has been closed by the user.</li>
  47. * </ul></div>
  48. * <p><b><u>Creating TabPanels from Code</u></b></p>
  49. * <p>TabPanels can be created and rendered completely in code, as in this example:</p>
  50. * <pre><code>
  51. var tabs = new Ext.TabPanel({
  52. renderTo: Ext.getBody(),
  53. activeTab: 0,
  54. items: [{
  55. title: 'Tab 1',
  56. html: 'A simple tab'
  57. },{
  58. title: 'Tab 2',
  59. html: 'Another one'
  60. }]
  61. });
  62. </code></pre>
  63. * <p><b><u>Creating TabPanels from Existing Markup</u></b></p>
  64. * <p>TabPanels can also be rendered from pre-existing markup in a couple of ways.</p>
  65. * <div><ul class="mdetail-params">
  66. *
  67. * <li>Pre-Structured Markup</li>
  68. * <div class="sub-desc">
  69. * <p>A container div with one or more nested tab divs with class <tt>'x-tab'</tt> can be rendered entirely
  70. * from existing markup (See the {@link #autoTabs} example).</p>
  71. * </div>
  72. *
  73. * <li>Un-Structured Markup</li>
  74. * <div class="sub-desc">
  75. * <p>A TabPanel can also be rendered from markup that is not strictly structured by simply specifying by id
  76. * which elements should be the container and the tabs. Using this method tab content can be pulled from different
  77. * elements within the page by id regardless of page structure. For example:</p>
  78. * <pre><code>
  79. var tabs = new Ext.TabPanel({
  80. renderTo: 'my-tabs',
  81. activeTab: 0,
  82. items:[
  83. {contentEl:'tab1', title:'Tab 1'},
  84. {contentEl:'tab2', title:'Tab 2'}
  85. ]
  86. });
  87. // Note that the tabs do not have to be nested within the container (although they can be)
  88. &lt;div id="my-tabs">&lt;/div>
  89. &lt;div id="tab1" class="x-hide-display">A simple tab&lt;/div>
  90. &lt;div id="tab2" class="x-hide-display">Another one&lt;/div>
  91. </code></pre>
  92. * Note that the tab divs in this example contain the class <tt>'x-hide-display'</tt> so that they can be rendered
  93. * deferred without displaying outside the tabs. You could alternately set <tt>{@link #deferredRender} = false </tt>
  94. * to render all content tabs on page load.
  95. * </div>
  96. *
  97. * </ul></div>
  98. *
  99. * @extends Ext.Panel
  100. * @constructor
  101. * @param {Object} config The configuration options
  102. * @xtype tabpanel
  103. */
  104. Ext.TabPanel = Ext.extend(Ext.Panel, {
  105. <div id="cfg-Ext.TabPanel-layoutOnTabChange"></div>/**
  106. * @cfg {Boolean} layoutOnTabChange
  107. * Set to true to force a layout of the active tab when the tab is changed. Defaults to false.
  108. * See {@link Ext.layout.CardLayout}.<code>{@link Ext.layout.CardLayout#layoutOnCardChange layoutOnCardChange}</code>.
  109. */
  110. <div id="cfg-Ext.TabPanel-tabCls"></div>/**
  111. * @cfg {String} tabCls <b>This config option is used on <u>child Components</u> of ths TabPanel.</b> A CSS
  112. * class name applied to the tab strip item representing the child Component, allowing special
  113. * styling to be applied.
  114. */
  115. <div id="cfg-Ext.TabPanel-deferredRender"></div>/**
  116. * @cfg {Boolean} deferredRender
  117. * <p><tt>true</tt> by default to defer the rendering of child <tt>{@link Ext.Container#items items}</tt>
  118. * to the browsers DOM until a tab is activated. <tt>false</tt> will render all contained
  119. * <tt>{@link Ext.Container#items items}</tt> as soon as the {@link Ext.layout.CardLayout layout}
  120. * is rendered. If there is a significant amount of content or a lot of heavy controls being
  121. * rendered into panels that are not displayed by default, setting this to <tt>true</tt> might
  122. * improve performance.</p>
  123. * <br><p>The <tt>deferredRender</tt> property is internally passed to the layout manager for
  124. * TabPanels ({@link Ext.layout.CardLayout}) as its {@link Ext.layout.CardLayout#deferredRender}
  125. * configuration value.</p>
  126. * <br><p><b>Note</b>: leaving <tt>deferredRender</tt> as <tt>true</tt> means that the content
  127. * within an unactivated tab will not be available. For example, this means that if the TabPanel
  128. * is within a {@link Ext.form.FormPanel form}, then until a tab is activated, any Fields within
  129. * unactivated tabs will not be rendered, and will therefore not be submitted and will not be
  130. * available to either {@link Ext.form.BasicForm#getValues getValues} or
  131. * {@link Ext.form.BasicForm#setValues setValues}.</p>
  132. */
  133. deferredRender : true,
  134. <div id="cfg-Ext.TabPanel-tabWidth"></div>/**
  135. * @cfg {Number} tabWidth The initial width in pixels of each new tab (defaults to 120).
  136. */
  137. tabWidth : 120,
  138. <div id="cfg-Ext.TabPanel-minTabWidth"></div>/**
  139. * @cfg {Number} minTabWidth The minimum width in pixels for each tab when {@link #resizeTabs} = true (defaults to 30).
  140. */
  141. minTabWidth : 30,
  142. <div id="cfg-Ext.TabPanel-resizeTabs"></div>/**
  143. * @cfg {Boolean} resizeTabs True to automatically resize each tab so that the tabs will completely fill the
  144. * tab strip (defaults to false). Setting this to true may cause specific widths that might be set per tab to
  145. * be overridden in order to fit them all into view (although {@link #minTabWidth} will always be honored).
  146. */
  147. resizeTabs : false,
  148. <div id="cfg-Ext.TabPanel-enableTabScroll"></div>/**
  149. * @cfg {Boolean} enableTabScroll True to enable scrolling to tabs that may be invisible due to overflowing the
  150. * overall TabPanel width. Only available with tabPosition:'top' (defaults to false).
  151. */
  152. enableTabScroll : false,
  153. <div id="cfg-Ext.TabPanel-scrollIncrement"></div>/**
  154. * @cfg {Number} scrollIncrement The number of pixels to scroll each time a tab scroll button is pressed
  155. * (defaults to <tt>100</tt>, or if <tt>{@link #resizeTabs} = true</tt>, the calculated tab width). Only
  156. * applies when <tt>{@link #enableTabScroll} = true</tt>.
  157. */
  158. scrollIncrement : 0,
  159. <div id="cfg-Ext.TabPanel-scrollRepeatInterval"></div>/**
  160. * @cfg {Number} scrollRepeatInterval Number of milliseconds between each scroll while a tab scroll button is
  161. * continuously pressed (defaults to <tt>400</tt>).
  162. */
  163. scrollRepeatInterval : 400,
  164. <div id="cfg-Ext.TabPanel-scrollDuration"></div>/**
  165. * @cfg {Float} scrollDuration The number of milliseconds that each scroll animation should last (defaults
  166. * to <tt>.35</tt>). Only applies when <tt>{@link #animScroll} = true</tt>.
  167. */
  168. scrollDuration : 0.35,
  169. <div id="cfg-Ext.TabPanel-animScroll"></div>/**
  170. * @cfg {Boolean} animScroll True to animate tab scrolling so that hidden tabs slide smoothly into view (defaults
  171. * to <tt>true</tt>). Only applies when <tt>{@link #enableTabScroll} = true</tt>.
  172. */
  173. animScroll : true,
  174. <div id="cfg-Ext.TabPanel-tabPosition"></div>/**
  175. * @cfg {String} tabPosition The position where the tab strip should be rendered (defaults to <tt>'top'</tt>).
  176. * The only other supported value is <tt>'bottom'</tt>. <b>Note</b>: tab scrolling is only supported for
  177. * <tt>tabPosition: 'top'</tt>.
  178. */
  179. tabPosition : 'top',
  180. <div id="cfg-Ext.TabPanel-baseCls"></div>/**
  181. * @cfg {String} baseCls The base CSS class applied to the panel (defaults to <tt>'x-tab-panel'</tt>).
  182. */
  183. baseCls : 'x-tab-panel',
  184. <div id="cfg-Ext.TabPanel-autoTabs"></div>/**
  185. * @cfg {Boolean} autoTabs
  186. * <p><tt>true</tt> to query the DOM for any divs with a class of 'x-tab' to be automatically converted
  187. * to tabs and added to this panel (defaults to <tt>false</tt>). Note that the query will be executed within
  188. * the scope of the container element only (so that multiple tab panels from markup can be supported via this
  189. * method).</p>
  190. * <p>This method is only possible when the markup is structured correctly as a container with nested divs
  191. * containing the class <tt>'x-tab'</tt>. To create TabPanels without these limitations, or to pull tab content
  192. * from other elements on the page, see the example at the top of the class for generating tabs from markup.</p>
  193. * <p>There are a couple of things to note when using this method:<ul>
  194. * <li>When using the <tt>autoTabs</tt> config (as opposed to passing individual tab configs in the TabPanel's
  195. * {@link #items} collection), you must use <tt>{@link #applyTo}</tt> to correctly use the specified <tt>id</tt>
  196. * as the tab container. The <tt>autoTabs</tt> method <em>replaces</em> existing content with the TabPanel
  197. * components.</li>
  198. * <li>Make sure that you set <tt>{@link #deferredRender}: false</tt> so that the content elements for each
  199. * tab will be rendered into the TabPanel immediately upon page load, otherwise they will not be transformed
  200. * until each tab is activated and will be visible outside the TabPanel.</li>
  201. * </ul>Example usage:</p>
  202. * <pre><code>
  203. var tabs = new Ext.TabPanel({
  204. applyTo: 'my-tabs',
  205. activeTab: 0,
  206. deferredRender: false,
  207. autoTabs: true
  208. });
  209. // This markup will be converted to a TabPanel from the code above
  210. &lt;div id="my-tabs">
  211. &lt;div class="x-tab" title="Tab 1">A simple tab&lt;/div>
  212. &lt;div class="x-tab" title="Tab 2">Another one&lt;/div>
  213. &lt;/div>
  214. </code></pre>
  215. */
  216. autoTabs : false,
  217. <div id="cfg-Ext.TabPanel-autoTabSelector"></div>/**
  218. * @cfg {String} autoTabSelector The CSS selector used to search for tabs in existing markup when
  219. * <tt>{@link #autoTabs} = true</tt> (defaults to <tt>'div.x-tab'</tt>). This can be any valid selector
  220. * supported by {@link Ext.DomQuery#select}. Note that the query will be executed within the scope of this
  221. * tab panel only (so that multiple tab panels from markup can be supported on a page).
  222. */
  223. autoTabSelector : 'div.x-tab',
  224. <div id="cfg-Ext.TabPanel-activeTab"></div>/**
  225. * @cfg {String/Number} activeTab A string id or the numeric index of the tab that should be initially
  226. * activated on render (defaults to undefined).
  227. */
  228. activeTab : undefined,
  229. <div id="cfg-Ext.TabPanel-tabMargin"></div>/**
  230. * @cfg {Number} tabMargin The number of pixels of space to calculate into the sizing and scrolling of
  231. * tabs. If you change the margin in CSS, you will need to update this value so calculations are correct
  232. * with either <tt>{@link #resizeTabs}</tt> or scrolling tabs. (defaults to <tt>2</tt>)
  233. */
  234. tabMargin : 2,
  235. <div id="cfg-Ext.TabPanel-plain"></div>/**
  236. * @cfg {Boolean} plain </tt>true</tt> to render the tab strip without a background container image
  237. * (defaults to <tt>false</tt>).
  238. */
  239. plain : false,
  240. <div id="cfg-Ext.TabPanel-wheelIncrement"></div>/**
  241. * @cfg {Number} wheelIncrement For scrolling tabs, the number of pixels to increment on mouse wheel
  242. * scrolling (defaults to <tt>20</tt>).
  243. */
  244. wheelIncrement : 20,
  245. /*
  246. * This is a protected property used when concatenating tab ids to the TabPanel id for internal uniqueness.
  247. * It does not generally need to be changed, but can be if external code also uses an id scheme that can
  248. * potentially clash with this one.
  249. */
  250. idDelimiter : '__',
  251. // private
  252. itemCls : 'x-tab-item',
  253. // private config overrides
  254. elements : 'body',
  255. headerAsText : false,
  256. frame : false,
  257. hideBorders :true,
  258. // private
  259. initComponent : function(){
  260. this.frame = false;
  261. Ext.TabPanel.superclass.initComponent.call(this);
  262. this.addEvents(
  263. <div id="event-Ext.TabPanel-beforetabchange"></div>/**
  264. * @event beforetabchange
  265. * Fires before the active tab changes. Handlers can <tt>return false</tt> to cancel the tab change.
  266. * @param {TabPanel} this
  267. * @param {Panel} newTab The tab being activated
  268. * @param {Panel} currentTab The current active tab
  269. */
  270. 'beforetabchange',
  271. <div id="event-Ext.TabPanel-tabchange"></div>/**
  272. * @event tabchange
  273. * Fires after the active tab has changed.
  274. * @param {TabPanel} this
  275. * @param {Panel} tab The new active tab
  276. */
  277. 'tabchange',
  278. <div id="event-Ext.TabPanel-contextmenu"></div>/**
  279. * @event contextmenu
  280. * Relays the contextmenu event from a tab selector element in the tab strip.
  281. * @param {TabPanel} this
  282. * @param {Panel} tab The target tab
  283. * @param {EventObject} e
  284. */
  285. 'contextmenu'
  286. );
  287. <div id="cfg-Ext.TabPanel-layoutConfig"></div>/**
  288. * @cfg {Object} layoutConfig
  289. * TabPanel implicitly uses {@link Ext.layout.CardLayout} as its layout manager.
  290. * <code>layoutConfig</code> may be used to configure this layout manager.
  291. * <code>{@link #deferredRender}</code> and <code>{@link #layoutOnTabChange}</code>
  292. * configured on the TabPanel will be applied as configs to the layout manager.
  293. */
  294. this.setLayout(new Ext.layout.CardLayout(Ext.apply({
  295. layoutOnCardChange: this.layoutOnTabChange,
  296. deferredRender: this.deferredRender
  297. }, this.layoutConfig)));
  298. if(this.tabPosition == 'top'){
  299. this.elements += ',header';
  300. this.stripTarget = 'header';
  301. }else {
  302. this.elements += ',footer';
  303. this.stripTarget = 'footer';
  304. }
  305. if(!this.stack){
  306. this.stack = Ext.TabPanel.AccessStack();
  307. }
  308. this.initItems();
  309. },
  310. // private
  311. onRender : function(ct, position){
  312. Ext.TabPanel.superclass.onRender.call(this, ct, position);
  313. if(this.plain){
  314. var pos = this.tabPosition == 'top' ? 'header' : 'footer';
  315. this[pos].addClass('x-tab-panel-'+pos+'-plain');
  316. }
  317. var st = this[this.stripTarget];
  318. this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{
  319. tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});
  320. var beforeEl = (this.tabPosition=='bottom' ? this.stripWrap : null);
  321. st.createChild({cls:'x-tab-strip-spacer'}, beforeEl);
  322. this.strip = new Ext.Element(this.stripWrap.dom.firstChild);
  323. // create an empty span with class x-tab-strip-text to force the height of the header element when there's no tabs.
  324. this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge', cn: [{tag: 'span', cls: 'x-tab-strip-text', cn: '&#160;'}]});
  325. this.strip.createChild({cls:'x-clear'});
  326. this.body.addClass('x-tab-panel-body-'+this.tabPosition);
  327. <div id="cfg-Ext.TabPanel-itemTpl"></div>/**
  328. * @cfg {Template/XTemplate} itemTpl <p>(Optional) A {@link Ext.Template Template} or
  329. * {@link Ext.XTemplate XTemplate} which may be provided to process the data object returned from
  330. * <tt>{@link #getTemplateArgs}</tt> to produce a clickable selector element in the tab strip.</p>
  331. * <p>The main element created should be a <tt>&lt;li></tt> element. In order for a click event on
  332. * a selector element to be connected to its item, it must take its <i>id</i> from the TabPanel's
  333. * native <tt>{@link #getTemplateArgs}</tt>.</p>
  334. * <p>The child element which contains the title text must be marked by the CSS class
  335. * <tt>x-tab-strip-inner</tt>.</p>
  336. * <p>To enable closability, the created element should contain an element marked by the CSS class
  337. * <tt>x-tab-strip-close</tt>.</p>
  338. * <p>If a custom <tt>itemTpl</tt> is supplied, it is the developer's responsibility to create CSS
  339. * style rules to create the desired appearance.</p>
  340. * Below is an example of how to create customized tab selector items:<pre><code>
  341. new Ext.TabPanel({
  342. renderTo: document.body,
  343. minTabWidth: 115,
  344. tabWidth: 135,
  345. enableTabScroll: true,
  346. width: 600,
  347. height: 250,
  348. defaults: {autoScroll:true},
  349. itemTpl: new Ext.XTemplate(
  350. '&lt;li class="{cls}" id="{id}" style="overflow:hidden">',
  351. '&lt;tpl if="closable">',
  352. '&lt;a class="x-tab-strip-close">&lt;/a>',
  353. '&lt;/tpl>',
  354. '&lt;a class="x-tab-right" href="#" style="padding-left:6px">',
  355. '&lt;em class="x-tab-left">',
  356. '&lt;span class="x-tab-strip-inner">',
  357. '&lt;img src="{src}" style="float:left;margin:3px 3px 0 0">',
  358. '&lt;span style="margin-left:20px" class="x-tab-strip-text {iconCls}">{text} {extra}&lt;/span>',
  359. '&lt;/span>',
  360. '&lt;/em>',
  361. '&lt;/a>',
  362. '&lt;/li>'
  363. ),
  364. getTemplateArgs: function(item) {
  365. // Call the native method to collect the base data. Like the ID!
  366. var result = Ext.TabPanel.prototype.getTemplateArgs.call(this, item);
  367. // Add stuff used in our template
  368. return Ext.apply(result, {
  369. closable: item.closable,
  370. src: item.iconSrc,
  371. extra: item.extraText || ''
  372. });
  373. },
  374. items: [{
  375. title: 'New Tab 1',
  376. iconSrc: '../shared/icons/fam/grid.png',
  377. html: 'Tab Body 1',
  378. closable: true
  379. }, {
  380. title: 'New Tab 2',
  381. iconSrc: '../shared/icons/fam/grid.png',
  382. html: 'Tab Body 2',
  383. extraText: 'Extra stuff in the tab button'
  384. }]
  385. });
  386. </code></pre>
  387. */
  388. if(!this.itemTpl){
  389. var tt = new Ext.Template(
  390. '<li class="{cls}" id="{id}"><a class="x-tab-strip-close"></a>',
  391. '<a class="x-tab-right" href="#"><em class="x-tab-left">',
  392. '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
  393. '</em></a></li>'
  394. );
  395. tt.disableFormats = true;
  396. tt.compile();
  397. Ext.TabPanel.prototype.itemTpl = tt;
  398. }
  399. this.items.each(this.initTab, this);
  400. },
  401. // private
  402. afterRender : function(){
  403. Ext.TabPanel.superclass.afterRender.call(this);
  404. if(this.autoTabs){
  405. this.readTabs(false);
  406. }
  407. if(this.activeTab !== undefined){
  408. var item = Ext.isObject(this.activeTab) ? this.activeTab : this.items.get(this.activeTab);
  409. delete this.activeTab;
  410. this.setActiveTab(item);
  411. }
  412. },
  413. // private
  414. initEvents : function(){
  415. Ext.TabPanel.superclass.initEvents.call(this);
  416. this.mon(this.strip, {
  417. scope: this,
  418. mousedown: this.onStripMouseDown,
  419. contextmenu: this.onStripContextMenu
  420. });
  421. if(this.enableTabScroll){
  422. this.mon(this.strip, 'mousewheel', this.onWheel, this);
  423. }
  424. },
  425. // private
  426. findTargets : function(e){
  427. var item = null,
  428. itemEl = e.getTarget('li:not(.x-tab-edge)', this.strip);
  429. if(itemEl){
  430. item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);
  431. if(item.disabled){
  432. return {
  433. close : null,
  434. item : null,
  435. el : null
  436. };
  437. }
  438. }
  439. return {
  440. close : e.getTarget('.x-tab-strip-close', this.strip),
  441. item : item,
  442. el : itemEl
  443. };
  444. },
  445. // private
  446. onStripMouseDown : function(e){
  447. if(e.button !== 0){
  448. return;
  449. }
  450. e.preventDefault();
  451. var t = this.findTargets(e);
  452. if(t.close){
  453. if (t.item.fireEvent('beforeclose', t.item) !== false) {
  454. t.item.fireEvent('close', t.item);
  455. this.remove(t.item);
  456. }
  457. return;
  458. }
  459. if(t.item && t.item != this.activeTab){
  460. this.setActiveTab(t.item);
  461. }
  462. },
  463. // private
  464. onStripContextMenu : function(e){
  465. e.preventDefault();
  466. var t = this.findTargets(e);
  467. if(t.item){
  468. this.fireEvent('contextmenu', this, t.item, e);
  469. }
  470. },
  471. <div id="method-Ext.TabPanel-readTabs"></div>/**
  472. * True to scan the markup in this tab panel for <tt>{@link #autoTabs}</tt> using the
  473. * <tt>{@link #autoTabSelector}</tt>
  474. * @param {Boolean} removeExisting True to remove existing tabs
  475. */
  476. readTabs : function(removeExisting){
  477. if(removeExisting === true){
  478. this.items.each(function(item){
  479. this.remove(item);
  480. }, this);
  481. }
  482. var tabs = this.el.query(this.autoTabSelector);
  483. for(var i = 0, len = tabs.length; i < len; i++){
  484. var tab = tabs[i],
  485. title = tab.getAttribute('title');
  486. tab.removeAttribute('title');
  487. this.add({
  488. title: title,
  489. contentEl: tab
  490. });
  491. }
  492. },
  493. // private
  494. initTab : function(item, index){
  495. var before = this.strip.dom.childNodes[index],
  496. p = this.getTemplateArgs(item),
  497. el = before ?
  498. this.itemTpl.insertBefore(before, p) :
  499. this.itemTpl.append(this.strip, p),
  500. cls = 'x-tab-strip-over',
  501. tabEl = Ext.get(el);
  502. tabEl.hover(function(){
  503. if(!item.disabled){
  504. tabEl.addClass(cls);
  505. }
  506. }, function(){
  507. tabEl.removeClass(cls);
  508. });
  509. if(item.tabTip){
  510. tabEl.child('span.x-tab-strip-text', true).qtip = item.tabTip;
  511. }
  512. item.tabEl = el;
  513. // Route *keyboard triggered* click events to the tab strip mouse handler.
  514. tabEl.select('a').on('click', function(e){
  515. if(!e.getPageX()){
  516. this.onStripMouseDown(e);
  517. }
  518. }, this, {preventDefault: true});
  519. item.on({
  520. scope: this,
  521. disable: this.onItemDisabled,
  522. enable: this.onItemEnabled,
  523. titlechange: this.onItemTitleChanged,
  524. iconchange: this.onItemIconChanged,
  525. beforeshow: this.onBeforeShowItem
  526. });
  527. },
  528. <div id="method-Ext.TabPanel-getTemplateArgs"></div>/**
  529. * <p>Provides template arguments for rendering a tab selector item in the tab strip.</p>
  530. * <p>This method returns an object hash containing properties used by the TabPanel's <tt>{@link #itemTpl}</tt>
  531. * to create a formatted, clickable tab selector element. The properties which must be returned
  532. * are:</p><div class="mdetail-params"><ul>
  533. * <li><b>id</b> : String<div class="sub-desc">A unique identifier which links to the item</div></li>
  534. * <li><b>text</b> : String<div class="sub-desc">The text to display</div></li>
  535. * <li><b>cls</b> : String<div class="sub-desc">The CSS class name</div></li>
  536. * <li><b>iconCls</b> : String<div class="sub-desc">A CSS class to provide appearance for an icon.</div></li>
  537. * </ul></div>
  538. * @param {Ext.BoxComponent} item The {@link Ext.BoxComponent BoxComponent} for which to create a selector element in the tab strip.
  539. * @return {Object} An object hash containing the properties required to render the selector element.
  540. */
  541. getTemplateArgs : function(item) {
  542. var cls = item.closable ? 'x-tab-strip-closable' : '';
  543. if(item.disabled){
  544. cls += ' x-item-disabled';
  545. }
  546. if(item.iconCls){
  547. cls += ' x-tab-with-icon';
  548. }
  549. if(item.tabCls){
  550. cls += ' ' + item.tabCls;
  551. }
  552. return {
  553. id: this.id + this.idDelimiter + item.getItemId(),
  554. text: item.title,
  555. cls: cls,
  556. iconCls: item.iconCls || ''
  557. };
  558. },
  559. // private
  560. onAdd : function(c){
  561. Ext.TabPanel.superclass.onAdd.call(this, c);
  562. if(this.rendered){
  563. var items = this.items;
  564. this.initTab(c, items.indexOf(c));
  565. this.delegateUpdates();
  566. }
  567. },
  568. // private
  569. onBeforeAdd : function(item){
  570. var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);
  571. if(existing){
  572. this.setActiveTab(item);
  573. return false;
  574. }
  575. Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);
  576. var es = item.elements;
  577. item.elements = es ? es.replace(',header', '') : es;
  578. item.border = (item.border === true);
  579. },
  580. // private
  581. onRemove : function(c){
  582. var te = Ext.get(c.tabEl);
  583. // check if the tabEl exists, it won't if the tab isn't rendered
  584. if(te){
  585. te.select('a').removeAllListeners();
  586. Ext.destroy(te);
  587. }
  588. Ext.TabPanel.superclass.onRemove.call(this, c);
  589. this.stack.remove(c);
  590. delete c.tabEl;
  591. c.un('disable', this.onItemDisabled, this);
  592. c.un('enable', this.onItemEnabled, this);
  593. c.un('titlechange', this.onItemTitleChanged, this);
  594. c.un('iconchange', this.onItemIconChanged, this);
  595. c.un('beforeshow', this.onBeforeShowItem, this);
  596. if(c == this.activeTab){
  597. var next = this.stack.next();
  598. if(next){
  599. this.setActiveTab(next);
  600. }else if(this.items.getCount() > 0){
  601. this.setActiveTab(0);
  602. }else{
  603. this.setActiveTab(null);
  604. }
  605. }
  606. if(!this.destroying){
  607. this.delegateUpdates();
  608. }
  609. },
  610. // private
  611. onBeforeShowItem : function(item){
  612. if(item != this.activeTab){
  613. this.setActiveTab(item);
  614. return false;
  615. }
  616. },
  617. // private
  618. onItemDisabled : function(item){
  619. var el = this.getTabEl(item);
  620. if(el){
  621. Ext.fly(el).addClass('x-item-disabled');
  622. }
  623. this.stack.remove(item);
  624. },
  625. // private
  626. onItemEnabled : function(item){
  627. var el = this.getTabEl(item);
  628. if(el){
  629. Ext.fly(el).removeClass('x-item-disabled');
  630. }
  631. },
  632. // private
  633. onItemTitleChanged : function(item){
  634. var el = this.getTabEl(item);
  635. if(el){
  636. Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;
  637. }
  638. },
  639. //private
  640. onItemIconChanged : function(item, iconCls, oldCls){
  641. var el = this.getTabEl(item);
  642. if(el){
  643. el = Ext.get(el);
  644. el.child('span.x-tab-strip-text').replaceClass(oldCls, iconCls);
  645. el[Ext.isEmpty(iconCls) ? 'removeClass' : 'addClass']('x-tab-with-icon');
  646. }
  647. },
  648. <div id="method-Ext.TabPanel-getTabEl"></div>/**
  649. * Gets the DOM element for the tab strip item which activates the child panel with the specified
  650. * ID. Access this to change the visual treatment of the item, for example by changing the CSS class name.
  651. * @param {Panel/Number/String} tab The tab component, or the tab's index, or the tabs id or itemId.
  652. * @return {HTMLElement} The DOM node
  653. */
  654. getTabEl : function(item){
  655. var c = this.getComponent(item);
  656. return c ? c.tabEl : null;
  657. },
  658. // private
  659. onResize : function(){
  660. Ext.TabPanel.superclass.onResize.apply(this, arguments);
  661. this.delegateUpdates();
  662. },
  663. <div id="method-Ext.TabPanel-beginUpdate"></div>/**
  664. * Suspends any internal calculations or scrolling while doing a bulk operation. See {@link #endUpdate}
  665. */
  666. beginUpdate : function(){
  667. this.suspendUpdates = true;
  668. },
  669. <div id="method-Ext.TabPanel-endUpdate"></div>/**
  670. * Resumes calculations and scrolling at the end of a bulk operation. See {@link #beginUpdate}
  671. */
  672. endUpdate : function(){
  673. this.suspendUpdates = false;
  674. this.delegateUpdates();
  675. },
  676. <div id="method-Ext.TabPanel-hideTabStripItem"></div>/**
  677. * Hides the tab strip item for the passed tab
  678. * @param {Number/String/Panel} item The tab index, id or item
  679. */
  680. hideTabStripItem : function(item){
  681. item = this.getComponent(item);
  682. var el = this.getTabEl(item);
  683. if(el){
  684. el.style.display = 'none';
  685. this.delegateUpdates();
  686. }
  687. this.stack.remove(item);
  688. },
  689. <div id="method-Ext.TabPanel-unhideTabStripItem"></div>/**
  690. * Unhides the tab strip item for the passed tab
  691. * @param {Number/String/Panel} item The tab index, id or item
  692. */
  693. unhideTabStripItem : function(item){
  694. item = this.getComponent(item);
  695. var el = this.getTabEl(item);
  696. if(el){
  697. el.style.display = '';
  698. this.delegateUpdates();
  699. }
  700. },
  701. // private
  702. delegateUpdates : function(){
  703. var rendered = this.rendered;
  704. if(this.suspendUpdates){
  705. return;
  706. }
  707. if(this.resizeTabs && rendered){
  708. this.autoSizeTabs();
  709. }
  710. if(this.enableTabScroll && rendered){
  711. this.autoScrollTabs();
  712. }
  713. },
  714. // private
  715. autoSizeTabs : function(){
  716. var count = this.items.length,
  717. ce = this.tabPosition != 'bottom' ? 'header' : 'footer',
  718. ow = this[ce].dom.offsetWidth,
  719. aw = this[ce].dom.clientWidth;
  720. if(!this.resizeTabs || count < 1 || !aw){ // !aw for display:none
  721. return;
  722. }
  723. var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth); // -4 for float errors in IE
  724. this.lastTabWidth = each;
  725. var lis = this.strip.query('li:not(.x-tab-edge)');
  726. for(var i = 0, len = lis.length; i < len; i++) {
  727. var li = lis[i],
  728. inner = Ext.fly(li).child('.x-tab-strip-inner', true),
  729. tw = li.offsetWidth,
  730. iw = inner.offsetWidth;
  731. inner.style.width = (each - (tw-iw)) + 'px';
  732. }
  733. },
  734. // private
  735. adjustBodyWidth : function(w){
  736. if(this.header){
  737. this.header.setWidth(w);
  738. }
  739. if(this.footer){
  740. this.footer.setWidth(w);
  741. }
  742. return w;
  743. },
  744. <div id="method-Ext.TabPanel-setActiveTab"></div>/**
  745. * Sets the specified tab as the active tab. This method fires the {@link #beforetabchange} event which
  746. * can <tt>return false</tt> to cancel the tab change.
  747. * @param {String/Number} item
  748. * The id or tab Panel to activate. This parameter may be any of the following:
  749. * <div><ul class="mdetail-params">
  750. * <li>a <b><tt>String</tt></b> : representing the <code>{@link Ext.Component#itemId itemId}</code>
  751. * or <code>{@link Ext.Component#id id}</code> of the child component </li>
  752. * <li>a <b><tt>Number</tt></b> : representing the position of the child component
  753. * within the <code>{@link Ext.Container#items items}</code> <b>property</b></li>
  754. * </ul></div>
  755. * <p>For additional information see {@link Ext.util.MixedCollection#get}.
  756. */
  757. setActiveTab : function(item){
  758. item = this.getComponent(item);
  759. if(this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
  760. return;
  761. }
  762. if(!this.rendered){
  763. this.activeTab = item;
  764. return;
  765. }
  766. if(this.activeTab != item){
  767. if(this.activeTab){
  768. var oldEl = this.getTabEl(this.activeTab);
  769. if(oldEl){
  770. Ext.fly(oldEl).removeClass('x-tab-strip-active');
  771. }
  772. }
  773. this.activeTab = item;
  774. if(item){
  775. var el = this.getTabEl(item);
  776. Ext.fly(el).addClass('x-tab-strip-active');
  777. this.stack.add(item);
  778. this.layout.setActiveItem(item);
  779. // Need to do this here, since setting the active tab slightly changes the size
  780. this.delegateUpdates();
  781. if(this.scrolling){
  782. this.scrollToTab(item, this.animScroll);
  783. }
  784. }
  785. this.fireEvent('tabchange', this, item);
  786. }
  787. },
  788. <div id="method-Ext.TabPanel-getActiveTab"></div>/**
  789. * Returns the Component which is the currently active tab. <b>Note that before the TabPanel
  790. * first activates a child Component, this method will return whatever was configured in the
  791. * {@link #activeTab} config option.</b>
  792. * @return {BoxComponent} The currently active child Component if one <i>is</i> active, or the {@link #activeTab} config value.
  793. */
  794. getActiveTab : function(){
  795. return this.activeTab || null;
  796. },
  797. <div id="method-Ext.TabPanel-getItem"></div>/**
  798. * Gets the specified tab by id.
  799. * @param {String} id The tab id
  800. * @return {Panel} The tab
  801. */
  802. getItem : function(item){
  803. return this.getComponent(item);
  804. },
  805. // private
  806. autoScrollTabs : function(){
  807. this.pos = this.tabPosition=='bottom' ? this.footer : this.header;
  808. var count = this.items.length,
  809. ow = this.pos.dom.offsetWidth,
  810. tw = this.pos.dom.clientWidth,
  811. wrap = this.stripWrap,
  812. wd = wrap.dom,
  813. cw = wd.offsetWidth,
  814. pos = this.getScrollPos(),
  815. l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
  816. if(!this.enableTabScroll || cw < 20){ // 20 to prevent display:none issues
  817. return;
  818. }
  819. if(count == 0 || l <= tw){
  820. // ensure the width is set if there's no tabs
  821. wd.scrollLeft = 0;
  822. wrap.setWidth(tw);
  823. if(this.scrolling){
  824. this.scrolling = false;
  825. this.pos.removeClass('x-tab-scrolling');
  826. this.scrollLeft.hide();
  827. this.scrollRight.hide();
  828. // See here: http://extjs.com/forum/showthread.php?t=49308&highlight=isSafari
  829. if(Ext.isAir || Ext.isWebKit){
  830. wd.style.marginLeft = '';
  831. wd.style.marginRight = '';
  832. }
  833. }
  834. }else{
  835. if(!this.scrolling){
  836. this.pos.addClass('x-tab-scrolling');
  837. // See here: http://extjs.com/forum/showthread.php?t=49308&highlight=isSafari
  838. if(Ext.isAir || Ext.isWebKit){
  839. wd.style.marginLeft = '18px';
  840. wd.style.marginRight = '18px';
  841. }
  842. }
  843. tw -= wrap.getMargins('lr');
  844. wrap.setWidth(tw > 20 ? tw : 20);
  845. if(!this.scrolling){
  846. if(!this.scrollLeft){
  847. this.createScrollers();
  848. }else{
  849. this.scrollLeft.show();
  850. this.scrollRight.show();
  851. }
  852. }
  853. this.scrolling = true;
  854. if(pos > (l-tw)){ // ensure it stays within bounds
  855. wd.scrollLeft = l-tw;
  856. }else{ // otherwise, make sure the active tab is still visible
  857. this.scrollToTab(this.activeTab, false);
  858. }
  859. this.updateScrollButtons();
  860. }
  861. },
  862. // private
  863. createScrollers : function(){
  864. this.pos.addClass('x-tab-scrolling-' + this.tabPosition);
  865. var h = this.stripWrap.dom.offsetHeight;
  866. // left
  867. var sl = this.pos.insertFirst({
  868. cls:'x-tab-scroller-left'
  869. });
  870. sl.setHeight(h);
  871. sl.addClassOnOver('x-tab-scroller-left-over');
  872. this.leftRepeater = new Ext.util.ClickRepeater(sl, {
  873. interval : this.scrollRepeatInterval,
  874. handler: this.onScrollLeft,
  875. scope: this
  876. });
  877. this.scrollLeft = sl;
  878. // right
  879. var sr = this.pos.insertFirst({
  880. cls:'x-tab-scroller-right'
  881. });
  882. sr.setHeight(h);
  883. sr.addClassOnOver('x-tab-scroller-right-over');
  884. this.rightRepeater = new Ext.util.ClickRepeater(sr, {
  885. interval : this.scrollRepeatInterval,
  886. handler: this.onScrollRight,
  887. scope: this
  888. });
  889. this.scrollRight = sr;
  890. },
  891. // private
  892. getScrollWidth : function(){
  893. return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
  894. },
  895. // private
  896. getScrollPos : function(){
  897. return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
  898. },
  899. // private
  900. getScrollArea : function(){
  901. return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
  902. },
  903. // private
  904. getScrollAnim : function(){
  905. return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};
  906. },
  907. // private
  908. getScrollIncrement : function(){
  909. return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);
  910. },
  911. <div id="method-Ext.TabPanel-scrollToTab"></div>/**
  912. * Scrolls to a particular tab if tab scrolling is enabled
  913. * @param {Panel} item The item to scroll to
  914. * @param {Boolean} animate True to enable animations
  915. */
  916. scrollToTab : function(item, animate){
  917. if(!item){
  918. return;
  919. }
  920. var el = this.getTabEl(item),
  921. pos = this.getScrollPos(),
  922. area = this.getScrollArea(),
  923. left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos,
  924. right = left + el.offsetWidth;
  925. if(left < pos){
  926. this.scrollTo(left, animate);
  927. }else if(right > (pos + area)){
  928. this.scrollTo(right - area, animate);
  929. }
  930. },
  931. // private
  932. scrollTo : function(pos, animate){
  933. this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
  934. if(!animate){
  935. this.updateScrollButtons();
  936. }
  937. },
  938. onWheel : function(e){
  939. var d = e.getWheelDelta()*this.wheelIncrement*-1;
  940. e.stopEvent();
  941. var pos = this.getScrollPos(),
  942. newpos = pos + d,
  943. sw = this.getScrollWidth()-this.getScrollArea();
  944. var s = Math.max(0, Math.min(sw, newpos));
  945. if(s != pos){
  946. this.scrollTo(s, false);
  947. }
  948. },
  949. // private
  950. onScrollRight : function(){
  951. var sw = this.getScrollWidth()-this.getScrollArea(),
  952. pos = this.getScrollPos(),
  953. s = Math.min(sw, pos + this.getScrollIncrement());
  954. if(s != pos){
  955. this.scrollTo(s, this.animScroll);
  956. }
  957. },
  958. // private
  959. onScrollLeft : function(){
  960. var pos = this.getScrollPos(),
  961. s = Math.max(0, pos - this.getScrollIncrement());
  962. if(s != pos){
  963. this.scrollTo(s, this.animScroll);
  964. }
  965. },
  966. // private
  967. updateScrollButtons : function(){
  968. var pos = this.getScrollPos();
  969. this.scrollLeft[pos === 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');
  970. this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');
  971. },
  972. // private
  973. beforeDestroy : function() {
  974. Ext.destroy(this.leftRepeater, this.rightRepeater);
  975. this.deleteMembers('strip', 'edge', 'scrollLeft', 'scrollRight', 'stripWrap');
  976. this.activeTab = null;
  977. Ext.TabPanel.superclass.beforeDestroy.apply(this);
  978. }
  979. <div id="cfg-Ext.TabPanel-collapsible"></div>/**
  980. * @cfg {Boolean} collapsible
  981. * @hide
  982. */
  983. <div id="cfg-Ext.TabPanel-header"></div>/**
  984. * @cfg {String} header
  985. * @hide
  986. */
  987. <div id="cfg-Ext.TabPanel-headerAsText"></div>/**
  988. * @cfg {Boolean} headerAsText
  989. * @hide
  990. */
  991. <div id="prop-Ext.TabPanel-header"></div>/**
  992. * @property header
  993. * @hide
  994. */
  995. <div id="cfg-Ext.TabPanel-null"></div>/**
  996. * @cfg title
  997. * @hide
  998. */
  999. <div id="cfg-Ext.TabPanel-tools"></div>/**
  1000. * @cfg {Array} tools
  1001. * @hide
  1002. */
  1003. <div id="cfg-Ext.TabPanel-toolTemplate"></div>/**
  1004. * @cfg {Array} toolTemplate
  1005. * @hide
  1006. */
  1007. <div id="cfg-Ext.TabPanel-hideCollapseTool"></div>/**
  1008. * @cfg {Boolean} hideCollapseTool
  1009. * @hide
  1010. */
  1011. <div id="cfg-Ext.TabPanel-titleCollapse"></div>/**
  1012. * @cfg {Boolean} titleCollapse
  1013. * @hide
  1014. */
  1015. <div id="cfg-Ext.TabPanel-collapsed"></div>/**
  1016. * @cfg {Boolean} collapsed
  1017. * @hide
  1018. */
  1019. <div id="cfg-Ext.TabPanel-layout"></div>/**
  1020. * @cfg {String} layout
  1021. * @hide
  1022. */
  1023. <div id="cfg-Ext.TabPanel-preventBodyReset"></div>/**
  1024. * @cfg {Boolean} preventBodyReset
  1025. * @hide
  1026. */
  1027. });
  1028. Ext.reg('tabpanel', Ext.TabPanel);
  1029. <div id="method-Ext.TabPanel-activate"></div>/**
  1030. * See {@link #setActiveTab}. Sets the specified tab as the active tab. This method fires
  1031. * the {@link #beforetabchange} event which can <tt>return false</tt> to cancel the tab change.
  1032. * @param {String/Panel} tab The id or tab Panel to activate
  1033. * @method activate
  1034. */
  1035. Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab;
  1036. // private utility class used by TabPanel
  1037. Ext.TabPanel.AccessStack = function(){
  1038. var items = [];
  1039. return {
  1040. add : function(item){
  1041. items.push(item);
  1042. if(items.length > 10){
  1043. items.shift();
  1044. }
  1045. },
  1046. remove : function(item){
  1047. var s = [];
  1048. for(var i = 0, len = items.length; i < len; i++) {
  1049. if(items[i] != item){
  1050. s.push(items[i]);
  1051. }
  1052. }
  1053. items = s;
  1054. },
  1055. next : function(){
  1056. return items.pop();
  1057. }
  1058. };
  1059. };
  1060. </pre>
  1061. </body>
  1062. </html>