AmdaModule.js
2.05 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
* Project : AMDA-NG4
* Name : AmdaModule.js
* @class amdaDesktop.AmdaModule
* @extends Ext.ux.desktop.Module
* @brief Generic Module controller definition for AMDA project
* @author CDA
* @version $Id: AmdaModule.js 1761 2013-09-13 13:18:03Z myriam $
*/
Ext.define('amdaDesktop.AmdaModule', {
extend: 'Ext.ux.desktop.Module',
/**
* @cfg {String} id
* @required
*/
id : '',
/**
* @cfg {String} icon
* @required
*/
icon : '',
/**
* @cfg {String} title
* @required
*/
title : '',
/**
* @cfg {String} contentId
* @required
*/
contentId : '',
constructor : function(config){
this.callParent(arguments);
},
/**
* Module without launcher in Start Menu
*/
init: function(){
this.launcher = null;
},
/**
* Function which return the UI content of this module
* @return {Object} The Ui content class of this module
*/
getUiContent : function (){
return Ext.getCmp(this.contentId);
},
/**
* Window Creation method of the Module
*/
createWindow : function (onshowfn) {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.id);
if (!win) {
win = desktop.createWindow({
id : this.id,
title : this.title,
width : this.width,
minWidth : this.width,
height : this.height,
minHeight: this.height,
iconCls : this.icon,
border : false,
//constrainHeader : true,
layout : 'fit',
stateful : true,
stateId : this.id,
stateEvents: ['move','show','resize'],
tools: [{
type:'help',
qtip: this.helpTitle,
scope:this,
handler: function(event, toolEl, panel){
var me = this;
myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
module.createWindow(me.helpFile, me.helpTitle);
});
}
}],
items : [{
xtype : this.uiType,
id : this.contentId
}]
});
}
if (onshowfn) {
win.on({
show : onshowfn,
scope : this
});
}
if (!win.isVisible()) {
win.show();
}
else if (onshowfn) {
onshowfn();
}
}
});