3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">
\r
9 // Sample desktop configuration
\r
10 MyDesktop = new Ext.app.App({
\r
12 Ext.QuickTips.init();
\r
15 getModules : function(){
\r
17 new MyDesktop.GridWindow(),
\r
18 new MyDesktop.TabWindow(),
\r
19 new MyDesktop.AccordionWindow(),
\r
20 new MyDesktop.BogusMenuModule(),
\r
21 new MyDesktop.BogusModule()
\r
25 // config for the start menu
\r
26 getStartConfig : function(){
\r
28 title: 'Jack Slocum',
\r
48 MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
\r
52 text: 'Grid Window',
\r
53 iconCls:'icon-grid',
\r
54 handler : this.createWindow,
\r
59 createWindow : function(){
\r
60 var desktop = this.app.getDesktop();
\r
61 var win = desktop.getWindow('grid-win');
\r
63 win = desktop.createWindow({
\r
65 title:'Grid Window',
\r
68 iconCls: 'icon-grid',
\r
71 constrainHeader:true,
\r
75 new Ext.grid.GridPanel({
\r
77 ds: new Ext.data.Store({
\r
78 reader: new Ext.data.ArrayReader({}, [
\r
80 {name: 'price', type: 'float'},
\r
81 {name: 'change', type: 'float'},
\r
82 {name: 'pctChange', type: 'float'}
\r
84 data: Ext.grid.dummyData
\r
86 cm: new Ext.grid.ColumnModel([
\r
87 new Ext.grid.RowNumberer(),
\r
88 {header: "Company", width: 120, sortable: true, dataIndex: 'company'},
\r
89 {header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
\r
90 {header: "Change", width: 70, sortable: true, dataIndex: 'change'},
\r
91 {header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'}
\r
97 //autoExpandColumn:'company',
\r
100 text:'Add Something',
\r
101 tooltip:'Add a new row',
\r
105 tooltip:'Blah blah blah blaht',
\r
108 text:'Remove Something',
\r
109 tooltip:'Remove the selected item',
\r
121 MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {
\r
125 text: 'Tab Window',
\r
127 handler : this.createWindow,
\r
132 createWindow : function(){
\r
133 var desktop = this.app.getDesktop();
\r
134 var win = desktop.getWindow('tab-win');
\r
136 win = desktop.createWindow({
\r
138 title:'Tab Window',
\r
143 animCollapse:false,
\r
145 constrainHeader:true,
\r
153 title: 'Tab Text 1',
\r
155 html : '<p>Something useful would be in here.</p>',
\r
158 title: 'Tab Text 2',
\r
160 html : '<p>Something useful would be in here.</p>',
\r
163 title: 'Tab Text 3',
\r
165 html : '<p>Something useful would be in here.</p>',
\r
168 title: 'Tab Text 4',
\r
170 html : '<p>Something useful would be in here.</p>',
\r
182 MyDesktop.AccordionWindow = Ext.extend(Ext.app.Module, {
\r
186 text: 'Accordion Window',
\r
187 iconCls:'accordion',
\r
188 handler : this.createWindow,
\r
193 createWindow : function(){
\r
194 var desktop = this.app.getDesktop();
\r
195 var win = desktop.getWindow('acc-win');
\r
197 win = desktop.createWindow({
\r
199 title: 'Accordion Window',
\r
202 iconCls: 'accordion',
\r
204 animCollapse:false,
\r
205 constrainHeader:true,
\r
208 tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},
\r
211 tooltip:'Add a new user',
\r
214 tooltip:'Remove the selected user',
\r
215 iconCls:'user-delete'
\r
218 layout:'accordion',
\r
225 new Ext.tree.TreePanel({
\r
227 title: 'Online Users',
\r
228 loader: new Ext.tree.TreeLoader(),
\r
236 var tree = Ext.getCmp('im-tree');
\r
237 tree.body.mask('Loading', 'x-mask-loading');
\r
238 tree.root.reload();
\r
239 tree.root.collapse(true, false);
\r
240 setTimeout(function(){ // mimic a server call
\r
241 tree.body.unmask();
\r
242 tree.root.expand(true, true);
\r
247 root: new Ext.tree.AsyncTreeNode({
\r
286 iconCls:'user-girl',
\r
290 iconCls:'user-girl',
\r
294 iconCls:'user-kid',
\r
298 iconCls:'user-kid',
\r
305 html:'<p>Something useful would be in here.</p>',
\r
308 title: 'Even More Stuff',
\r
309 html : '<p>Something useful would be in here.</p>'
\r
312 html : '<p>Something useful would be in here.</p>'
\r
321 // for example purposes
\r
322 var windowIndex = 0;
\r
324 MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
\r
327 text: 'Window '+(++windowIndex),
\r
329 handler : this.createWindow,
\r
331 windowId:windowIndex
\r
335 createWindow : function(src){
\r
336 var desktop = this.app.getDesktop();
\r
337 var win = desktop.getWindow('bogus'+src.windowId);
\r
339 win = desktop.createWindow({
\r
340 id: 'bogus'+src.windowId,
\r
344 html : '<p>Something useful would be in here.</p>',
\r
347 animCollapse:false,
\r
348 constrainHeader:true
\r
356 MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {
\r
359 text: 'Bogus Submenu',
\r
361 handler: function() {
\r
366 text: 'Bogus Window '+(++windowIndex),
\r
368 handler : this.createWindow,
\r
370 windowId: windowIndex
\r
372 text: 'Bogus Window '+(++windowIndex),
\r
374 handler : this.createWindow,
\r
376 windowId: windowIndex
\r
378 text: 'Bogus Window '+(++windowIndex),
\r
380 handler : this.createWindow,
\r
382 windowId: windowIndex
\r
384 text: 'Bogus Window '+(++windowIndex),
\r
386 handler : this.createWindow,
\r
388 windowId: windowIndex
\r
390 text: 'Bogus Window '+(++windowIndex),
\r
392 handler : this.createWindow,
\r
394 windowId: windowIndex
\r
402 // Array data for the grid
\r
403 Ext.grid.dummyData = [
\r
404 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
\r
405 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
\r
406 ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
\r
407 ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
\r
408 ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
\r
409 ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
\r
410 ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
\r
411 ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
\r
412 ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
\r
413 ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
\r
414 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
\r
415 ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
\r
416 ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
\r
417 ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
\r
418 ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
\r
419 ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
\r
420 ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
\r
421 ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
\r
422 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
\r
423 ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']
\r