themes.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. Ext.require([
  2. 'Ext.window.Window',
  3. 'Ext.panel.Panel',
  4. 'Ext.toolbar.*',
  5. 'Ext.tree.Panel',
  6. 'Ext.container.Viewport',
  7. 'Ext.container.ButtonGroup',
  8. 'Ext.form.*',
  9. 'Ext.tab.*',
  10. 'Ext.slider.*',
  11. 'Ext.layout.*',
  12. 'Ext.button.*',
  13. 'Ext.grid.*',
  14. 'Ext.data.*',
  15. 'Ext.util.*',
  16. 'Ext.perf.Monitor'
  17. ]);
  18. function hasOption (name) {
  19. return window.location.search.indexOf(name) >= 0;
  20. }
  21. var useDeferRender = true,
  22. rtl = hasOption('rtl');
  23. if (hasOption('diag')) {
  24. Ext.require([
  25. 'Ext.diag.layout.ContextItem',
  26. 'Ext.diag.layout.Context'
  27. ]);
  28. }
  29. if (rtl) {
  30. Ext.require([
  31. 'Ext.rtl.Element',
  32. 'Ext.rtl.AbstractComponent'
  33. ]);
  34. }
  35. function getBasicPanel () {
  36. return {
  37. xtype: 'panel',
  38. x: 20, y: 20,
  39. width : 150,
  40. height: 90,
  41. rtl: rtl,
  42. title: 'Basic Panel',
  43. animCollapse: true,
  44. bodyPadding: 5,
  45. html : 'Some content'
  46. };
  47. }
  48. function getCollapsedPanel () {
  49. return {
  50. xtype: 'panel',
  51. x: 20, y: 120,
  52. width : 150,
  53. height: 70,
  54. rtl: rtl,
  55. title: 'Collapsed Panel',
  56. animCollapse: true,
  57. bodyPadding: 5,
  58. html : 'Some content',
  59. collapsible: true,
  60. collapsed: true
  61. };
  62. }
  63. function getMaskedPanel (rtl) {
  64. return Ext.widget({
  65. xtype: 'panel',
  66. x: 180, y: 20,
  67. width : 130,
  68. height: 170,
  69. rtl: rtl,
  70. title: 'Masked Panel',
  71. bodyPadding: 5,
  72. html : 'Some content',
  73. animCollapse: true,
  74. collapsible: true
  75. });
  76. }
  77. function getFramedPanel () {
  78. return {
  79. xtype: 'panel',
  80. x: 320, y: 20,
  81. width : 170,
  82. height: 100,
  83. rtl: rtl,
  84. title: 'Framed Panel',
  85. animCollapse: true,
  86. dockedItems: [{
  87. dock: 'top',
  88. xtype: 'toolbar',
  89. items: [{
  90. text: 'test'
  91. }]
  92. }, {
  93. dock: 'right',
  94. xtype: 'toolbar',
  95. items: [{
  96. text: 'test B'
  97. }]
  98. }, {
  99. dock: 'left',
  100. xtype: 'toolbar',
  101. items: [{
  102. text: 'test A'
  103. }]
  104. }],
  105. html : 'Some content',
  106. frame: true
  107. };
  108. }
  109. function getCollapsedFramedPanel () {
  110. return {
  111. xtype: 'panel',
  112. x: 320, y: 130,
  113. width : 170,
  114. height: 60,
  115. rtl: rtl,
  116. title: 'Collapsed Framed Panel',
  117. animCollapse: true,
  118. bodyPadding: 5,
  119. bodyBorder: true,
  120. html : 'Some content',
  121. frame : true,
  122. collapsible: true,
  123. collapsed: true
  124. };
  125. }
  126. function getPanelWithToolbars () {
  127. /**
  128. * Toolbar with a menu
  129. */
  130. /*var xxxxxxx = Ext.widget('menu', {
  131. items: [
  132. {text: 'Menu item'},
  133. {text: 'Check 1', checked: true},
  134. {text: 'Check 2', checked: false},
  135. '-',
  136. {text: 'Option 1', checked: true, group: 'opts'},
  137. {text: 'Option 2', checked: false, group: 'opts'},
  138. '-',
  139. {
  140. text: 'Sub-items',
  141. menu: Ext.widget('menu', {
  142. items: [
  143. {text: 'Item 1'},
  144. {text: 'Item 2'}
  145. ]
  146. })
  147. }
  148. ]
  149. });*/
  150. return {
  151. xtype: 'panel',
  152. id: 'panelWithToolbars',
  153. x: 660, y: 20,
  154. width : 450,
  155. height: 170,
  156. rtl: rtl,
  157. title: 'Basic Panel With Toolbars',
  158. collapsible: true,
  159. tbar: {
  160. id: 'panelWithToolbars_tbar',
  161. items: [{
  162. xtype: 'buttongroup',
  163. title: 'Button Group',
  164. id: 'panelWithToolbars_btngroup',
  165. columns: 2,
  166. defaults: {
  167. scale: 'small'
  168. },
  169. items: [
  170. {
  171. xtype:'splitbutton',
  172. text: 'Menu Button',
  173. iconCls: 'add16',
  174. menu: [{text: 'Menu Button 1'}]
  175. },
  176. {
  177. xtype:'splitbutton',
  178. text: 'Cut',
  179. icon: '../shared/icons/fam/cross.gif',
  180. id: 'panelWithToolbars_splitbtn',
  181. menu: [{text: 'Cut Menu Item'}]
  182. }
  183. ]
  184. }]
  185. },
  186. bbar: {
  187. id: 'panelWithToolbars_bbar',
  188. items: [
  189. 'Toolbar',
  190. ' ',
  191. '-',
  192. {text: 'Button'},
  193. {
  194. text: 'Menu Button',
  195. id : 'menu-btn',
  196. menu: [
  197. {text: 'Menu item'},
  198. {text: 'Check 1', checked: true},
  199. {text: 'Check 2', checked: false},
  200. '-',
  201. {text: 'Option 1', checked: true, group: 'opts'},
  202. {text: 'Option 2', checked: false, group: 'opts'},
  203. '-',
  204. {
  205. text: 'Sub-items',
  206. menu: Ext.widget('menu', {
  207. items: [
  208. {text: 'Item 1'},
  209. {text: 'Item 2'}
  210. ]
  211. })
  212. }
  213. ]
  214. },
  215. {
  216. xtype: 'splitbutton',
  217. text : 'Split Button',
  218. menu : Ext.widget('menu', {
  219. items: [
  220. {text: 'Item 1'},
  221. {text: 'Item 2'}
  222. ]
  223. })
  224. },
  225. {
  226. xtype : 'button',
  227. enableToggle: true,
  228. pressed : true,
  229. text : 'Toggle Button'
  230. }
  231. ]
  232. },
  233. lbar: {
  234. id: 'panelWithToolbars_lbar',
  235. items: [
  236. { text: 'Left' }
  237. ]
  238. },
  239. rbar: {
  240. id: 'panelWithToolbars_rbar',
  241. items: [
  242. { text: 'Right' }
  243. ]
  244. }
  245. };
  246. }
  247. function getFormWidgets () {
  248. return {
  249. xtype: 'form',
  250. id : 'form-widgets',
  251. title: 'Form Widgets',
  252. x: 20, y: 200,
  253. width : 630,
  254. height: 750,
  255. rtl: rtl,
  256. frame: true,
  257. collapsible: true,
  258. tools: [
  259. {type:'toggle'},
  260. {type:'close'},
  261. {type:'minimize'},
  262. {type:'maximize'},
  263. {type:'restore'},
  264. {type:'gear'},
  265. {type:'pin'},
  266. {type:'unpin'},
  267. {type:'right'},
  268. {type:'left'},
  269. {type:'down'},
  270. {type:'refresh'},
  271. {type:'minus'},
  272. {type:'plus'},
  273. {type:'help'},
  274. {type:'search'},
  275. {type:'save'},
  276. {type:'print'}
  277. ],
  278. bodyPadding: '10 20',
  279. defaults: {
  280. anchor : '98%',
  281. msgTarget : 'side',
  282. allowBlank: false
  283. },
  284. items: [
  285. {
  286. xtype: 'label',
  287. text : 'Plain Label'
  288. },
  289. {
  290. fieldLabel: 'TextField',
  291. xtype : 'textfield',
  292. name : 'someField',
  293. emptyText : 'Enter a value'
  294. },
  295. {
  296. fieldLabel: 'ComboBox',
  297. xtype: 'combo',
  298. store: ['Foo', 'Bar']
  299. },
  300. {
  301. fieldLabel: 'DateField',
  302. xtype : 'datefield',
  303. name : 'date'
  304. },
  305. {
  306. fieldLabel: 'TimeField',
  307. name: 'time',
  308. xtype: 'timefield'
  309. },
  310. {
  311. fieldLabel: 'NumberField',
  312. xtype : 'numberfield',
  313. name : 'number',
  314. emptyText : '(This field is optional)',
  315. allowBlank: true
  316. },
  317. {
  318. fieldLabel: 'TextArea',
  319. xtype : 'textareafield',
  320. name : 'message',
  321. cls : 'x-form-valid',
  322. value : 'This field is hard-coded to have the "valid" style (it will require some code changes to add/remove this style dynamically)'
  323. },
  324. {
  325. fieldLabel: 'Checkboxes',
  326. xtype: 'checkboxgroup',
  327. columns: [100,100],
  328. items: [
  329. {boxLabel: 'Foo', checked: true,id:'fooChk',inputId:'fooChkInput'},
  330. {boxLabel: 'Bar'}
  331. ]
  332. },
  333. {
  334. fieldLabel: 'Radios',
  335. xtype: 'radiogroup',
  336. columns: [100,100],
  337. items: [{boxLabel: 'Foo', checked: true, name: 'radios'},{boxLabel: 'Bar', name: 'radios'}]
  338. },
  339. {
  340. hideLabel : true,
  341. id : 'htmleditor',
  342. xtype : 'htmleditor',
  343. name : 'html',
  344. enableColors: false,
  345. value : 'Mouse over toolbar for tooltips.<br /><br />The HTMLEditor IFrame requires a refresh between a stylesheet switch to get accurate colors.',
  346. height : 110
  347. },
  348. {
  349. xtype : 'fieldset',
  350. title : 'Plain Fieldset',
  351. items: [
  352. {
  353. hideLabel: true,
  354. xtype: 'radiogroup',
  355. items: [
  356. {boxLabel: 'Radio A', checked: true, name: 'radiogrp2'},
  357. {boxLabel: 'Radio B', name: 'radiogrp2'}
  358. ]
  359. }
  360. ]
  361. },
  362. {
  363. xtype : 'fieldset',
  364. title : 'Collapsible Fieldset',
  365. collapsible: true,
  366. items: [
  367. { xtype: 'checkbox', boxLabel: 'Checkbox 1' },
  368. { xtype: 'checkbox', boxLabel: 'Checkbox 2' }
  369. ]
  370. },
  371. {
  372. xtype : 'fieldset',
  373. title : 'Checkbox Fieldset',
  374. checkboxToggle: true,
  375. items: [
  376. { xtype: 'radio', boxLabel: 'Radio 1', name: 'radiongrp1' },
  377. { xtype: 'radio', boxLabel: 'Radio 2', name: 'radiongrp1' }
  378. ]
  379. }
  380. ],
  381. buttons: [
  382. {
  383. text :'Toggle Enabled',
  384. handler: function() {
  385. this.up('form').items.each(function(item) {
  386. item.setDisabled(!item.disabled);
  387. });
  388. }
  389. },
  390. {
  391. text : 'Reset Form',
  392. handler: function() {
  393. Ext.getCmp('form-widgets').getForm().reset();
  394. }
  395. },
  396. {
  397. text : 'Validate',
  398. handler: function() {
  399. Ext.getCmp('form-widgets').getForm().isValid();
  400. }
  401. }
  402. ]
  403. };
  404. }
  405. function getBorderLayout() {
  406. return {
  407. xtype: 'panel',
  408. width : 450,
  409. height: 350,
  410. rtl: rtl,
  411. x: 660, y: 200,
  412. title : 'BorderLayout Panel',
  413. layout: {
  414. type: 'border',
  415. padding: 5
  416. },
  417. collapsible: true,
  418. defaults: {
  419. collapsible: true,
  420. split : true
  421. },
  422. items: [
  423. {
  424. title : 'North',
  425. region : 'north',
  426. html : 'North',
  427. ctitle : 'North',
  428. //margins: '5 5 0 5', // TRBL
  429. height : 70
  430. },
  431. {
  432. title : 'South',
  433. region : 'south',
  434. html : 'South',
  435. collapseMode: 'mini',
  436. //margins : '0 5 5 5', // TRBL
  437. height : 70
  438. },
  439. {
  440. title : 'West',
  441. region : 'west',
  442. html : 'West',
  443. collapseMode: 'mini',
  444. //margins : '0 0 0 5', // TRBL
  445. width : 100
  446. },
  447. {
  448. title : 'East',
  449. region : 'east',
  450. html : 'East',
  451. //margins: '0 5 0 0', // TRBL
  452. width : 100
  453. },
  454. {
  455. title : 'Center',
  456. region : 'center',
  457. collapsible: false,
  458. html : 'Center'
  459. }
  460. ]
  461. };
  462. }
  463. function getStore () {
  464. var myData = [
  465. ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
  466. ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
  467. ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
  468. ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
  469. ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
  470. ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
  471. ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
  472. ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
  473. ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
  474. ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am']
  475. ];
  476. return Ext.create('Ext.data.ArrayStore', {
  477. fields: [
  478. {name: 'company'},
  479. {name: 'price', type: 'float', convert: null},
  480. {name: 'change', type: 'float', convert: null},
  481. {name: 'pctChange', type: 'float', convert: null},
  482. {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
  483. ],
  484. sorters: {
  485. property : 'company',
  486. direction: 'ASC'
  487. },
  488. data: myData,
  489. pageSize: 8
  490. });
  491. }
  492. function getGrid () {
  493. var store = getStore(),
  494. pagingBar = Ext.widget('pagingtoolbar', {
  495. store : store,
  496. displayInfo: true,
  497. displayMsg : 'Displaying topics {0} - {1} of {2}'
  498. });
  499. return {
  500. xtype: 'gridpanel',
  501. height: 200,
  502. width : 450,
  503. rtl: rtl,
  504. x: 660, y: 560,
  505. title: 'GridPanel',
  506. collapsible: true,
  507. deferRowRender: useDeferRender,
  508. store: store,
  509. columns: [
  510. {header: "Company", flex: 1, sortable: true, dataIndex: 'company'},
  511. {header: "Price", width: 75, sortable: true, dataIndex: 'price'},
  512. {header: "Change", width: 75, sortable: true, dataIndex: 'change'},
  513. {header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange'},
  514. {header: "Last Updated", width: 85, sortable: true, xtype: 'datecolumn', dataIndex: 'lastChange'}
  515. ],
  516. loadMask: true,
  517. viewConfig: {
  518. stripeRows: true
  519. },
  520. bbar: pagingBar,
  521. tbar: [
  522. {text: 'Toolbar'},
  523. '->',
  524. {
  525. xtype: 'triggerfield',
  526. trigger1Cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  527. trigger2Cls: Ext.baseCSSPrefix + 'form-search-trigger'
  528. }
  529. ]
  530. };
  531. }
  532. function getAccordion () {
  533. var tree = Ext.create('Ext.tree.Panel', {
  534. title: 'TreePanel',
  535. deferRowRender: useDeferRender,
  536. root: {
  537. text: 'Root Node',
  538. expanded: true,
  539. children: [{
  540. text: 'Item 1',
  541. leaf: true
  542. }, {
  543. text: 'Item 2',
  544. leaf: true
  545. }, {
  546. text: 'Folder',
  547. children: [{
  548. text: 'Item 3',
  549. leaf: true
  550. }]
  551. }]
  552. }
  553. });
  554. return {
  555. title : 'Accordion and TreePanel',
  556. collapsible: true,
  557. layout: 'accordion',
  558. x: 660, y: 770,
  559. width : 450,
  560. height: 240,
  561. rtl: rtl,
  562. bodyStyle: {
  563. 'background-color': '#eee'
  564. },
  565. items: [
  566. tree, {
  567. title: 'Item 2',
  568. html: 'Some content'
  569. }, {
  570. title: 'Item 3',
  571. html : 'Some content'
  572. }
  573. ]
  574. };
  575. }
  576. function getTabs (config) {
  577. return Ext.apply({
  578. xtype: 'tabpanel',
  579. width : 310,
  580. height: 150,
  581. rtl: rtl,
  582. activeTab: 0,
  583. defaults: {
  584. bodyStyle: 'padding:10px;'
  585. },
  586. items: [
  587. {
  588. title: 'Tab 1',
  589. html : 'Free-standing tab panel'
  590. },
  591. {
  592. title : 'Tab 2',
  593. closable: true
  594. },
  595. {
  596. title : 'Tab 3',
  597. closable: true
  598. }
  599. ]
  600. }, config);
  601. }
  602. function getScrollingTabs () {
  603. return getTabs({
  604. x: 20, y: 960,
  605. enableTabScroll: true,
  606. items: [
  607. {
  608. title: 'Tab 1',
  609. html : 'Tab panel 1 content'
  610. },
  611. {
  612. title: 'Tab 2',
  613. html : 'Tab panel 2 content',
  614. closable: true
  615. },
  616. {
  617. title: 'Tab 3',
  618. html : 'Tab panel 3 content',
  619. closable: true
  620. },
  621. {
  622. title: 'Tab 4',
  623. html : 'Tab panel 4 content',
  624. closable: true
  625. },
  626. {
  627. title: 'Tab 5',
  628. html : 'Tab panel 5 content',
  629. closable: true
  630. },
  631. {
  632. title: 'Tab 6',
  633. html : 'Tab panel 6 content',
  634. closable: true
  635. }
  636. ]
  637. });
  638. }
  639. function getPlainTabs () {
  640. return getTabs({
  641. plain: true,
  642. x : 340, y: 960
  643. });
  644. }
  645. function getDatePicker () {
  646. return {
  647. xtype: 'panel',
  648. x: 20, y: 1120,
  649. width : 180,
  650. rtl: rtl,
  651. border: false,
  652. items: {
  653. xtype: 'datepicker'
  654. }
  655. };
  656. }
  657. function getProgressBar () {
  658. var progressbar = Ext.widget('progressbar', {
  659. value: 0.5
  660. });
  661. if (!hasOption('nopbar')) {
  662. setTimeout(function() {
  663. progressbar.wait({
  664. //animate: true,
  665. text: 'Progress text...'
  666. });
  667. }, 7000);
  668. }
  669. return {
  670. xtype: 'panel',
  671. title: 'ProgressBar / Slider',
  672. x: 660, y: 1020,
  673. width: 450,
  674. height: 200,
  675. rtl: rtl,
  676. bodyPadding: 5,
  677. layout: 'anchor',
  678. items: [
  679. progressbar,
  680. {
  681. xtype : 'slider',
  682. hideLabel: true,
  683. value : 50,
  684. margin : '5 0 0 0',
  685. anchor : '100%'
  686. },
  687. {
  688. xtype : 'slider',
  689. vertical: true,
  690. value : 50,
  691. height : 100,
  692. margin : '5 0 0 0'
  693. }
  694. ]
  695. };
  696. }
  697. function getFramedGrid () {
  698. return {
  699. width: 450,
  700. height:182,
  701. x: 660, y: 1230,
  702. rtl: rtl,
  703. xtype: 'grid',
  704. title: 'Framed Grid',
  705. collapsible: true,
  706. store: getStore(),
  707. multiSelect: true,
  708. emptyText: 'No images to display',
  709. deferRowRender: useDeferRender,
  710. frame: true,
  711. enableColumnMove: false,
  712. columns: [
  713. {header: "Company", flex: 1, sortable: true, dataIndex: 'company'},
  714. {header: "Price", width: 75, sortable: true, dataIndex: 'price'},
  715. {header: "Change", width: 75, sortable: true, dataIndex: 'change'}
  716. ]
  717. };
  718. }
  719. function getBasicWindow () {
  720. return Ext.widget('window', {
  721. id: 'basicWindow',
  722. x: 500, y: 20,
  723. hidden: false,
  724. width : 150,
  725. height : 170,
  726. minWidth: 150,
  727. minHeight: 150,
  728. maxHeight: 170,
  729. rtl: rtl,
  730. title: 'Window',
  731. bodyPadding: 5,
  732. html : 'Click Submit for Confirmation Msg.',
  733. collapsible: true,
  734. floating : false,
  735. closable : false,
  736. draggable : false,
  737. resizable: { handles: 's' },
  738. animCollapse: true,
  739. tbar: [
  740. {text: 'Toolbar'}
  741. ],
  742. buttons: [
  743. {
  744. text : 'Submit',
  745. id : 'message_box',
  746. handler: function() {
  747. Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?');
  748. }
  749. }
  750. ]
  751. });
  752. }
  753. function addResizer(containerEl) {
  754. var rszEl = containerEl.createChild({
  755. style: 'background: transparent;position:absolute;left:210px;top:1120px;width:440px;height:200px;overflow:hidden',
  756. html: '<div style="padding:20px;position:absolute">Resizable handles</div>'
  757. });
  758. Ext.create('Ext.resizer.Resizer', {
  759. id: 'resizer',
  760. el: rszEl,
  761. handles: 'all',
  762. pinned: true
  763. });
  764. }
  765. function addFormWindow () {
  766. Ext.widget('window', {
  767. x: 660, y: 1230,
  768. width : 450,
  769. // height : 360,
  770. minWidth: 450,
  771. rtl: rtl,
  772. title: 'Window',
  773. bodyPadding: '5 5 0 5',
  774. collapsible: true,
  775. closable : false,
  776. draggable : false,
  777. resizable: { handles: 's' },
  778. animCollapse: true,
  779. items: [
  780. {
  781. xtype : 'fieldset',
  782. title : 'Plain Fieldset',
  783. items: [
  784. {
  785. fieldLabel: 'TextField',
  786. xtype : 'textfield',
  787. name : 'someField',
  788. emptyText : 'Enter a value',
  789. anchor : '100%'
  790. },
  791. {
  792. fieldLabel: 'ComboBox',
  793. xtype : 'combo',
  794. store : ['Foo', 'Bar'],
  795. anchor : '100%'
  796. },
  797. {
  798. fieldLabel: 'DateField',
  799. xtype : 'datefield',
  800. name : 'date',
  801. anchor : '100%'
  802. },
  803. {
  804. fieldLabel: 'TimeField',
  805. name : 'time',
  806. xtype : 'timefield',
  807. anchor : '100%'
  808. },
  809. {
  810. fieldLabel: 'NumberField',
  811. xtype : 'numberfield',
  812. name : 'number',
  813. emptyText : '(This field is optional)',
  814. allowBlank: true,
  815. anchor : '100%'
  816. },
  817. {
  818. fieldLabel: 'TextArea',
  819. xtype : 'textareafield',
  820. name : 'message',
  821. cls : 'x-form-valid',
  822. value : 'This field is hard-coded to have the "valid" style (it will require some code changes to add/remove this style dynamically)',
  823. anchor : '100%'
  824. },
  825. {
  826. fieldLabel: 'Checkboxes',
  827. xtype: 'checkboxgroup',
  828. columns: [100,100],
  829. items: [
  830. {boxLabel: 'Foo', checked: true,id:'winFooChk',inputId:'winFooChkInput'},
  831. {boxLabel: 'Bar'}
  832. ]
  833. },
  834. {
  835. xtype: 'radiogroup',
  836. columns: [100,100],
  837. fieldLabel: 'Radio Group',
  838. items: [
  839. {boxLabel: 'Radio A', checked: true, name: 'radiogrp2'},
  840. {boxLabel: 'Radio B', name: 'radiogrp2'}
  841. ]
  842. }
  843. ]
  844. }
  845. ],
  846. buttons: [
  847. {
  848. text : 'Submit',
  849. handler: function() {
  850. Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?');
  851. }
  852. }
  853. ]
  854. }).show();
  855. }
  856. function doThemes (rtl) {
  857. var time = Ext.perf.getTimestamp(),
  858. maskedPanel,
  859. mainContainer;
  860. if (hasOption('nocss3')) {
  861. Ext.supports.CSS3BorderRadius = false;
  862. Ext.getBody().addCls('x-nbr x-nlg');
  863. }
  864. var items = [
  865. getBasicPanel(rtl),
  866. getCollapsedPanel(rtl),
  867. maskedPanel = getMaskedPanel(rtl),
  868. getFramedPanel(rtl),
  869. getCollapsedFramedPanel(rtl),
  870. getBasicWindow(rtl),
  871. getPanelWithToolbars(rtl),
  872. getFormWidgets(rtl),
  873. getBorderLayout(rtl),
  874. getGrid(rtl),
  875. getAccordion(rtl),
  876. getScrollingTabs(rtl),
  877. getPlainTabs(rtl),
  878. getDatePicker(rtl),
  879. getProgressBar(rtl),
  880. getFramedGrid(rtl),
  881. 0 // end of list (makes commenting out any of the above easy
  882. ];
  883. items.pop(); // remove the 0 on the end
  884. mainContainer = Ext.create('Ext.container.Container', {
  885. id: 'main-container',
  886. renderTo: document.body,
  887. height: 1460,
  888. width: 1130,
  889. layout: 'absolute',
  890. items: items
  891. });
  892. addResizer(mainContainer.el);
  893. //addFormWindow();
  894. /**
  895. * Stylesheet Switcher
  896. */
  897. Ext.get('styleswitcher_select').on('change', function(e, select) {
  898. var name = select[select.selectedIndex].value,
  899. currentPath = window.location.pathname,
  900. isCurrent = currentPath.match(name);
  901. if (!isCurrent) {
  902. window.location = name;
  903. }
  904. });
  905. setTimeout(function() {
  906. // we may comment out the creation of this for testing
  907. if (maskedPanel) {
  908. maskedPanel.setLoading({
  909. msg: '加载中...',
  910. useTargetEl: true
  911. });
  912. }
  913. if (!hasOption('notips')) {
  914. Ext.QuickTips.init();
  915. }
  916. }, 2000);
  917. time = Ext.perf.getTimestamp() - time;
  918. Ext.log('total time: ' + Math.round(time));
  919. }
  920. Ext.onReady(function() {
  921. if (!hasOption('perf')) {
  922. useDeferRender = !hasOption('nodefer');
  923. if (hasOption('delay')) {
  924. setTimeout(doThemes, 1000);
  925. } else {
  926. doThemes();
  927. }
  928. } else {
  929. setTimeout(function () {
  930. var a = document.createElement('a');
  931. a.innerHTML = 'Page Analyzer';
  932. a.style.position = "absolute";
  933. a.style.left = "5px";
  934. a.style.top = "5px";
  935. a.href = 'javascript:void(window.open("../page-analyzer/page-analyzer.html","pageAn"))';
  936. document.body.appendChild(a);
  937. useDeferRender = hasOption('defer');
  938. Ext.Perf.setup();
  939. Ext.Perf.monitor('onReady', doThemes);
  940. Ext.Perf.report();
  941. }, 1000);
  942. }
  943. });