ext-neptune-debug-w-comments.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. /*
  2. Ext JS 4.1 - JavaScript Library
  3. Copyright (c) 2006-2012, Sencha Inc.
  4. All rights reserved.
  5. licensing@sencha.com
  6. http://www.sencha.com/license
  7. Open Source License
  8. ------------------------------------------------------------------------------------------
  9. This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
  10. http://www.gnu.org/licenses/gpl.html
  11. There are several FLOSS exceptions available for use with this release for
  12. open source applications that are distributed under a license other than GPL.
  13. * Open Source License Exception for Applications
  14. http://www.sencha.com/products/floss-exception.php
  15. * Open Source License Exception for Development
  16. http://www.sencha.com/products/ux-exception.php
  17. Alternate Licensing
  18. ------------------------------------------------------------------------------------------
  19. Commercial and OEM Licenses are available for an alternate download of Ext JS.
  20. This is the appropriate option if you are creating proprietary applications and you are
  21. not prepared to distribute and share the source code of your application under the
  22. GPL v3 license. Please visit http://www.sencha.com/license for more details.
  23. --
  24. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY RIGHTS. See the GNU General Public License for more details.
  25. */
  26. /*
  27. Ext JS 4.1 - JavaScript Library
  28. Copyright (c) 2006-2012, Sencha Inc.
  29. All rights reserved.
  30. licensing@sencha.com
  31. http://www.sencha.com/license
  32. Open Source License
  33. ------------------------------------------------------------------------------------------
  34. This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
  35. http://www.gnu.org/licenses/gpl.html
  36. There are several FLOSS exceptions available for use with this release for
  37. open source applications that are distributed under a license other than GPL.
  38. * Open Source License Exception for Applications
  39. http://www.sencha.com/products/floss-exception.php
  40. * Open Source License Exception for Development
  41. http://www.sencha.com/products/ux-exception.php
  42. Alternate Licensing
  43. ------------------------------------------------------------------------------------------
  44. Commercial and OEM Licenses are available for an alternate download of Ext JS.
  45. This is the appropriate option if you are creating proprietary applications and you are
  46. not prepared to distribute and share the source code of your application under the
  47. GPL v3 license. Please visit http://www.sencha.com/license for more details.
  48. --
  49. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY RIGHTS. See the GNU General Public License for more details.
  50. */
  51. /*
  52. Ext JS 4.1 - JavaScript Library
  53. Copyright (c) 2006-2012, Sencha Inc.
  54. All rights reserved.
  55. licensing@sencha.com
  56. http://www.sencha.com/license
  57. Open Source License
  58. ------------------------------------------------------------------------------------------
  59. This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
  60. http://www.gnu.org/licenses/gpl.html
  61. There are several FLOSS exceptions available for use with this release for
  62. open source applications that are distributed under a license other than GPL.
  63. * Open Source License Exception for Applications
  64. http://www.sencha.com/products/floss-exception.php
  65. * Open Source License Exception for Development
  66. http://www.sencha.com/products/ux-exception.php
  67. Alternate Licensing
  68. ------------------------------------------------------------------------------------------
  69. Commercial and OEM Licenses are available for an alternate download of Ext JS.
  70. This is the appropriate option if you are creating proprietary applications and you are
  71. not prepared to distribute and share the source code of your application under the
  72. GPL v3 license. Please visit http://www.sencha.com/license for more details.
  73. --
  74. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY RIGHTS. See the GNU General Public License for more details.
  75. */
  76. /*
  77. This file is part of Ext JS 4.1
  78. Copyright (c) 2011-2012 Sencha Inc
  79. Contact: http://www.sencha.com/contact
  80. GNU General Public License Usage
  81. This file may be used under the terms of the GNU General Public License version 3.0 as
  82. published by the Free Software Foundation and appearing in the file LICENSE included in the
  83. packaging of this file.
  84. Please review the following information to ensure the GNU General Public License version 3.0
  85. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  86. If you are unsure which license is appropriate for your use, please contact the sales department
  87. at http://www.sencha.com/contact.
  88. Build date: 2012-07-04 21:11:01 (65ff594cd80b9bad45df640c22cc0adb52c95a7b)
  89. */
  90. /**
  91. * Ext.Neptune.*
  92. * Various overrides so the new Neptune theme is supported. This **must** be included for neptune to work.
  93. */
  94. Ext.define('Ext.Neptune.button.Button', {
  95. override: 'Ext.button.Button',
  96. setScale: function(scale) {
  97. this.callParent(arguments);
  98. this.removeCls(this.allowedScales);
  99. this.addCls(scale);
  100. }
  101. });
  102. Ext.define('Ext.Neptune.tab.Bar', {
  103. override: 'Ext.tab.Bar',
  104. onAdd: function(tab) {
  105. tab.position = this.dock;
  106. tab.ui = this.ui;
  107. this.callParent(arguments);
  108. }
  109. });
  110. Ext.define('Ext.Neptune.container.ButtonGroup', {
  111. override: 'Ext.container.ButtonGroup',
  112. beforeRender: function() {
  113. var me = this;
  114. me.callParent();
  115. //we need to add an addition item in here so the ButtonGroup title is centered
  116. if (me.header) {
  117. // Header text cannot flex, but must be natural size if it's being centered
  118. delete me.header.items.items[0].flex;
  119. }
  120. me.callParent(arguments);
  121. }
  122. });
  123. Ext.define('Ext.Neptune.layout.component.field.Trigger', {
  124. override: 'Ext.layout.component.field.Trigger',
  125. sizeBodyContents: function(width, height, ownerContext) {
  126. var me = this,
  127. owner = me.owner,
  128. triggerWidth = owner.getTriggerWidth();
  129. // If we or our ancestor is hidden, we can get a triggerWidth calculation
  130. // of 0. We don't want to resize in this case.
  131. if (owner.hideTrigger || owner.readOnly || triggerWidth > 0) {
  132. ownerContext.inputContext.setProp('width', width, true);
  133. }
  134. }
  135. });
  136. Ext.define('Ext.Neptune.menu.Menu', {
  137. override: 'Ext.menu.Menu',
  138. baseCls: Ext.baseCSSPrefix + 'menu',
  139. initComponent: function() {
  140. var me = this;
  141. me.addEvents(
  142. /**
  143. * @event click
  144. * Fires when this menu is clicked
  145. * @param {Ext.menu.Menu} menu The menu which has been clicked
  146. * @param {Ext.Component} item The menu item that was clicked. `undefined` if not applicable.
  147. * @param {Ext.EventObject} e The underlying {@link Ext.EventObject}.
  148. */
  149. 'click',
  150. /**
  151. * @event mouseenter
  152. * Fires when the mouse enters this menu
  153. * @param {Ext.menu.Menu} menu The menu
  154. * @param {Ext.EventObject} e The underlying {@link Ext.EventObject}
  155. */
  156. 'mouseenter',
  157. /**
  158. * @event mouseleave
  159. * Fires when the mouse leaves this menu
  160. * @param {Ext.menu.Menu} menu The menu
  161. * @param {Ext.EventObject} e The underlying {@link Ext.EventObject}
  162. */
  163. 'mouseleave',
  164. /**
  165. * @event mouseover
  166. * Fires when the mouse is hovering over this menu
  167. * @param {Ext.menu.Menu} menu The menu
  168. * @param {Ext.Component} item The menu item that the mouse is over. `undefined` if not applicable.
  169. * @param {Ext.EventObject} e The underlying {@link Ext.EventObject}
  170. */
  171. 'mouseover'
  172. );
  173. Ext.menu.Manager.register(me);
  174. // Menu classes
  175. if (me.plain) {
  176. me.cls = Ext.baseCSSPrefix + 'menu-plain';
  177. }
  178. // Internal vbox layout, with scrolling overflow
  179. // Placed in initComponent (rather than prototype) in order to support dynamic layout/scroller
  180. // options if we wish to allow for such configurations on the Menu.
  181. // e.g., scrolling speed, vbox align stretch, etc.
  182. if (!me.layout) {
  183. me.layout = {
  184. type: 'vbox',
  185. align: 'stretchmax',
  186. overflowHandler: 'Scroller'
  187. };
  188. if (!me.floating) {
  189. me.layout.align = 'stretch';
  190. }
  191. }
  192. // hidden defaults to false if floating is configured as false
  193. if (me.floating === false && me.initialConfig.hidden !== true) {
  194. me.hidden = false;
  195. }
  196. me.callParent(arguments);
  197. me.on('beforeshow', function() {
  198. var hasItems = !!me.items.length;
  199. // FIXME: When a menu has its show cancelled because of no items, it
  200. // gets a visibility: hidden applied to it (instead of the default display: none)
  201. // Not sure why, but we remove this style when we want to show again.
  202. if (hasItems && me.rendered) {
  203. me.el.setStyle('visibility', null);
  204. }
  205. return hasItems;
  206. });
  207. }
  208. });
  209. Ext.define('Ext.Neptune.panel.Tool', {
  210. override: 'Ext.panel.Tool',
  211. renderTpl: ['<div id="{id}-toolEl" class="{baseCls}-{type}" role="presentation"></div>']
  212. });
  213. Ext.define('Ext.Neptune.window.MessageBox', {
  214. override: 'Ext.window.MessageBox',
  215. initComponent: function() {
  216. var me = this,
  217. i, button;
  218. me.title = '&#160;';
  219. me.topContainer = new Ext.container.Container({
  220. anchor: '100%',
  221. style: {
  222. padding: '10px',
  223. overflow: 'hidden'
  224. },
  225. items: [
  226. me.iconComponent = new Ext.Component({
  227. cls: me.baseCls + '-icon',
  228. width: 50,
  229. height: me.iconHeight,
  230. style: {
  231. 'float': 'left'
  232. }
  233. }),
  234. me.promptContainer = new Ext.container.Container({
  235. layout: {
  236. type: 'anchor'
  237. },
  238. items: [
  239. me.msg = new Ext.Component({
  240. autoEl: { tag: 'span' },
  241. cls: me.baseCls + '-text'
  242. }),
  243. me.textField = new Ext.form.field.Text({
  244. anchor: '100%',
  245. enableKeyEvents: true,
  246. listeners: {
  247. keydown: me.onPromptKey,
  248. scope: me
  249. }
  250. }),
  251. me.textArea = new Ext.form.field.TextArea({
  252. anchor: '100%',
  253. height: 75
  254. })
  255. ]
  256. })
  257. ]
  258. });
  259. me.progressBar = new Ext.ProgressBar({
  260. anchor: '-10',
  261. style: 'margin-left:10px'
  262. });
  263. me.items = [me.topContainer, me.progressBar];
  264. // Create the buttons based upon passed bitwise config
  265. me.msgButtons = [];
  266. for (i = 0; i < 4; i++) {
  267. button = me.makeButton(i);
  268. me.msgButtons[button.itemId] = button;
  269. me.msgButtons.push(button);
  270. }
  271. me.bottomTb = new Ext.toolbar.Toolbar({
  272. ui: 'footer',
  273. dock: 'bottom',
  274. layout: {
  275. pack: 'end'
  276. },
  277. items: [
  278. me.msgButtons[0],
  279. me.msgButtons[1],
  280. me.msgButtons[2],
  281. me.msgButtons[3]
  282. ]
  283. });
  284. me.dockedItems = [me.bottomTb];
  285. me.callParent();
  286. }
  287. });
  288. Ext.define('Ext.Neptune.grid.column.Column', {
  289. override: 'Ext.grid.column.Column',
  290. initComponent: function() {
  291. var me = this,
  292. i,
  293. len,
  294. item;
  295. if (Ext.isDefined(me.header)) {
  296. me.text = me.header;
  297. delete me.header;
  298. }
  299. // Flexed Headers need to have a minWidth defined so that they can never be squeezed out of existence by the
  300. // HeaderContainer's specialized Box layout, the ColumnLayout. The ColumnLayout's overridden calculateChildboxes
  301. // method extends the available layout space to accommodate the "desiredWidth" of all the columns.
  302. if (me.flex) {
  303. me.minWidth = me.minWidth || Ext.grid.plugin.HeaderResizer.prototype.minColWidth;
  304. }
  305. if (!me.triStateSort) {
  306. me.possibleSortStates.length = 2;
  307. }
  308. // A group header; It contains items which are themselves Headers
  309. if (Ext.isDefined(me.columns)) {
  310. me.isGroupHeader = true;
  311. //<debug>
  312. if (me.dataIndex) {
  313. Ext.Error.raise('Ext.grid.column.Column: Group header may not accept a dataIndex');
  314. }
  315. if ((me.width && me.width !== Ext.grid.header.Container.prototype.defaultWidth) || me.flex) {
  316. Ext.Error.raise('Ext.grid.column.Column: Group header does not support setting explicit widths or flexs. The group header width is calculated by the sum of its children.');
  317. }
  318. //</debug>
  319. // The headers become child items
  320. me.items = me.columns;
  321. delete me.columns;
  322. delete me.flex;
  323. delete me.width;
  324. me.cls = (me.cls||'') + ' ' + Ext.baseCSSPrefix + 'group-header';
  325. me.sortable = false;
  326. me.resizable = false;
  327. me.align = 'center';
  328. } else {
  329. // If we are not a group header, then this is not to be used as a container, and must not have a container layout executed, and it must
  330. // acquire layout height from DOM content, not from child items.
  331. me.isContainer = false;
  332. }
  333. me.addCls(Ext.baseCSSPrefix + 'column-header-align-' + me.align);
  334. if (me.sortable) {
  335. me.addCls(Ext.baseCSSPrefix + 'column-header-sortable');
  336. }
  337. // Initialize as a HeaderContainer
  338. Ext.grid.column.Column.superclass.initComponent.call(this, arguments);
  339. me.on({
  340. element: 'el',
  341. click: me.onElClick,
  342. dblclick: me.onElDblClick,
  343. scope: me
  344. });
  345. me.on({
  346. element: 'titleEl',
  347. mouseenter: me.onTitleMouseOver,
  348. mouseleave: me.onTitleMouseOut,
  349. scope: me
  350. });
  351. }
  352. });
  353. Ext.define('Ext.Neptune.Shadow', {
  354. override: 'Ext.Shadow',
  355. offset: 3
  356. });
  357. Ext.define('Ext.Neptune.layout.container.Accordion', {
  358. override: 'Ext.layout.container.Accordion',
  359. targetCls: Ext.baseCSSPrefix + 'box-layout-ct ' + Ext.baseCSSPrefix + 'accordion-body',
  360. collapseFirst : true,
  361. beforeRenderItems: function (items) {
  362. var me = this,
  363. ln = items.length,
  364. i, comp;
  365. for (i = 0; i < ln; i++) {
  366. comp = items[i];
  367. if (!comp.rendered) {
  368. // Add class to the Panel's header before render
  369. comp.on({
  370. beforerender: me.onChildPanelRender,
  371. single: true
  372. });
  373. // Set up initial properties for Panels in an accordion.
  374. if (me.collapseFirst) {
  375. comp.collapseFirst = me.collapseFirst;
  376. }
  377. if (me.hideCollapseTool) {
  378. comp.hideCollapseTool = me.hideCollapseTool;
  379. comp.titleCollapse = true;
  380. }
  381. else if (me.titleCollapse) {
  382. comp.titleCollapse = me.titleCollapse;
  383. }
  384. delete comp.hideHeader;
  385. delete comp.width;
  386. comp.collapsible = true;
  387. comp.title = comp.title || '&#160;';
  388. comp.toolsFirst = true;
  389. comp.addBodyCls(Ext.baseCSSPrefix + 'accordion-body');
  390. // Set initial sizes
  391. if (me.fill) {
  392. // If there is an expanded item, all others must be rendered collapsed.
  393. if (me.expandedItem !== undefined) {
  394. comp.collapsed = true;
  395. }
  396. // Otherwise expand the first item with collapsed explicitly configured as false
  397. else if (comp.hasOwnProperty('collapsed') && comp.collapsed === false) {
  398. me.expandedItem = i;
  399. } else {
  400. comp.collapsed = true;
  401. }
  402. // If we are fitting, then intercept expand/collapse requests.
  403. me.owner.mon(comp, {
  404. show: me.onComponentShow,
  405. beforeexpand: me.onComponentExpand,
  406. beforecollapse: me.onComponentCollapse,
  407. scope: me
  408. });
  409. } else {
  410. comp.animCollapse = me.initialAnimate;
  411. comp.autoScroll = false;
  412. }
  413. comp.border = comp.collapsed;
  414. }
  415. }
  416. // If no collapsed:false Panels found, make the first one expanded.
  417. if (ln && me.expandedItem === undefined) {
  418. me.expandedItem = 0;
  419. comp = items[0];
  420. comp.collapsed = comp.border = false;
  421. }
  422. }
  423. });
  424. //
  425. Ext.define('Ext.Neptune.panel.Header', {
  426. override: 'Ext.panel.Header',
  427. toolsFirst: false,
  428. initComponent: function() {
  429. var me = this,
  430. ruleStyle,
  431. rule,
  432. style,
  433. ui,
  434. tempEl;
  435. me.indicateDragCls = me.baseCls + '-draggable';
  436. me.title = me.title || '&#160;';
  437. me.tools = me.tools || [];
  438. me.items = me.items || [];
  439. me.orientation = me.orientation || 'horizontal';
  440. me.dock = (me.dock) ? me.dock : (me.orientation == 'horizontal') ? 'top' : 'left';
  441. //add the dock as a ui
  442. //this is so we support top/right/left/bottom headers
  443. me.addClsWithUI([me.orientation, me.dock]);
  444. if (me.indicateDrag) {
  445. me.addCls(me.indicateDragCls);
  446. }
  447. // Add Icon
  448. if (!Ext.isEmpty(me.iconCls)) {
  449. me.initIconCmp();
  450. me.items.push(me.iconCmp);
  451. }
  452. // Add Title
  453. if (me.orientation == 'vertical') {
  454. me.layout = {
  455. type : 'vbox',
  456. align: 'center'
  457. };
  458. me.textConfig = {
  459. width: 15,
  460. cls: me.baseCls + '-text',
  461. type: 'text',
  462. text: me.title,
  463. rotate: {
  464. degrees: 90
  465. }
  466. };
  467. ui = me.ui;
  468. if (Ext.isArray(ui)) {
  469. ui = ui[0];
  470. }
  471. ruleStyle = '.' + me.baseCls + '-text-' + ui;
  472. if (Ext.scopeResetCSS) {
  473. ruleStyle = '.' + Ext.baseCSSPrefix + 'reset ' + ruleStyle;
  474. }
  475. rule = Ext.util.CSS.getRule(ruleStyle);
  476. if (rule) {
  477. style = rule.style;
  478. }else {
  479. // We might have been disallowed access to the stylesheet: https://sencha.jira.com/browse/EXTJSIV-5084
  480. style = (tempEl = Ext.getBody().createChild({style: 'position:absolute', cls: me.baseCls + '-text-' + ui})).getStyles('fontFamily', 'fontWeight', 'fontSize', 'color');
  481. tempEl.remove();
  482. }
  483. if (style) {
  484. Ext.apply(me.textConfig, {
  485. 'font-family': style.fontFamily,
  486. 'font-weight': style.fontWeight,
  487. 'font-size': style.fontSize,
  488. fill: style.color
  489. });
  490. }
  491. me.titleCmp = new Ext.draw.Component({
  492. // width : 15,
  493. ariaRole : 'heading',
  494. focusable : false,
  495. viewBox : false,
  496. flex : 1,
  497. id : me.id + '_hd',
  498. autoSize : true,
  499. margins : '5 0 0 0',
  500. items : [ me.textConfig ],
  501. xhooks: {
  502. setSize: function (width) {
  503. // don't pass 2nd arg (height) on to setSize or we break 'flex:1'
  504. this.callParent([width]);
  505. }
  506. },
  507. // this is a bit of a cheat: we are not selecting an element of titleCmp
  508. // but rather of titleCmp.items[0] (so we cannot use childEls)
  509. childEls : [
  510. { name: 'textEl', select: '.' + me.baseCls + '-text' }
  511. ]
  512. });
  513. } else {
  514. me.layout = {
  515. type : 'hbox',
  516. align: 'middle'
  517. };
  518. me.titleCmp = new Ext.Component({
  519. // height : 15,
  520. xtype : 'component',
  521. ariaRole : 'heading',
  522. focusable : false,
  523. noWrap : true,
  524. flex : 1,
  525. id : me.id + '_hd',
  526. cls : me.baseCls + '-text-container',
  527. renderTpl : me.getTpl('headingTpl'),
  528. renderData: {
  529. title: me.title,
  530. cls : me.baseCls,
  531. ui : me.ui
  532. },
  533. childEls : ['textEl']
  534. });
  535. }
  536. // Add tools
  537. if (me.toolsFirst) {
  538. me.addCls(me.baseCls + '-tools-first');
  539. me.items = me.items.concat(me.tools);
  540. me.items.push(me.titleCmp);
  541. } else {
  542. me.items.push(me.titleCmp);
  543. me.items = me.items.concat(me.tools);
  544. }
  545. Ext.panel.Header.superclass.initComponent.call(this, arguments);
  546. me.on({
  547. click: me.onClick,
  548. mouseover: me.onMouseOver,
  549. mouseout : me.onMouseOut,
  550. mousedown: me.onMouseDown,
  551. mouseup: me.onMouseUp,
  552. element: 'el',
  553. scope: me
  554. });
  555. },
  556. // private
  557. onRender: function() {
  558. var me = this;
  559. me.doc = Ext.getDoc();
  560. me.callParent(arguments);
  561. },
  562. // private
  563. onMouseOver: function() {
  564. this.addCls(this.baseCls + '-over');
  565. },
  566. // private
  567. onMouseOut: function() {
  568. this.removeCls(this.baseCls + '-over');
  569. this.removeCls(this.baseCls + '-pressed');
  570. },
  571. // private
  572. onMouseDown: function() {
  573. this.addCls(this.baseCls + '-pressed');
  574. },
  575. // private
  576. onMouseUp: function(e) {
  577. this.removeCls(this.baseCls + '-pressed');
  578. }
  579. });
  580. Ext.define('Ext.Neptune.panel.Panel', {
  581. override: 'Ext.panel.Panel',
  582. /**
  583. * True to makes the tools of this panels header go to the left of the panel header title. Used for accordions
  584. * @cfg {Boolean} toolsFirst
  585. * @private
  586. */
  587. toolsFirst: false,
  588. updateHeader: function(force) {
  589. var me = this,
  590. header = me.header,
  591. title = me.title,
  592. tools = me.tools;
  593. if (!me.preventHeader && (force || title || (tools && tools.length))) {
  594. if (header) {
  595. header.show();
  596. } else {
  597. header = me.header = new Ext.panel.Header({
  598. title : title,
  599. orientation : (me.headerPosition == 'left' || me.headerPosition == 'right') ? 'vertical' : 'horizontal',
  600. dock : me.headerPosition || 'top',
  601. textCls : me.headerTextCls,
  602. iconCls : me.iconCls,
  603. baseCls : me.baseCls + '-header',
  604. tools : tools,
  605. ui : me.ui,
  606. id : me.id + '_header',
  607. indicateDrag: me.draggable,
  608. toolsFirst : me.toolsFirst,
  609. border : me.border,
  610. frame : me.frame && me.frameHeader,
  611. ignoreParentFrame : me.frame || me.overlapHeader,
  612. ignoreBorderManagement: me.frame || me.ignoreHeaderBorderManagement,
  613. listeners : me.collapsible && me.titleCollapse ? {
  614. click: me.toggleCollapse,
  615. scope: me
  616. } : null
  617. });
  618. me.addDocked(header, 0);
  619. // Reference the Header's tool array.
  620. // Header injects named references.
  621. me.tools = header.tools;
  622. }
  623. me.initHeaderAria();
  624. me.addCls(me.baseCls + '-hasheader-' + me.headerPosition);
  625. } else if (header) {
  626. header.hide();
  627. me.removeCls(me.baseCls + '-hasheader-' + me.headerPosition);
  628. }
  629. }
  630. });
  631. Ext.define('Ext.Neptune.resizer.Splitter', {
  632. override: 'Ext.resizer.Splitter',
  633. onRender: function() {
  634. var me = this;
  635. me.callParent(arguments);
  636. // Add listeners on the mini-collapse tool unless performCollapse is set to false
  637. if (me.performCollapse !== false) {
  638. if (me.renderData.collapsible) {
  639. me.mon(me.collapseEl, 'click', me.toggleTargetCmp, me);
  640. }
  641. if (me.collapseOnDblClick) {
  642. me.mon(me.el, 'dblclick', me.toggleTargetCmp, me);
  643. }
  644. }
  645. // Ensure the mini collapse icon is set to the correct direction when the target is collapsed/expanded by any means
  646. me.mon(me.getCollapseTarget(), {
  647. collapse: me.onTargetCollapse,
  648. expand: me.onTargetExpand,
  649. scope: me
  650. });
  651. me.mon(me.el, 'mouseover', me.onMouseOver, me);
  652. me.mon(me.el, 'mouseout', me.onMouseOut, me);
  653. me.el.unselectable();
  654. me.tracker = Ext.create(me.getTrackerConfig());
  655. // Relay the most important events to our owner (could open wider later):
  656. me.relayEvents(me.tracker, [ 'beforedragstart', 'dragstart', 'dragend' ]);
  657. },
  658. onMouseOver: function() {
  659. this.el.addCls(this.baseCls + '-over');
  660. },
  661. onMouseOut: function() {
  662. this.el.removeCls(this.baseCls + '-over');
  663. }
  664. });
  665. Ext.define('Ext.Neptune.tree.Panel', {
  666. override: 'Ext.tree.Panel',
  667. initComponent: function() {
  668. var me = this,
  669. cls = [me.treeCls],
  670. view;
  671. if (me.useArrows) {
  672. cls.push(Ext.baseCSSPrefix + 'tree-arrows');
  673. } else {
  674. cls.push(Ext.baseCSSPrefix + 'tree-no-arrows');
  675. }
  676. if (me.lines) {
  677. cls.push(Ext.baseCSSPrefix + 'tree-lines');
  678. } else {
  679. cls.push(Ext.baseCSSPrefix + 'tree-no-lines');
  680. }
  681. if (Ext.isString(me.store)) {
  682. me.store = Ext.StoreMgr.lookup(me.store);
  683. } else if (!me.store || Ext.isObject(me.store) && !me.store.isStore) {
  684. me.store = new Ext.data.TreeStore(Ext.apply({}, me.store || {}, {
  685. root: me.root,
  686. fields: me.fields,
  687. model: me.model,
  688. folderSort: me.folderSort
  689. }));
  690. } else if (me.root) {
  691. me.store = Ext.data.StoreManager.lookup(me.store);
  692. me.store.setRootNode(me.root);
  693. if (me.folderSort !== undefined) {
  694. me.store.folderSort = me.folderSort;
  695. me.store.sort();
  696. }
  697. }
  698. // I'm not sure if we want to this. It might be confusing
  699. // if (me.initialConfig.rootVisible === undefined && !me.getRootNode()) {
  700. // me.rootVisible = false;
  701. // }
  702. me.viewConfig = Ext.applyIf(me.viewConfig || {}, {
  703. rootVisible: me.rootVisible,
  704. animate: me.enableAnimations,
  705. singleExpand: me.singleExpand,
  706. node: me.store.getRootNode(),
  707. hideHeaders: me.hideHeaders
  708. });
  709. me.mon(me.store, {
  710. scope: me,
  711. rootchange: me.onRootChange,
  712. clear: me.onClear
  713. });
  714. me.relayEvents(me.store, [
  715. /**
  716. * @event beforeload
  717. * @alias Ext.data.Store#beforeload
  718. */
  719. 'beforeload',
  720. /**
  721. * @event load
  722. * @alias Ext.data.Store#load
  723. */
  724. 'load'
  725. ]);
  726. me.store.on({
  727. /**
  728. * @event itemappend
  729. * @alias Ext.data.TreeStore#append
  730. */
  731. append: me.createRelayer('itemappend'),
  732. /**
  733. * @event itemremove
  734. * @alias Ext.data.TreeStore#remove
  735. */
  736. remove: me.createRelayer('itemremove'),
  737. /**
  738. * @event itemmove
  739. * @alias Ext.data.TreeStore#move
  740. */
  741. move: me.createRelayer('itemmove'),
  742. /**
  743. * @event iteminsert
  744. * @alias Ext.data.TreeStore#insert
  745. */
  746. insert: me.createRelayer('iteminsert'),
  747. /**
  748. * @event beforeitemappend
  749. * @alias Ext.data.TreeStore#beforeappend
  750. */
  751. beforeappend: me.createRelayer('beforeitemappend'),
  752. /**
  753. * @event beforeitemremove
  754. * @alias Ext.data.TreeStore#beforeremove
  755. */
  756. beforeremove: me.createRelayer('beforeitemremove'),
  757. /**
  758. * @event beforeitemmove
  759. * @alias Ext.data.TreeStore#beforemove
  760. */
  761. beforemove: me.createRelayer('beforeitemmove'),
  762. /**
  763. * @event beforeiteminsert
  764. * @alias Ext.data.TreeStore#beforeinsert
  765. */
  766. beforeinsert: me.createRelayer('beforeiteminsert'),
  767. /**
  768. * @event itemexpand
  769. * @alias Ext.data.TreeStore#expand
  770. */
  771. expand: me.createRelayer('itemexpand'),
  772. /**
  773. * @event itemcollapse
  774. * @alias Ext.data.TreeStore#collapse
  775. */
  776. collapse: me.createRelayer('itemcollapse'),
  777. /**
  778. * @event beforeitemexpand
  779. * @alias Ext.data.TreeStore#beforeexpand
  780. */
  781. beforeexpand: me.createRelayer('beforeitemexpand'),
  782. /**
  783. * @event beforeitemcollapse
  784. * @alias Ext.data.TreeStore#beforecollapse
  785. */
  786. beforecollapse: me.createRelayer('beforeitemcollapse')
  787. });
  788. // If the user specifies the headers collection manually then dont inject our own
  789. if (!me.columns) {
  790. if (me.initialConfig.hideHeaders === undefined) {
  791. me.hideHeaders = true;
  792. }
  793. me.autoWidth = true;
  794. me.addCls(Ext.baseCSSPrefix + 'autowidth-table');
  795. me.columns = [{
  796. xtype : 'treecolumn',
  797. text : 'Name',
  798. width : Ext.isIE6 ? null : 10000,
  799. dataIndex: me.displayField
  800. }];
  801. }
  802. if (me.cls) {
  803. cls.push(me.cls);
  804. }
  805. me.cls = cls.join(' ');
  806. Ext.tree.Panel.superclass.initComponent.apply(me, arguments);
  807. view = me.getView();
  808. // Only IE6 requires manual minimum sizing with a stretcher.
  809. // All other browsers allow the 1000px wide header to impose a minimum size.
  810. if (Ext.isIE6 && me.autoWidth) {
  811. view.afterRender = Ext.Function.createSequence(view.afterRender, function() {
  812. this.stretcher = view.el.down('th').createChild({style:"height:0px;width:" + (this.getWidth() - Ext.getScrollbarSize().width) + "px"});
  813. });
  814. view.afterComponentLayout = Ext.Function.createSequence(view.afterComponentLayout, function() {
  815. this.stretcher.setWidth((this.getWidth() - Ext.getScrollbarSize().width));
  816. });
  817. }
  818. me.relayEvents(view, [
  819. /**
  820. * @event checkchange
  821. * Fires when a node with a checkbox's checked property changes
  822. * @param {Ext.data.Model} node The node who's checked property was changed
  823. * @param {Boolean} checked The node's new checked state
  824. */
  825. 'checkchange',
  826. /**
  827. * @event afteritemexpand
  828. * @alias Ext.tree.View#afteritemexpand
  829. */
  830. 'afteritemexpand',
  831. /**
  832. * @event afteritemcollapse
  833. * @alias Ext.tree.View#afteritemcollapse
  834. */
  835. 'afteritemcollapse'
  836. ]);
  837. // If the root is not visible and there is no rootnode defined, then just lets load the store
  838. if (!view.rootVisible && !me.getRootNode()) {
  839. me.setRootNode({
  840. expanded: true
  841. });
  842. }
  843. }
  844. });