Blame view

js/app/controllers/DynamicModule.js 1.32 KB
16035364   Benjamin Renard   First commit
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


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 : '',
a048eff4   Nathanael Jourdane   Add EPN-TAP to Am...
26

16035364   Benjamin Renard   First commit
27
	module: null,
a048eff4   Nathanael Jourdane   Add EPN-TAP to Am...
28

16035364   Benjamin Renard   First commit
29
	launcher: null,
a048eff4   Nathanael Jourdane   Add EPN-TAP to Am...
30

16035364   Benjamin Renard   First commit
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	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);
	},
a048eff4   Nathanael Jourdane   Add EPN-TAP to Am...
45

16035364   Benjamin Renard   First commit
46
47
48
	isReady : function(){
		return (this.module != null);
	},
a048eff4   Nathanael Jourdane   Add EPN-TAP to Am...
49

16035364   Benjamin Renard   First commit
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	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;
	},
a048eff4   Nathanael Jourdane   Add EPN-TAP to Am...
67

16035364   Benjamin Renard   First commit
68
69
70
71
72
73
74
75
76
77
	/**
	 * Window Creation method of the Module
	 */
	createWindow : function () {
		var me = this;
		this.get(function (module) {
			me.module.createWindow();
		});
	}
});