DynamicModule.js
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Ext.define('amdaDesktop.DynamicModule', {
extend: 'Ext.ux.desktop.Module',
/**
* @cfg {String} id
* @required
*/
id : '',
/**
* @cfg {String} icon
* @required
*/
icon : '',
/**
* @cfg {String} title
* @required
*/
title : '',
/**
* @cfg {String} source
* @required
*/
source : '',
module: null,
launcher: null,
constructor : function(id, icon, title, source, useLauncher){
this.id = id;
this.icon = icon;
this.title = title;
this.source = source;
if (useLauncher)
this.launcher = {
text : this.title,
iconCls : this.icon,
handler : this.createWindow,
scope : this
};
this.callParent(arguments);
},
isReady : function(){
return (this.module != null);
},
get : function(onReady){
if (!this.isReady())
{
var me = this;
loadMask.show();
Ext.require(me.source, function() {
me.module = Ext.create(me.source, {id : me.id, icon : me.icon, title : me.title});
me.module.app = myDesktopApp;
if (onReady)
onReady(me.module);
loadMask.hide();
});
}
else if (onReady)
onReady(this.module);
return this.module;
},
/**
* Window Creation method of the Module
*/
createWindow : function () {
var me = this;
this.get(function (module) {
me.module.createWindow();
});
}
});