--- /dev/null
+<html>\r
+<head>\r
+ <title>The source code</title>\r
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js">\r
+// Sample desktop configuration\r
+MyDesktop = new Ext.app.App({\r
+ init :function(){\r
+ Ext.QuickTips.init();\r
+ },\r
+\r
+ getModules : function(){\r
+ return [\r
+ new MyDesktop.GridWindow(),\r
+ new MyDesktop.TabWindow(),\r
+ new MyDesktop.AccordionWindow(),\r
+ new MyDesktop.BogusMenuModule(),\r
+ new MyDesktop.BogusModule()\r
+ ];\r
+ },\r
+\r
+ // config for the start menu\r
+ getStartConfig : function(){\r
+ return {\r
+ title: 'Jack Slocum',\r
+ iconCls: 'user',\r
+ toolItems: [{\r
+ text:'Settings',\r
+ iconCls:'settings',\r
+ scope:this\r
+ },'-',{\r
+ text:'Logout',\r
+ iconCls:'logout',\r
+ scope:this\r
+ }]\r
+ };\r
+ }\r
+});\r
+\r
+\r
+\r
+/*\r
+ * Example windows\r
+ */\r
+MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {\r
+ id:'grid-win',\r
+ init : function(){\r
+ this.launcher = {\r
+ text: 'Grid Window',\r
+ iconCls:'icon-grid',\r
+ handler : this.createWindow,\r
+ scope: this\r
+ }\r
+ },\r
+\r
+ createWindow : function(){\r
+ var desktop = this.app.getDesktop();\r
+ var win = desktop.getWindow('grid-win');\r
+ if(!win){\r
+ win = desktop.createWindow({\r
+ id: 'grid-win',\r
+ title:'Grid Window',\r
+ width:740,\r
+ height:480,\r
+ iconCls: 'icon-grid',\r
+ shim:false,\r
+ animCollapse:false,\r
+ constrainHeader:true,\r
+\r
+ layout: 'fit',\r
+ items:\r
+ new Ext.grid.GridPanel({\r
+ border:false,\r
+ ds: new Ext.data.Store({\r
+ reader: new Ext.data.ArrayReader({}, [\r
+ {name: 'company'},\r
+ {name: 'price', type: 'float'},\r
+ {name: 'change', type: 'float'},\r
+ {name: 'pctChange', type: 'float'}\r
+ ]),\r
+ data: Ext.grid.dummyData\r
+ }),\r
+ cm: new Ext.grid.ColumnModel([\r
+ new Ext.grid.RowNumberer(),\r
+ {header: "Company", width: 120, sortable: true, dataIndex: 'company'},\r
+ {header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},\r
+ {header: "Change", width: 70, sortable: true, dataIndex: 'change'},\r
+ {header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'}\r
+ ]),\r
+\r
+ viewConfig: {\r
+ forceFit:true\r
+ },\r
+ //autoExpandColumn:'company',\r
+\r
+ tbar:[{\r
+ text:'Add Something',\r
+ tooltip:'Add a new row',\r
+ iconCls:'add'\r
+ }, '-', {\r
+ text:'Options',\r
+ tooltip:'Blah blah blah blaht',\r
+ iconCls:'option'\r
+ },'-',{\r
+ text:'Remove Something',\r
+ tooltip:'Remove the selected item',\r
+ iconCls:'remove'\r
+ }]\r
+ })\r
+ });\r
+ }\r
+ win.show();\r
+ }\r
+});\r
+\r
+\r
+\r
+MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {\r
+ id:'tab-win',\r
+ init : function(){\r
+ this.launcher = {\r
+ text: 'Tab Window',\r
+ iconCls:'tabs',\r
+ handler : this.createWindow,\r
+ scope: this\r
+ }\r
+ },\r
+\r
+ createWindow : function(){\r
+ var desktop = this.app.getDesktop();\r
+ var win = desktop.getWindow('tab-win');\r
+ if(!win){\r
+ win = desktop.createWindow({\r
+ id: 'tab-win',\r
+ title:'Tab Window',\r
+ width:740,\r
+ height:480,\r
+ iconCls: 'tabs',\r
+ shim:false,\r
+ animCollapse:false,\r
+ border:false,\r
+ constrainHeader:true,\r
+\r
+ layout: 'fit',\r
+ items:\r
+ new Ext.TabPanel({\r
+ activeTab:0,\r
+\r
+ items: [{\r
+ title: 'Tab Text 1',\r
+ header:false,\r
+ html : '<p>Something useful would be in here.</p>',\r
+ border:false\r
+ },{\r
+ title: 'Tab Text 2',\r
+ header:false,\r
+ html : '<p>Something useful would be in here.</p>',\r
+ border:false\r
+ },{\r
+ title: 'Tab Text 3',\r
+ header:false,\r
+ html : '<p>Something useful would be in here.</p>',\r
+ border:false\r
+ },{\r
+ title: 'Tab Text 4',\r
+ header:false,\r
+ html : '<p>Something useful would be in here.</p>',\r
+ border:false\r
+ }]\r
+ })\r
+ });\r
+ }\r
+ win.show();\r
+ }\r
+});\r
+\r
+\r
+\r
+MyDesktop.AccordionWindow = Ext.extend(Ext.app.Module, {\r
+ id:'acc-win',\r
+ init : function(){\r
+ this.launcher = {\r
+ text: 'Accordion Window',\r
+ iconCls:'accordion',\r
+ handler : this.createWindow,\r
+ scope: this\r
+ }\r
+ },\r
+\r
+ createWindow : function(){\r
+ var desktop = this.app.getDesktop();\r
+ var win = desktop.getWindow('acc-win');\r
+ if(!win){\r
+ win = desktop.createWindow({\r
+ id: 'acc-win',\r
+ title: 'Accordion Window',\r
+ width:250,\r
+ height:400,\r
+ iconCls: 'accordion',\r
+ shim:false,\r
+ animCollapse:false,\r
+ constrainHeader:true,\r
+\r
+ tbar:[{\r
+ tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},\r
+ iconCls:'connect'\r
+ },'-',{\r
+ tooltip:'Add a new user',\r
+ iconCls:'user-add'\r
+ },' ',{\r
+ tooltip:'Remove the selected user',\r
+ iconCls:'user-delete'\r
+ }],\r
+\r
+ layout:'accordion',\r
+ border:false,\r
+ layoutConfig: {\r
+ animate:false\r
+ },\r
+\r
+ items: [\r
+ new Ext.tree.TreePanel({\r
+ id:'im-tree',\r
+ title: 'Online Users',\r
+ loader: new Ext.tree.TreeLoader(),\r
+ rootVisible:false,\r
+ lines:false,\r
+ autoScroll:true,\r
+ tools:[{\r
+ id:'refresh',\r
+ on:{\r
+ click: function(){\r
+ var tree = Ext.getCmp('im-tree');\r
+ tree.body.mask('Loading', 'x-mask-loading');\r
+ tree.root.reload();\r
+ tree.root.collapse(true, false);\r
+ setTimeout(function(){ // mimic a server call\r
+ tree.body.unmask();\r
+ tree.root.expand(true, true);\r
+ }, 1000);\r
+ }\r
+ }\r
+ }],\r
+ root: new Ext.tree.AsyncTreeNode({\r
+ text:'Online',\r
+ children:[{\r
+ text:'Friends',\r
+ expanded:true,\r
+ children:[{\r
+ text:'Jack',\r
+ iconCls:'user',\r
+ leaf:true\r
+ },{\r
+ text:'Brian',\r
+ iconCls:'user',\r
+ leaf:true\r
+ },{\r
+ text:'Jon',\r
+ iconCls:'user',\r
+ leaf:true\r
+ },{\r
+ text:'Tim',\r
+ iconCls:'user',\r
+ leaf:true\r
+ },{\r
+ text:'Nige',\r
+ iconCls:'user',\r
+ leaf:true\r
+ },{\r
+ text:'Fred',\r
+ iconCls:'user',\r
+ leaf:true\r
+ },{\r
+ text:'Bob',\r
+ iconCls:'user',\r
+ leaf:true\r
+ }]\r
+ },{\r
+ text:'Family',\r
+ expanded:true,\r
+ children:[{\r
+ text:'Kelly',\r
+ iconCls:'user-girl',\r
+ leaf:true\r
+ },{\r
+ text:'Sara',\r
+ iconCls:'user-girl',\r
+ leaf:true\r
+ },{\r
+ text:'Zack',\r
+ iconCls:'user-kid',\r
+ leaf:true\r
+ },{\r
+ text:'John',\r
+ iconCls:'user-kid',\r
+ leaf:true\r
+ }]\r
+ }]\r
+ })\r
+ }), {\r
+ title: 'Settings',\r
+ html:'<p>Something useful would be in here.</p>',\r
+ autoScroll:true\r
+ },{\r
+ title: 'Even More Stuff',\r
+ html : '<p>Something useful would be in here.</p>'\r
+ },{\r
+ title: 'My Stuff',\r
+ html : '<p>Something useful would be in here.</p>'\r
+ }\r
+ ]\r
+ });\r
+ }\r
+ win.show();\r
+ }\r
+});\r
+\r
+// for example purposes\r
+var windowIndex = 0;\r
+\r
+MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {\r
+ init : function(){\r
+ this.launcher = {\r
+ text: 'Window '+(++windowIndex),\r
+ iconCls:'bogus',\r
+ handler : this.createWindow,\r
+ scope: this,\r
+ windowId:windowIndex\r
+ }\r
+ },\r
+\r
+ createWindow : function(src){\r
+ var desktop = this.app.getDesktop();\r
+ var win = desktop.getWindow('bogus'+src.windowId);\r
+ if(!win){\r
+ win = desktop.createWindow({\r
+ id: 'bogus'+src.windowId,\r
+ title:src.text,\r
+ width:640,\r
+ height:480,\r
+ html : '<p>Something useful would be in here.</p>',\r
+ iconCls: 'bogus',\r
+ shim:false,\r
+ animCollapse:false,\r
+ constrainHeader:true\r
+ });\r
+ }\r
+ win.show();\r
+ }\r
+});\r
+\r
+\r
+MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {\r
+ init : function(){\r
+ this.launcher = {\r
+ text: 'Bogus Submenu',\r
+ iconCls: 'bogus',\r
+ handler: function() {\r
+ return false;\r
+ },\r
+ menu: {\r
+ items:[{\r
+ text: 'Bogus Window '+(++windowIndex),\r
+ iconCls:'bogus',\r
+ handler : this.createWindow,\r
+ scope: this,\r
+ windowId: windowIndex\r
+ },{\r
+ text: 'Bogus Window '+(++windowIndex),\r
+ iconCls:'bogus',\r
+ handler : this.createWindow,\r
+ scope: this,\r
+ windowId: windowIndex\r
+ },{\r
+ text: 'Bogus Window '+(++windowIndex),\r
+ iconCls:'bogus',\r
+ handler : this.createWindow,\r
+ scope: this,\r
+ windowId: windowIndex\r
+ },{\r
+ text: 'Bogus Window '+(++windowIndex),\r
+ iconCls:'bogus',\r
+ handler : this.createWindow,\r
+ scope: this,\r
+ windowId: windowIndex\r
+ },{\r
+ text: 'Bogus Window '+(++windowIndex),\r
+ iconCls:'bogus',\r
+ handler : this.createWindow,\r
+ scope: this,\r
+ windowId: windowIndex\r
+ }]\r
+ }\r
+ }\r
+ }\r
+});\r
+\r
+\r
+// Array data for the grid\r
+Ext.grid.dummyData = [\r
+ ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],\r
+ ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],\r
+ ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],\r
+ ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],\r
+ ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],\r
+ ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],\r
+ ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],\r
+ ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],\r
+ ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],\r
+ ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],\r
+ ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],\r
+ ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],\r
+ ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],\r
+ ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],\r
+ ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],\r
+ ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],\r
+ ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],\r
+ ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],\r
+ ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],\r
+ ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']\r
+];</pre> \r
+</body>\r
+</html>
\ No newline at end of file