3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
8 // Sample desktop configuration
9 MyDesktop = new Ext.app.App({
14 getModules : function(){
16 new MyDesktop.GridWindow(),
17 new MyDesktop.TabWindow(),
18 new MyDesktop.AccordionWindow(),
19 new MyDesktop.BogusMenuModule(),
20 new MyDesktop.BogusModule()
24 // config for the start menu
25 getStartConfig : function(){
47 MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
53 handler : this.createWindow,
58 createWindow : function(){
59 var desktop = this.app.getDesktop();
60 var win = desktop.getWindow('grid-win');
62 win = desktop.createWindow({
74 new Ext.grid.GridPanel({
76 ds: new Ext.data.Store({
77 reader: new Ext.data.ArrayReader({}, [
79 {name: 'price', type: 'float'},
80 {name: 'change', type: 'float'},
81 {name: 'pctChange', type: 'float'}
83 data: Ext.grid.dummyData
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'}
96 //autoExpandColumn:'company',
100 tooltip:'Add a new row',
104 tooltip:'Blah blah blah blaht',
107 text:'Remove Something',
108 tooltip:'Remove the selected item',
120 MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {
126 handler : this.createWindow,
131 createWindow : function(){
132 var desktop = this.app.getDesktop();
133 var win = desktop.getWindow('tab-win');
135 win = desktop.createWindow({
144 constrainHeader:true,
154 html : '<p>Something useful would be in here.</p>',
159 html : '<p>Something useful would be in here.</p>',
164 html : '<p>Something useful would be in here.</p>',
169 html : '<p>Something useful would be in here.</p>',
181 MyDesktop.AccordionWindow = Ext.extend(Ext.app.Module, {
185 text: 'Accordion Window',
187 handler : this.createWindow,
192 createWindow : function(){
193 var desktop = this.app.getDesktop();
194 var win = desktop.getWindow('acc-win');
196 win = desktop.createWindow({
198 title: 'Accordion Window',
201 iconCls: 'accordion',
204 constrainHeader:true,
207 tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},
210 tooltip:'Add a new user',
213 tooltip:'Remove the selected user',
214 iconCls:'user-delete'
224 new Ext.tree.TreePanel({
226 title: 'Online Users',
227 loader: new Ext.tree.TreeLoader(),
235 var tree = Ext.getCmp('im-tree');
236 tree.body.mask('Loading', 'x-mask-loading');
238 tree.root.collapse(true, false);
239 setTimeout(function(){ // mimic a server call
241 tree.root.expand(true, true);
246 root: new Ext.tree.AsyncTreeNode({
304 html:'<p>Something useful would be in here.</p>',
307 title: 'Even More Stuff',
308 html : '<p>Something useful would be in here.</p>'
311 html : '<p>Something useful would be in here.</p>'
320 // for example purposes
323 MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
326 text: 'Window '+(++windowIndex),
328 handler : this.createWindow,
334 createWindow : function(src){
335 var desktop = this.app.getDesktop();
336 var win = desktop.getWindow('bogus'+src.windowId);
338 win = desktop.createWindow({
339 id: 'bogus'+src.windowId,
343 html : '<p>Something useful would be in here.</p>',
355 MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {
358 text: 'Bogus Submenu',
360 handler: function() {
365 text: 'Bogus Window '+(++windowIndex),
367 handler : this.createWindow,
369 windowId: windowIndex
371 text: 'Bogus Window '+(++windowIndex),
373 handler : this.createWindow,
375 windowId: windowIndex
377 text: 'Bogus Window '+(++windowIndex),
379 handler : this.createWindow,
381 windowId: windowIndex
383 text: 'Bogus Window '+(++windowIndex),
385 handler : this.createWindow,
387 windowId: windowIndex
389 text: 'Bogus Window '+(++windowIndex),
391 handler : this.createWindow,
393 windowId: windowIndex
401 // Array data for the grid
402 Ext.grid.dummyData = [
403 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
404 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
405 ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
406 ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
407 ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
408 ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
409 ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
410 ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
411 ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
412 ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
413 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
414 ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
415 ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
416 ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
417 ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
418 ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
419 ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
420 ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
421 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
422 ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']