Blame view

js/app/views/InteropUI.js 3.23 KB
16035364   Benjamin Renard   First commit
1
2
/**
 * Project   : AMDA-NG
db3a6e4b   Nathanael Jourdane   fix tabs on inter...
3
 * Name	  : InteropUI.js
16035364   Benjamin Renard   First commit
4
5
6
7
8
9
 * @class   amdaUI.InteropUI
 * @extends Ext.tab.Panel
 * @brief   Interop Module UI definition (View)
 * @author  Benjamin RENARD
 * @version $Id: InteropUI.js 1093 2012-10-03 15:54:26Z elena $
 ******************************************************************************
db3a6e4b   Nathanael Jourdane   fix tabs on inter...
10
 *	FT Id	 :   Date   : Name - Description
16035364   Benjamin Renard   First commit
11
 ******************************************************************************
db3a6e4b   Nathanael Jourdane   fix tabs on inter...
12
 *  :		   :23/04/2012: BRE  - file creation
16035364   Benjamin Renard   First commit
13
14
15
16
17
18
 */


Ext.define('amdaUI.InteropUI', {
        extend: 'Ext.tab.Panel',
        alias: 'widget.panelInterop',
10200969   Roipoussiere   Remove whitespace...
19

16035364   Benjamin Renard   First commit
20
	requires: [
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
21
		'amdaUI.ParamsMgrUI', 'amdaUI.EpnTapUI'
16035364   Benjamin Renard   First commit
22
	  ],
10200969   Roipoussiere   Remove whitespace...
23

16035364   Benjamin Renard   First commit
24
25
26
27
    	constructor: function(config) {
			this.init(config);
			this.callParent(arguments);
		},
10200969   Roipoussiere   Remove whitespace...
28

16035364   Benjamin Renard   First commit
29
		onSwitchConnect    : Ext.emptyFn,
10200969   Roipoussiere   Remove whitespace...
30

16035364   Benjamin Renard   First commit
31
32
33
		updateStatus : function(isConnected)
		{
			var sampTab = this.getComponent('samp_tab_panel');
10200969   Roipoussiere   Remove whitespace...
34

16035364   Benjamin Renard   First commit
35
36
37
			var sampButton = sampTab.dockedItems.items[0].items.items[1];
			sampButton.setIconCls(isConnected ? 'icon-connected' : 'icon-disconnected');
		},
10200969   Roipoussiere   Remove whitespace...
38

16035364   Benjamin Renard   First commit
39
40
41
		/*updateClients : function(clients)
		{
			var sampTab = this.getComponent('samp_tab_panel');
10200969   Roipoussiere   Remove whitespace...
42

16035364   Benjamin Renard   First commit
43
44
			var sampDataView = sampTab.query('dataview')[0];

10200969   Roipoussiere   Remove whitespace...
45
			sampDataView.store.loadData(clients);
16035364   Benjamin Renard   First commit
46
		},*/
10200969   Roipoussiere   Remove whitespace...
47

16035364   Benjamin Renard   First commit
48
49
50
51
52
53
54
55
56
57
58
59
60
61
		getSampToolBar : function()
		{
			var me = this;
			return [
			        'SAMP connection : ',
			        {
			        	iconCls   : 'icon-disconnected',
			        	handler: function() {
			        		if (me.onSwitchConnect)
			        			me.onSwitchConnect();
			        	}
			        }
			];
		},
10200969   Roipoussiere   Remove whitespace...
62

16035364   Benjamin Renard   First commit
63
64
65
66
67
68
69
70
71
72
73
74
75
		getSampClientsDataView : function(clientsStore)
		{
			var tpl = new Ext.XTemplate(
				'<tpl for=".">',
				  '<div style="margin: 2px;border: 1px solid #99BDE8;" class="clientinfo">',
				    '<img src="{iconUrl}" width=24 height=24/><br/>',
				    '<b>Name : </b><span>{name}</span><br/>',
				    '<b>Identificator : </b><span>{id}</span><br/>',
				    '<b>Description : </b><span>{descriptionText}</span><br/>',
				    //'<b>Documentation : </b><span>{documentationUrl}</span><br/>',
				  '</div>',
				'</tpl>'
			);
10200969   Roipoussiere   Remove whitespace...
76

16035364   Benjamin Renard   First commit
77
78
79
80
81
82
83
84
85
86
87
88
			return {
				xtype : 'dataview',
				store : clientsStore,
				tpl: tpl,
				emptyText: 'No clients to show',
				itemSelector : 'div.clientinfo',
				overClass:'x-view-over',
				autoScroll : true,
				width  : 300,
				height : 300
			};
		},
10200969   Roipoussiere   Remove whitespace...
89

16035364   Benjamin Renard   First commit
90
91
92
		getSampTab : function (clientsStore)
		{
			var me = this;
10200969   Roipoussiere   Remove whitespace...
93

16035364   Benjamin Renard   First commit
94
95
96
97
98
99
100
101
102
103
104
			return {
				xtype : 'panel',
				id : 'samp_tab_panel',
				title : 'SAMP',
				layout : 'fit',
				items : [
				         this.getSampClientsDataView(clientsStore)
				         ],
				tbar : me.getSampToolBar()
			};
		},
10200969   Roipoussiere   Remove whitespace...
105

db3a6e4b   Nathanael Jourdane   fix tabs on inter...
106
107
	init: function(config) {
		var me = this;
30cd92df   Roipoussiere   Fix merge conflicts
108

db3a6e4b   Nathanael Jourdane   fix tabs on inter...
109
110
		this.onSwitchConnect = config.onSwitchConnect;
		var activeTab = config.activeTab ? config.activeTab : 0;
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
111
112

		var myConf = {
30cd92df   Roipoussiere   Fix merge conflicts
113
			plain: true,
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
114
115
116
			activeTab: activeTab,
			defaults: {
				autoHeight: true,
30cd92df   Roipoussiere   Fix merge conflicts
117
118
				layout: 'fit',
				bodyStyle: { background: '#dfe8f6' }
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
119
120
121
			},
			items: [
				this.getSampTab(config.clientsStore),
db3a6e4b   Nathanael Jourdane   fix tabs on inter...
122
123
				{xtype: 'paramsMgrPanel', baseId: config.baseId, layout: 'hbox'},
				{xtype: 'panelEpnTap'}
a8794c12   Nathanael Jourdane   Big refactoring (...
124
			],
db3a6e4b   Nathanael Jourdane   fix tabs on inter...
125
126
127
128
			listeners: {
				afterrender: function() { config.loadTab(this.getActiveTab()); },
				tabchange: function(tabpanel, tab) { config.loadTab(tab); }
			}
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
129
		};
30cd92df   Roipoussiere   Fix merge conflicts
130
		Ext.apply (this, Ext.apply (arguments, myConf));
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
131
	}
10200969   Roipoussiere   Remove whitespace...
132
});