source: trunk/web/addons/job_monarch/lib/extjs/examples/desktop/js/App.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.8 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9Ext.app.App = function(cfg){
10    Ext.apply(this, cfg);
11    this.addEvents({
12        'ready' : true,
13        'beforeunload' : true
14    });
15
16    Ext.onReady(this.initApp, this);
17};
18
19Ext.extend(Ext.app.App, Ext.util.Observable, {
20    isReady: false,
21    startMenu: null,
22    modules: null,
23
24    getStartConfig : function(){
25
26    },
27
28    initApp : function(){
29        this.startConfig = this.startConfig || this.getStartConfig();
30
31        this.desktop = new Ext.Desktop(this);
32
33                this.launcher = this.desktop.taskbar.startMenu;
34
35                this.modules = this.getModules();
36        if(this.modules){
37            this.initModules(this.modules);
38        }
39
40        this.init();
41
42        Ext.EventManager.on(window, 'beforeunload', this.onUnload, this);
43                this.fireEvent('ready', this);
44        this.isReady = true;
45    },
46
47    getModules : Ext.emptyFn,
48    init : Ext.emptyFn,
49
50    initModules : function(ms){
51                for(var i = 0, len = ms.length; i < len; i++){
52            var m = ms[i];
53            this.launcher.add(m.launcher);
54            m.app = this;
55        }
56    },
57
58    getModule : function(name){
59        var ms = this.modules;
60        for(var i = 0, len = ms.length; i < len; i++){
61                if(ms[i].id == name || ms[i].appType == name){
62                        return ms[i];
63                        }
64        }
65        return '';
66    },
67
68    onReady : function(fn, scope){
69        if(!this.isReady){
70            this.on('ready', fn, scope);
71        }else{
72            fn.call(scope, this);
73        }
74    },
75
76    getDesktop : function(){
77        return this.desktop;
78    },
79
80    onUnload : function(e){
81        if(this.fireEvent('beforeunload', this) === false){
82            e.stopEvent();
83        }
84    }
85});
Note: See TracBrowser for help on using the repository browser.