Blame view

js/app/controllers/AmdaModule.js 2.05 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
/** 
 * 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 $
16035364   Benjamin Renard   First commit
9
10
11
12
13
 */

Ext.define('amdaDesktop.AmdaModule', {
	extend: 'Ext.ux.desktop.Module',

3ed056c4   Elena.Budnik   redmine #5278
14
15
16
17
	/**
	* @cfg {String} id
	* @required
	*/
16035364   Benjamin Renard   First commit
18
	id : '',
3ed056c4   Elena.Budnik   redmine #5278
19
20
21
22
23
	
	/**
	* @cfg {String} icon
	* @required
	*/
16035364   Benjamin Renard   First commit
24
	icon : '',
3ed056c4   Elena.Budnik   redmine #5278
25
26
27
28
29
	
	/**
	* @cfg {String} title
	* @required
	*/
16035364   Benjamin Renard   First commit
30
	title : '',
3ed056c4   Elena.Budnik   redmine #5278
31
32
33
34
35
	
	/**
	* @cfg {String} contentId
	* @required
	*/
16035364   Benjamin Renard   First commit
36
37
38
39
40
41
42
43
44
	contentId : '',
	
	constructor : function(config){
		this.callParent(arguments);
	},

	/**
	* Module without launcher in Start Menu
	*/
3ed056c4   Elena.Budnik   redmine #5278
45
46
47
	init: function(){
		this.launcher = null; 
	},
16035364   Benjamin Renard   First commit
48
49
	
	/**
3ed056c4   Elena.Budnik   redmine #5278
50
51
52
	* Function which return the UI content of this module
	* @return {Object} The Ui content class of this module
	*/
16035364   Benjamin Renard   First commit
53
	getUiContent : function (){
3ed056c4   Elena.Budnik   redmine #5278
54
		return Ext.getCmp(this.contentId);
16035364   Benjamin Renard   First commit
55
	},
16035364   Benjamin Renard   First commit
56
57
       
	/**
3ed056c4   Elena.Budnik   redmine #5278
58
59
60
	* Window Creation method of the Module
	*/
	createWindow : function (onshowfn) {	  
16035364   Benjamin Renard   First commit
61
62
63
64
65
66
67
68
		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,
3ed056c4   Elena.Budnik   redmine #5278
69
				minWidth : this.width,
16035364   Benjamin Renard   First commit
70
71
72
73
74
75
76
77
78
				height : this.height,
				minHeight: this.height,
				iconCls : this.icon,
				border : false,
				//constrainHeader : true,
				layout : 'fit',
				stateful : true,
				stateId : this.id,
				stateEvents: ['move','show','resize'],
3ed056c4   Elena.Budnik   redmine #5278
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
				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
				}]
16035364   Benjamin Renard   First commit
94
			});
3ed056c4   Elena.Budnik   redmine #5278
95
		}
16035364   Benjamin Renard   First commit
96
	 
3ed056c4   Elena.Budnik   redmine #5278
97
		if (onshowfn) {
16035364   Benjamin Renard   First commit
98
			win.on({
3ed056c4   Elena.Budnik   redmine #5278
99
100
101
				show : onshowfn,
				scope : this
			});
ebbb3638   Benjamin Renard   Edit plot tab on ...
102
103
104
105
106
107
108
		}
		if (!win.isVisible()) {
			win.show();
		}
		else if (onshowfn) {
			onshowfn();
		}
16035364   Benjamin Renard   First commit
109
	}
3ed056c4   Elena.Budnik   redmine #5278
110
});