3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * Ext JS Library 3.3.1
17 * Copyright(c) 2006-2010 Sencha Inc.
18 * licensing@sencha.com
19 * http://www.sencha.com/license
22 // Sample desktop configuration
23 MyDesktop = new Ext.app.App({
28 getModules : function(){
30 new MyDesktop.GridWindow(),
31 new MyDesktop.TabWindow(),
32 new MyDesktop.AccordionWindow(),
33 new MyDesktop.BogusMenuModule(),
34 new MyDesktop.BogusModule()
38 // config for the start menu
39 getStartConfig : function(){
41 title: 'Tommy Maintz',
61 MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
67 handler : this.createWindow,
72 createWindow : function(){
73 var desktop = this.app.getDesktop();
74 var win = desktop.getWindow('grid-win');
76 win = desktop.createWindow({
88 new Ext.grid.GridPanel({
90 ds: new Ext.data.Store({
91 reader: new Ext.data.ArrayReader({}, [
93 {name: 'price', type: 'float'},
94 {name: 'change', type: 'float'},
95 {name: 'pctChange', type: 'float'}
97 data: Ext.grid.dummyData
99 cm: new Ext.grid.ColumnModel([
100 new Ext.grid.RowNumberer(),
101 {header: "Company", width: 120, sortable: true, dataIndex: 'company'},
102 {header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
103 {header: "Change", width: 70, sortable: true, dataIndex: 'change'},
104 {header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'}
110 //autoExpandColumn:'company',
113 text:'Add Something',
114 tooltip:'Add a new row',
118 tooltip:'Blah blah blah blaht',
121 text:'Remove Something',
122 tooltip:'Remove the selected item',
134 MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {
140 handler : this.createWindow,
145 createWindow : function(){
146 var desktop = this.app.getDesktop();
147 var win = desktop.getWindow('tab-win');
149 win = desktop.createWindow({
158 constrainHeader:true,
168 html : '<p>Something useful would be in here.</p>',
173 html : '<p>Something useful would be in here.</p>',
178 html : '<p>Something useful would be in here.</p>',
183 html : '<p>Something useful would be in here.</p>',
195 MyDesktop.AccordionWindow = Ext.extend(Ext.app.Module, {
199 text: 'Accordion Window',
201 handler : this.createWindow,
206 createWindow : function(){
207 var desktop = this.app.getDesktop();
208 var win = desktop.getWindow('acc-win');
210 win = desktop.createWindow({
212 title: 'Accordion Window',
215 iconCls: 'accordion',
218 constrainHeader:true,
221 tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},
224 tooltip:'Add a new user',
227 tooltip:'Remove the selected user',
228 iconCls:'user-delete'
238 new Ext.tree.TreePanel({
240 title: 'Online Users',
241 loader: new Ext.tree.TreeLoader(),
249 var tree = Ext.getCmp('im-tree');
250 tree.body.mask('Loading', 'x-mask-loading');
252 tree.root.collapse(true, false);
253 setTimeout(function(){ // mimic a server call
255 tree.root.expand(true, true);
260 root: new Ext.tree.AsyncTreeNode({
318 html:'<p>Something useful would be in here.</p>',
321 title: 'Even More Stuff',
322 html : '<p>Something useful would be in here.</p>'
325 html : '<p>Something useful would be in here.</p>'
334 // for example purposes
337 MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
340 text: 'Window '+(++windowIndex),
342 handler : this.createWindow,
348 createWindow : function(src){
349 var desktop = this.app.getDesktop();
350 var win = desktop.getWindow('bogus'+src.windowId);
352 win = desktop.createWindow({
353 id: 'bogus'+src.windowId,
357 html : '<p>Something useful would be in here.</p>',
369 MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {
372 text: 'Bogus Submenu',
374 handler: function() {
379 text: 'Bogus Window '+(++windowIndex),
381 handler : this.createWindow,
383 windowId: windowIndex
385 text: 'Bogus Window '+(++windowIndex),
387 handler : this.createWindow,
389 windowId: windowIndex
391 text: 'Bogus Window '+(++windowIndex),
393 handler : this.createWindow,
395 windowId: windowIndex
397 text: 'Bogus Window '+(++windowIndex),
399 handler : this.createWindow,
401 windowId: windowIndex
403 text: 'Bogus Window '+(++windowIndex),
405 handler : this.createWindow,
407 windowId: windowIndex
415 // Array data for the grid
416 Ext.grid.dummyData = [
417 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
418 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
419 ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
420 ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
421 ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
422 ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
423 ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
424 ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
425 ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
426 ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
427 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
428 ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
429 ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
430 ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
431 ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
432 ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
433 ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
434 ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
435 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
436 ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']