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.

436 lines
15 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. // Sample desktop configuration
  16. MyDesktop = new Ext.app.App({
  17. init :function(){
  18. Ext.QuickTips.init();
  19. },
  20. getModules : function(){
  21. return [
  22. new MyDesktop.GridWindow(),
  23. new MyDesktop.TabWindow(),
  24. new MyDesktop.AccordionWindow(),
  25. new MyDesktop.BogusMenuModule(),
  26. new MyDesktop.BogusModule()
  27. ];
  28. },
  29. // config for the start menu
  30. getStartConfig : function(){
  31. return {
  32. title: 'Jack Slocum',
  33. iconCls: 'user',
  34. toolItems: [{
  35. text:'Settings',
  36. iconCls:'settings',
  37. scope:this
  38. },'-',{
  39. text:'Logout',
  40. iconCls:'logout',
  41. scope:this
  42. }]
  43. };
  44. }
  45. });
  46. /*
  47. * Example windows
  48. */
  49. MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
  50. id:'grid-win',
  51. init : function(){
  52. this.launcher = {
  53. text: 'Grid Window',
  54. iconCls:'icon-grid',
  55. handler : this.createWindow,
  56. scope: this
  57. }
  58. },
  59. createWindow : function(){
  60. var desktop = this.app.getDesktop();
  61. var win = desktop.getWindow('grid-win');
  62. if(!win){
  63. win = desktop.createWindow({
  64. id: 'grid-win',
  65. title:'Grid Window',
  66. width:740,
  67. height:480,
  68. iconCls: 'icon-grid',
  69. shim:false,
  70. animCollapse:false,
  71. constrainHeader:true,
  72. layout: 'fit',
  73. items:
  74. new Ext.grid.GridPanel({
  75. border:false,
  76. ds: new Ext.data.Store({
  77. reader: new Ext.data.ArrayReader({}, [
  78. {name: 'company'},
  79. {name: 'price', type: 'float'},
  80. {name: 'change', type: 'float'},
  81. {name: 'pctChange', type: 'float'}
  82. ]),
  83. data: Ext.grid.dummyData
  84. }),
  85. cm: new Ext.grid.ColumnModel([
  86. new Ext.grid.RowNumberer(),
  87. {header: "Company", width: 120, sortable: true, dataIndex: 'company'},
  88. {header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
  89. {header: "Change", width: 70, sortable: true, dataIndex: 'change'},
  90. {header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'}
  91. ]),
  92. viewConfig: {
  93. forceFit:true
  94. },
  95. //autoExpandColumn:'company',
  96. tbar:[{
  97. text:'Add Something',
  98. tooltip:'Add a new row',
  99. iconCls:'add'
  100. }, '-', {
  101. text:'Options',
  102. tooltip:'Blah blah blah blaht',
  103. iconCls:'option'
  104. },'-',{
  105. text:'Remove Something',
  106. tooltip:'Remove the selected item',
  107. iconCls:'remove'
  108. }]
  109. })
  110. });
  111. }
  112. win.show();
  113. }
  114. });
  115. MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {
  116. id:'tab-win',
  117. init : function(){
  118. this.launcher = {
  119. text: 'Tab Window',
  120. iconCls:'tabs',
  121. handler : this.createWindow,
  122. scope: this
  123. }
  124. },
  125. createWindow : function(){
  126. var desktop = this.app.getDesktop();
  127. var win = desktop.getWindow('tab-win');
  128. if(!win){
  129. win = desktop.createWindow({
  130. id: 'tab-win',
  131. title:'Tab Window',
  132. width:740,
  133. height:480,
  134. iconCls: 'tabs',
  135. shim:false,
  136. animCollapse:false,
  137. border:false,
  138. constrainHeader:true,
  139. layout: 'fit',
  140. items:
  141. new Ext.TabPanel({
  142. activeTab:0,
  143. items: [{
  144. title: 'Tab Text 1',
  145. header:false,
  146. html : '<p>Something useful would be in here.</p>',
  147. border:false
  148. },{
  149. title: 'Tab Text 2',
  150. header:false,
  151. html : '<p>Something useful would be in here.</p>',
  152. border:false
  153. },{
  154. title: 'Tab Text 3',
  155. header:false,
  156. html : '<p>Something useful would be in here.</p>',
  157. border:false
  158. },{
  159. title: 'Tab Text 4',
  160. header:false,
  161. html : '<p>Something useful would be in here.</p>',
  162. border:false
  163. }]
  164. })
  165. });
  166. }
  167. win.show();
  168. }
  169. });
  170. MyDesktop.AccordionWindow = Ext.extend(Ext.app.Module, {
  171. id:'acc-win',
  172. init : function(){
  173. this.launcher = {
  174. text: 'Accordion Window',
  175. iconCls:'accordion',
  176. handler : this.createWindow,
  177. scope: this
  178. }
  179. },
  180. createWindow : function(){
  181. var desktop = this.app.getDesktop();
  182. var win = desktop.getWindow('acc-win');
  183. if(!win){
  184. win = desktop.createWindow({
  185. id: 'acc-win',
  186. title: 'Accordion Window',
  187. width:250,
  188. height:400,
  189. iconCls: 'accordion',
  190. shim:false,
  191. animCollapse:false,
  192. constrainHeader:true,
  193. tbar:[{
  194. tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},
  195. iconCls:'connect'
  196. },'-',{
  197. tooltip:'Add a new user',
  198. iconCls:'user-add'
  199. },' ',{
  200. tooltip:'Remove the selected user',
  201. iconCls:'user-delete'
  202. }],
  203. layout:'accordion',
  204. border:false,
  205. layoutConfig: {
  206. animate:false
  207. },
  208. items: [
  209. new Ext.tree.TreePanel({
  210. id:'im-tree',
  211. title: 'Online Users',
  212. loader: new Ext.tree.TreeLoader(),
  213. rootVisible:false,
  214. lines:false,
  215. autoScroll:true,
  216. tools:[{
  217. id:'refresh',
  218. on:{
  219. click: function(){
  220. var tree = Ext.getCmp('im-tree');
  221. tree.body.mask('Loading', 'x-mask-loading');
  222. tree.root.reload();
  223. tree.root.collapse(true, false);
  224. setTimeout(function(){ // mimic a server call
  225. tree.body.unmask();
  226. tree.root.expand(true, true);
  227. }, 1000);
  228. }
  229. }
  230. }],
  231. root: new Ext.tree.AsyncTreeNode({
  232. text:'Online',
  233. children:[{
  234. text:'Friends',
  235. expanded:true,
  236. children:[{
  237. text:'Jack',
  238. iconCls:'user',
  239. leaf:true
  240. },{
  241. text:'Brian',
  242. iconCls:'user',
  243. leaf:true
  244. },{
  245. text:'Jon',
  246. iconCls:'user',
  247. leaf:true
  248. },{
  249. text:'Tim',
  250. iconCls:'user',
  251. leaf:true
  252. },{
  253. text:'Nige',
  254. iconCls:'user',
  255. leaf:true
  256. },{
  257. text:'Fred',
  258. iconCls:'user',
  259. leaf:true
  260. },{
  261. text:'Bob',
  262. iconCls:'user',
  263. leaf:true
  264. }]
  265. },{
  266. text:'Family',
  267. expanded:true,
  268. children:[{
  269. text:'Kelly',
  270. iconCls:'user-girl',
  271. leaf:true
  272. },{
  273. text:'Sara',
  274. iconCls:'user-girl',
  275. leaf:true
  276. },{
  277. text:'Zack',
  278. iconCls:'user-kid',
  279. leaf:true
  280. },{
  281. text:'John',
  282. iconCls:'user-kid',
  283. leaf:true
  284. }]
  285. }]
  286. })
  287. }), {
  288. title: 'Settings',
  289. html:'<p>Something useful would be in here.</p>',
  290. autoScroll:true
  291. },{
  292. title: 'Even More Stuff',
  293. html : '<p>Something useful would be in here.</p>'
  294. },{
  295. title: 'My Stuff',
  296. html : '<p>Something useful would be in here.</p>'
  297. }
  298. ]
  299. });
  300. }
  301. win.show();
  302. }
  303. });
  304. // for example purposes
  305. var windowIndex = 0;
  306. MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
  307. init : function(){
  308. this.launcher = {
  309. text: 'Window '+(++windowIndex),
  310. iconCls:'bogus',
  311. handler : this.createWindow,
  312. scope: this,
  313. windowId:windowIndex
  314. }
  315. },
  316. createWindow : function(src){
  317. var desktop = this.app.getDesktop();
  318. var win = desktop.getWindow('bogus'+src.windowId);
  319. if(!win){
  320. win = desktop.createWindow({
  321. id: 'bogus'+src.windowId,
  322. title:src.text,
  323. width:640,
  324. height:480,
  325. html : '<p>Something useful would be in here.</p>',
  326. iconCls: 'bogus',
  327. shim:false,
  328. animCollapse:false,
  329. constrainHeader:true
  330. });
  331. }
  332. win.show();
  333. }
  334. });
  335. MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {
  336. init : function(){
  337. this.launcher = {
  338. text: 'Bogus Submenu',
  339. iconCls: 'bogus',
  340. handler: function() {
  341. return false;
  342. },
  343. menu: {
  344. items:[{
  345. text: 'Bogus Window '+(++windowIndex),
  346. iconCls:'bogus',
  347. handler : this.createWindow,
  348. scope: this,
  349. windowId: windowIndex
  350. },{
  351. text: 'Bogus Window '+(++windowIndex),
  352. iconCls:'bogus',
  353. handler : this.createWindow,
  354. scope: this,
  355. windowId: windowIndex
  356. },{
  357. text: 'Bogus Window '+(++windowIndex),
  358. iconCls:'bogus',
  359. handler : this.createWindow,
  360. scope: this,
  361. windowId: windowIndex
  362. },{
  363. text: 'Bogus Window '+(++windowIndex),
  364. iconCls:'bogus',
  365. handler : this.createWindow,
  366. scope: this,
  367. windowId: windowIndex
  368. },{
  369. text: 'Bogus Window '+(++windowIndex),
  370. iconCls:'bogus',
  371. handler : this.createWindow,
  372. scope: this,
  373. windowId: windowIndex
  374. }]
  375. }
  376. }
  377. }
  378. });
  379. // Array data for the grid
  380. Ext.grid.dummyData = [
  381. ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
  382. ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
  383. ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
  384. ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
  385. ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
  386. ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
  387. ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
  388. ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
  389. ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
  390. ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
  391. ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
  392. ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
  393. ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
  394. ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
  395. ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
  396. ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
  397. ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
  398. ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
  399. ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
  400. ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']
  401. ];