Commit db3a6e4b3b43ec3b64f7e1014c94b46930281a73

Authored by Nathanael Jourdane
1 parent c3a9999d

fix tabs on interop module

js/app/controllers/InteropModule.js
1 1 /**
2   - * Project  : AMDA-NG
3   - * Name : InteropModule.js
4   - * @class amdaDesktop.InteropModule
  2 + * Project  : AMDA-NG
  3 + * Name : InteropModule.js
  4 + * @class amdaDesktop.InteropModule
5 5 * @extends amdaDesktop.AmdaModule
6   - * @brief Interop Module controller definition
  6 + * @brief Interop Module controller definition
7 7 * @extends amdaDesktop.InteractiveModule
8   - * @brief Interop Module controller definition
  8 + * @brief Interop Module controller definition
9 9 * @author Benjamin RENARD
10 10 * $Id: InteropModule.js 1870 2013-11-22 13:43:34Z elena $
11 11 *****************************************************************************
12   - * FT Id : Date : Name - Description
  12 + * FT Id : Date : Name - Description
13 13 *******************************************************************************
14 14 * 23/04/2012: BRE - file creation
15 15 */
... ... @@ -19,44 +19,44 @@ Ext.define('amdaDesktop.InteropModule', {
19 19 extend: 'amdaDesktop.AmdaModule',
20 20  
21 21 requires: [
22   - 'amdaUI.InteropUI',
23   - 'amdaDesktop.SampModule',
  22 + 'amdaUI.InteropUI',
  23 + 'amdaDesktop.SampModule',
24 24 'amdaDesktop.EpnTapModule'
25   - ],
  25 + ],
26 26  
27   - contentId : 'interopUI',
  27 + contentId: 'interopUI',
28 28  
29   - /**
30   - * @cfg {String} window definitions
31   - * @required
32   - */
33   - height: 650,
34   - width: 1050,
35   - uiType : 'panelInterop',
  29 + /**
  30 + * @cfg {String} window definitions
  31 + * @required
  32 + */
  33 + height: 650,
  34 + width: 1050,
  35 + uiType : 'panelInterop',
36 36 helpTitle :'Help on Interop Module',
37 37  
38   - samp : null,
  38 + samp: null,
39 39  
40   - sampclientsStore : new Ext.data.SimpleStore({
  40 + sampclientsStore: new Ext.data.SimpleStore({
41 41 idProperty: 'id',
42   - fields: [
43   - {name: 'id'},
44   - {name: 'name'},
45   - {name: 'descriptionText'},
46   - {name: 'iconUrl'},
47   - {name: 'acceptVOTable', type : 'boolean'},
48   - {name: 'acceptFITS', type : 'boolean'}
49   - ]
50   - }),
51   -
52   - init : function() {
53   - this.launcher = {
54   - text : this.title,
55   - iconCls : this.icon,
56   - handler : this.createWindow,
57   - scope : this
  42 + fields: [
  43 + {name: 'id'},
  44 + {name: 'name'},
  45 + {name: 'descriptionText'},
  46 + {name: 'iconUrl'},
  47 + {name: 'acceptVOTable', type: 'boolean'},
  48 + {name: 'acceptFITS', type: 'boolean'}
  49 + ]
  50 + }),
  51 +
  52 + init: function() {
  53 + this.launcher = {
  54 + text: this.title,
  55 + iconCls: this.icon,
  56 + handler: this.createWindow,
  57 + scope: this
58 58 };
59   - },
  59 + },
60 60  
61 61 loadEpnTap: function(icon_id) {
62 62 if(!this.epntap) {
... ... @@ -73,420 +73,371 @@ Ext.define('amdaDesktop.InteropModule', {
73 73 'icon-sw': ['ts', 'interplanetary_medium', 'all'],
74 74 'icon-solarsystem': ['ts', 'interplanetary_medium', 'all']
75 75 }
76   - this.epntap.loadTarget(icon_id ? icons_dic[icon_id] : false);
  76 + this.epntap.loadTarget(icon_id ? icons_dic[icon_id]: false);
77 77 },
78 78  
79   - initSampConnector : function(successfn)
80   - {
81   - var me = this;
82   - if (!this.samp)
83   - {
84   - this.samp = Ext.create('amdaDesktop.SampModule',{
85   - listeners : {
86   - connected : function(o,success)
87   - {
88   - if (!success)
89   - Ext.Msg.show( {
90   - title : 'SAMP',
91   - msg : 'Cannot connect AMDA to a hub',
92   - modal : false,
93   - icon : Ext.Msg.ERROR,
94   - buttons : Ext.Msg.OK
95   - });
96   - me.updateStatus();
97   - me.updateClients();
98   - },
99   - disconnected : function(o,success)
100   - {
101   - me.updateStatus();
102   - me.sampclientsStore.removeAll();
103   - me.updateClients();
104   - },
105   - clientregister : function(o,id)
106   - {
107   - me.updateClients();
108   - },
109   - clientunregister : function(o,id)
110   - {
111   - var record = me.sampclientsStore.getById(id);
112   - if (record)
113   - {
114   - me.sampclientsStore.remove(record);
115   - me.updateClients();
116   - }
117   - },
118   - clientmetachange : function(o,id,data,subs)
119   - {
120   - var record = me.sampclientsStore.getById(id);
121   -
122   - if (!record)
123   - {
124   - me.sampclientsStore.add({id : id});
125   - record = me.sampclientsStore.getById(id);
126   - }
127   -
128   - if (record)
129   - {
130   - record.set('descriptionText',data['samp.description.text']);
131   - record.set('iconUrl',data['samp.icon.url']);
132   - record.set('name',data['samp.name']);
133   - if (subs)
134   - {
135   - record.set('acceptVOTable',
136   - me.samp.isSubscribed(subs,"table.load.votable"));
137   - record.set('acceptFITS',
138   - me.samp.isSubscribed(subs,"image.load.fits"));
139   - }
140   - }
141   -
142   - me.updateClients();
143   - },
144   - clientsubs : function(o,id,data)
145   - {
146   - var record = me.sampclientsStore.getById(id);
147   -
148   - if (!record)
149   - return;
150   -
151   - if (record)
152   - {
153   - record.set('acceptVOTable',
154   - me.samp.isSubscribed(data,"table.load.votable"));
155   - record.set('acceptFITS',
156   - me.samp.isSubscribed(data,"image.load.fits"));
157   - }
158   -
159   - me.updateClients();
160   - },
161   - uploadfile : function(o,clientName,url,format)
162   - {
163   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.upload.id, true, function (module) {
164   - module.uploadNotification(url,format);
165   - });
166   - }
167   - }
168   - });
169   - this.samp.loadScript(function (s){
170   - if (successfn)
171   - successfn.call(me.samp);
172   - });
173   - }
174   - else
175   - this.samp.loadScript(function (s){
176   - if (successfn)
177   - successfn.call(me.samp);
178   - });
179   - },
180   -
181   - updateStatus : function()
182   - {
183   - if (this.app && this.samp)
184   - {
185   - var desktop = this.app.getDesktop();
186   -
187   - var isConnected = this.samp.isConnected();
188   -
189   - if (desktop)
190   - {
191   - var win = desktop.getWindow(this.id);
192   - if (win && win.isVisible)
193   - win.items.items[0].updateStatus(isConnected);
194   -
195   - var taskbar = desktop.taskbar;
196   -
197   - if (taskbar)
198   - {
199   - var samptb = taskbar.getComponent('samptb');
200   - if (samptb)
201   - samptb.updateStatus(isConnected);
202   - }
203   - }
204   - }
205   - },
206   -
207   - updateClients : function()
208   - {
209   - if (this.app && this.samp)
210   - {
211   - var desktop = this.app.getDesktop();
212   -
213   - var isConnected = this.samp.isConnected();
214   -
215   - if (desktop)
216   - {
217   - var win = desktop.getWindow(this.id);
218   -
219   - var taskbar = desktop.taskbar;
220   -
221   - if (taskbar)
222   - {
223   - var samptb = taskbar.getComponent('samptb');
224   - if (samptb)
225   - samptb.updateClients(this.sampclientsStore);
226   - }
227   - }
228   - }
229   - },
230   -
231   - sampConnected : function()
232   - {
233   - if (!this.samp)
234   - return false;
235   - return this.samp.isConnected();
236   - },
237   -
238   - sendVOTable : function(file,clientId)
239   - {
240   - if (!this.samp)
241   - return false;
242   - var href = window.location.href;
243   - var baseurl = href.replace('desktop.php','');
244   - this.samp.sendVOTable(baseurl+file,clientId);
245   - },
246   -
247   - sendAladinScript : function(script)
248   - {
249   - if (!this.samp)
250   - return false;
251   - this.samp.sendAladinScript(script);
252   - },
253   -
254   - sendFITS : function(url,name)
255   - {
256   - if (!this.samp)
257   - return false;
258   - this.samp.sendFITS(url,name);
259   - },
260   -
261   - generateAladinScript : function(urlList, scriptType)
262   - {
  79 + initSampConnector: function(successfn) {
  80 + var me = this;
  81 + if(!this.samp) {
  82 + this.samp = Ext.create('amdaDesktop.SampModule', {
  83 + listeners: {
  84 + connected: function(o,success) {
  85 + if(!success) {
  86 + Ext.Msg.show( {
  87 + title: 'SAMP',
  88 + msg: 'Cannot connect AMDA to a hub',
  89 + modal: false,
  90 + icon: Ext.Msg.ERROR,
  91 + buttons: Ext.Msg.OK
  92 + });
  93 + }
  94 + me.updateStatus();
  95 + me.updateClients();
  96 + },
  97 + disconnected: function(o,success) {
  98 + me.updateStatus();
  99 + me.sampclientsStore.removeAll();
  100 + me.updateClients();
  101 + },
  102 + clientregister: function(o,id) {
  103 + me.updateClients();
  104 + },
  105 + clientunregister: function(o,id) {
  106 + var record = me.sampclientsStore.getById(id);
  107 + if(record)
  108 + {
  109 + me.sampclientsStore.remove(record);
  110 + me.updateClients();
  111 + }
  112 + },
  113 + clientmetachange: function(o,id,data,subs) {
  114 + var record = me.sampclientsStore.getById(id);
  115 +
  116 + if(!record) {
  117 + me.sampclientsStore.add({id: id});
  118 + record = me.sampclientsStore.getById(id);
  119 + }
  120 +
  121 + if(record) {
  122 + record.set('descriptionText',data['samp.description.text']);
  123 + record.set('iconUrl',data['samp.icon.url']);
  124 + record.set('name',data['samp.name']);
  125 + if(subs) {
  126 + record.set('acceptVOTable', me.samp.isSubscribed(subs,"table.load.votable"));
  127 + record.set('acceptFITS', me.samp.isSubscribed(subs,"image.load.fits"));
  128 + }
  129 + }
  130 +
  131 + me.updateClients();
  132 + },
  133 + clientsubs: function(o,id,data) {
  134 + var record = me.sampclientsStore.getById(id);
  135 +
  136 + if(!record) {
  137 + return;
  138 + } else {
  139 + record.set('acceptVOTable', me.samp.isSubscribed(data,"table.load.votable"));
  140 + record.set('acceptFITS', me.samp.isSubscribed(data,"image.load.fits"));
  141 + }
  142 + me.updateClients();
  143 + },
  144 + uploadfile: function(o,clientName,url,format) {
  145 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.upload.id, true, function (module) {
  146 + module.uploadNotification(url,format);
  147 + });
  148 + }
  149 + }
  150 + });
  151 + this.samp.loadScript(function (s) {
  152 + if(successfn)
  153 + successfn.call(me.samp);
  154 + });
  155 + }
  156 + else {
  157 + this.samp.loadScript(function(s) {
  158 + if(successfn)
  159 + successfn.call(me.samp);
  160 + });
  161 + }
  162 + },
  163 +
  164 + updateStatus: function() {
  165 + if(this.app && this.samp) {
  166 + var desktop = this.app.getDesktop();
  167 + var isConnected = this.samp.isConnected();
  168 +
  169 + if(desktop) {
  170 + var win = desktop.getWindow(this.id);
  171 + if(win && win.isVisible)
  172 + win.items.items[0].updateStatus(isConnected);
  173 +
  174 + var taskbar = desktop.taskbar;
  175 +
  176 + if(taskbar) {
  177 + var samptb = taskbar.getComponent('samptb');
  178 + if(samptb)
  179 + samptb.updateStatus(isConnected);
  180 + }
  181 + }
  182 + }
  183 + },
  184 +
  185 + updateClients: function() {
  186 + if(this.app && this.samp) {
  187 + var desktop = this.app.getDesktop();
  188 + var isConnected = this.samp.isConnected();
  189 +
  190 + if(desktop) {
  191 + var win = desktop.getWindow(this.id);
  192 + var taskbar = desktop.taskbar;
  193 +
  194 + if(taskbar) {
  195 + var samptb = taskbar.getComponent('samptb');
  196 + if(samptb)
  197 + samptb.updateClients(this.sampclientsStore);
  198 + }
  199 + }
  200 + }
  201 + },
  202 +
  203 + sampConnected: function() {
  204 + if(!this.samp)
  205 + return false;
  206 + return this.samp.isConnected();
  207 + },
  208 +
  209 + sendVOTable: function(file,clientId) {
  210 + if(!this.samp)
  211 + return false;
  212 + var href = window.location.href;
  213 + var baseurl = href.replace('desktop.php','');
  214 + this.samp.sendVOTable(baseurl+file,clientId);
  215 + },
  216 +
  217 + sendAladinScript: function(script) {
  218 + if(!this.samp)
  219 + return false;
  220 + this.samp.sendAladinScript(script);
  221 + },
  222 +
  223 + sendFITS: function(url,name) {
  224 + if(!this.samp)
  225 + return false;
  226 + this.samp.sendFITS(url,name);
  227 + },
  228 +
  229 + generateAladinScript: function(urlList, scriptType) {
263 230 /*var script="reset;"; //reset all views & all planes
264   - // first get files
265   - var scriptHead='';
266   - //var script="#AJS;\n";
267   - //scriptHead+="trace 3;"; //
268   - for( var i=0; i < urlList.length; i++)
269   - {
270   - var url = urlList[i].url;
271   - var name = urlList[i].name;
272   - scriptHead += 'get File(' + url +','+name+');';
273   - scriptHead += 'sync;';
274   - }*/
275   -
276   - //scriptHead += 'sync;';
277   -
278   - /*for( var i=0; i < urlList.length; i++)
279   - {
280   - //then modify some fits values
281   - var name = urlList[i].name;
282   - scriptHead += 'set '+name+' FITS:CRVAL1=0;';
283   - scriptHead += 'set '+name+' FITS:CRVAL2=0;';
284   - }*/
285   -
286   - //scriptHead += 'sync;';
287   -
288   - // add som method specific lines
289   - /*switch( scriptType )
290   - {
291   - case( 'mosaic' ):
292   - // first insert the modeview
293   - script += "mview 16;";
294   - // then download the files
295   - script += scriptHead;
296   - //for( var i=0; i < urlList.length; i++){
297   - // // we also shall position each image in the grid
298   - // var gridCols = ["A", "B", "C", "D"];
299   - // var colIndex = i%4;
300   - // var lineIndex = 1+Math.floor(i/4);
301   - // script += "cview "+i+" "+gridCols[colIndex]+lineIndex+";\n";
302   - //}
303   - break;
304   -
305   - case( 'movie' ):
306   - // download first
307   - script += scriptHead;
308   - script += 'blink ';
309   - for( var i=1; i < urlList.length; i++){
310   - script += urlList[i].name+" ";
311   - }
312   - script += ';';
313   - break;
314   -
315   - case( 'diff' ):
316   - // download first
317   - script += scriptHead;
318   - for( var i=1; i < urlList.length; i++){
319   - var diffName = 'diff' + i;
320   - var currRawName = urlList[i].name;
321   - var prevRawNum = i-1;
322   - var prevRawName = urlList[prevRawNum].name;
323   - script += diffName + ' = ' + currRawName + ' - ' + prevRawName + ';\n';
324   - }
325   - script += 'sync;';
326   - script += 'diff_movie = blink ';
327   - for( var i=1; i < urlList.length; i++){
328   - script += 'diff'+i+' ';
329   - }
330   - script += ';';
331   - break;
332   - }
333   - //script += 'sync;';*/
334   -
335   - var script = 'reset;';
336   -
337   - for( var i=0; i < urlList.length; i++)
  231 + // first get files
  232 + var scriptHead='';
  233 + //var script="#AJS;\n";
  234 + //scriptHead+="trace 3;"; //
  235 + for( var i=0; i < urlList.length; i++)
338 236 {
339 237 var url = urlList[i].url;
340 238 var name = urlList[i].name;
  239 + scriptHead += 'get File(' + url +','+name+');';
  240 + scriptHead += 'sync;';
  241 + }*/
  242 +
  243 + //scriptHead += 'sync;';
  244 +
  245 + /*for( var i=0; i < urlList.length; i++)
  246 + {
  247 + //then modify some fits values
  248 + var name = urlList[i].name;
  249 + scriptHead += 'set '+name+' FITS:CRVAL1=0;';
  250 + scriptHead += 'set '+name+' FITS:CRVAL2=0;';
  251 + }*/
  252 +
  253 + //scriptHead += 'sync;';
  254 +
  255 + // add som method specific lines
  256 + /*switch( scriptType )
  257 + {
  258 + case( 'mosaic' ):
  259 + // first insert the modeview
  260 + script += "mview 16;";
  261 + // then download the files
  262 + script += scriptHead;
  263 + //for( var i=0; i < urlList.length; i++){
  264 + // // we also shall position each image in the grid
  265 + // var gridCols = ["A", "B", "C", "D"];
  266 + // var colIndex = i%4;
  267 + // var lineIndex = 1+Math.floor(i/4);
  268 + // script += "cview "+i+" "+gridCols[colIndex]+lineIndex+";\n";
  269 + //}
  270 + break;
  271 +
  272 + case( 'movie' ):
  273 + // download first
  274 + script += scriptHead;
  275 + script += 'blink ';
  276 + for( var i=1; i < urlList.length; i++){
  277 + script += urlList[i].name+" ";
  278 + }
  279 + script += ';';
  280 + break;
  281 +
  282 + case( 'diff' ):
  283 + // download first
  284 + script += scriptHead;
  285 + for( var i=1; i < urlList.length; i++){
  286 + var diffName = 'diff' + i;
  287 + var currRawName = urlList[i].name;
  288 + var prevRawNum = i-1;
  289 + var prevRawName = urlList[prevRawNum].name;
  290 + script += diffName + ' = ' + currRawName + ' - ' + prevRawName + ';\n';
  291 + }
  292 + script += 'sync;';
  293 + script += 'diff_movie = blink ';
  294 + for( var i=1; i < urlList.length; i++){
  295 + script += 'diff'+i+' ';
  296 + }
  297 + script += ';';
  298 + break;
  299 + }
  300 + //script += 'sync;';*/
  301 +
  302 + var script = 'reset;';
  303 +
  304 + for( var i=0; i < urlList.length; i++) {
  305 + var url = urlList[i].url;
  306 + var name = urlList[i].name;
341 307 script += 'get File(' + url +','+name+');';
342 308 }
343 309  
344   - script += 'sync;';
345   -
346   - /*for( var i=0; i < urlList.length; i++)
347   - {
348   - //then modify some fits values
349   - var name = urlList[i].name;
350   - script += 'set '+name+' FITS:CRPIX1=100;';
351   - script += 'set '+name+' FITS:CRPIX2=0;';
352   - }*/
353   -
354   - switch( scriptType )
355   - {
356   - case('mosaic'):
357   - {
358   -
359   - script += 'sync;mview 16';
360   - }
361   - break;
362   - case('movie'):
363   - {
364   - script += 'blink ';
365   - for( var i=1; i < urlList.length; i++){
366   - script += urlList[i].name+" ";
367   - }
368   - script += ';';
369   - }
370   - break;
371   - }
372   -
373   -
374   -
375   - return script;
376   - },
  310 + script += 'sync;';
377 311  
378   - switchSampConnect : function()
379   - {
380   - var me = this;
381   - //loadMask.show();
382   - this.initSampConnector(function (s){
383   - if (me.samp.isConnected())
384   - {
385   - me.samp.disconnect();
386   - }
387   - else
388   - {
389   - me.samp.connect();
390   - // loadMask.hide();
391   - }
392   - });
393   -
394   - },
395   -
396   - forceSampDisconnect : function()
397   - {
398   - if (!this.samp)
399   - return;
400   -
401   - if (!this.samp.isConnected())
402   - return;
403   -
404   - this.samp.disconnect();
405   - },
406   -
407   - getVOTableClients : function ()
408   - {
409   - //return list of all clients that can receive a VOTable
410   - if (!this.samp)
411   - return [];
412   - var result = new Array();
413   - this.sampclientsStore.each(function (client){
414   - if (client.get('acceptVOTable'))
415   - result.push({id : client.get('id'), name : client.get('name'), icon : client.get('iconUrl')});
416   -
417   - },this);
418   - return result;
419   - },
420   -
421   - getFITSClients : function ()
422   - {
423   - //return list of all clients that can receive a FITS image
424   - if (!this.samp)
425   - return [];
426   - var result = new Array();
427   - this.sampclientsStore.each(function (client){
428   - if (client.get('acceptFITS'))
429   - result.push({id : client.get('id'), name : client.get('name'), icon : client.get('iconUrl')});
430   -
431   - },this);
432   - return result;
433   -
434   - },
435   - // arguments from launcher : CONFIG (OBJECT!!!)
436   - createWindow : function(config){
437   - var me = this;
438   - var baseId = null;
439   -
440   - if (!Ext.isObject(config)) {
441   - baseId = config;
442   - }
443   - var desktop = this.app.getDesktop();
444   - var win = desktop.getWindow(this.id);
445   -
446   - activeTab = (config && 'activeTab' in config) ? config['activeTab'] : 1;
447   -
448   - if(!win)
449   - {
450   - win = desktop.createWindow({
451   - id: this.id,
452   - title:this.title,
453   - layout: 'anchor',
454   - width:800,
455   - height:600,
456   - modal: true,
457   - minimizable: false,
458   - iconCls: this.icon,
459   - animCollapse:false,
460   - constrainHeader:true,
461   - bodyPadding : 5,
462   - stateful : true,
463   - stateId : this.id,
464   - stateEvents: ['move','show','resize'],
465   - items : [
466   - {
467   - xtype: 'panelInterop',
468   - clientsStore : this.sampclientsStore,
469   - activeTab : activeTab,
470   - baseId : baseId,
471   - loadTab: function(tab) {
472   - if(tab['id'] == 'epnTapTab') {
473   - me.loadEpnTap(config && 'epntapTarget' in config ? config['epntapTarget'] : false);
  312 + /*for( var i=0; i < urlList.length; i++)
  313 + {
  314 + //then modify some fits values
  315 + var name = urlList[i].name;
  316 + script += 'set '+name+' FITS:CRPIX1=100;';
  317 + script += 'set '+name+' FITS:CRPIX2=0;';
  318 + }*/
  319 +
  320 + switch( scriptType ) {
  321 + case('mosaic'):
  322 + {
  323 + script += 'sync;mview 16';
  324 + }
  325 + break;
  326 + case('movie'):
  327 + {
  328 + script += 'blink ';
  329 + for( var i=1; i < urlList.length; i++) {
  330 + script += urlList[i].name+" ";
  331 + }
  332 + script += ';';
474 333 }
475   - },
476   - onSwitchConnect : function ()
477   - {
478   - me.switchSampConnect();
479   - }
480   - }
481   - ]
482   - });
483   - }
484   -
485   - if (me.samp && me.samp.ready)
486   - this.updateStatus();
487   -
488   - win.show();
489   - return win;
  334 + break;
  335 + }
  336 +
  337 + return script;
  338 + },
  339 +
  340 + switchSampConnect: function() {
  341 + var me = this;
  342 + //loadMask.show();
  343 + this.initSampConnector(function(s) {
  344 + if(me.samp.isConnected())
  345 + {
  346 + me.samp.disconnect();
  347 + }
  348 + else
  349 + {
  350 + me.samp.connect();
  351 + // loadMask.hide();
  352 + }
  353 + });
  354 + },
  355 +
  356 + forceSampDisconnect: function() {
  357 + if(!this.samp)
  358 + return;
  359 +
  360 + if(!this.samp.isConnected())
  361 + return;
  362 +
  363 + this.samp.disconnect();
  364 + },
  365 +
  366 + getVOTableClients: function() {
  367 + //return list of all clients that can receive a VOTable
  368 + if(!this.samp)
  369 + return [];
  370 + var result = new Array();
  371 + this.sampclientsStore.each(function (client){
  372 + if(client.get('acceptVOTable'))
  373 + result.push({id: client.get('id'), name: client.get('name'), icon: client.get('iconUrl')});
  374 +
  375 + }, this);
  376 + return result;
  377 + },
  378 +
  379 + getFITSClients: function() {
  380 + //return list of all clients that can receive a FITS image
  381 + if(!this.samp)
  382 + return [];
  383 + var result = new Array();
  384 + this.sampclientsStore.each(function (client){
  385 + if(client.get('acceptFITS'))
  386 + result.push({id: client.get('id'), name: client.get('name'), icon: client.get('iconUrl')});
  387 +
  388 + }, this);
  389 + return result;
  390 + },
  391 + // arguments from launcher: CONFIG (OBJECT!!!)
  392 + createWindow: function(config) {
  393 + var me = this;
  394 + var baseId = null;
  395 +
  396 + if(!Ext.isObject(config)) {
  397 + baseId = config;
  398 + }
  399 + var desktop = this.app.getDesktop();
  400 + var win = desktop.getWindow(this.id);
  401 + var activeTab = (config && 'activeTab' in config) ? config['activeTab']: 1;
  402 +
  403 + if(!win) {
  404 + win = desktop.createWindow({
  405 + id: this.id,
  406 + title: this.title,
  407 + layout: 'anchor',
  408 + width: 800,
  409 + height: 600,
  410 + modal: true,
  411 + minimizable: false,
  412 + iconCls: this.icon,
  413 + animCollapse: false,
  414 + constrainHeader: true,
  415 + bodyPadding: 5,
  416 + stateful: true,
  417 + stateId: this.id,
  418 + stateEvents: ['move','show','resize'],
  419 + items: [{
  420 + xtype: 'panelInterop',
  421 + clientsStore: this.sampclientsStore,
  422 + activeTab: activeTab,
  423 + baseId: baseId,
  424 + loadTab: function(tab) {
  425 + if(tab['id'] == 'epntapTab') {
  426 + me.loadEpnTap(config && 'epntapTarget' in config ? config['epntapTarget']: false);
  427 + }
  428 + },
  429 + onSwitchConnect: function() {
  430 + me.switchSampConnect();
  431 + }
  432 + }]
  433 + });
  434 + }
  435 +
  436 + if(me.samp && me.samp.ready)
  437 + this.updateStatus();
  438 +
  439 + win.show();
  440 + return win;
490 441 }
491 442  
492 443 });
... ...
js/app/views/InteropUI.js
1 1 /**
2 2 * Project  : AMDA-NG
3   - * Name : InteropUI.js
  3 + * Name : InteropUI.js
4 4 * @class amdaUI.InteropUI
5 5 * @extends Ext.tab.Panel
6 6 * @brief Interop Module UI definition (View)
7 7 * @author Benjamin RENARD
8 8 * @version $Id: InteropUI.js 1093 2012-10-03 15:54:26Z elena $
9 9 ******************************************************************************
10   - * FT Id : Date : Name - Description
  10 + * FT Id : Date : Name - Description
11 11 ******************************************************************************
12   - * : :23/04/2012: BRE - file creation
  12 + * : :23/04/2012: BRE - file creation
13 13 */
14 14  
15 15  
16 16 Ext.define('amdaUI.InteropUI', {
17   - extend: 'Ext.tab.Panel',
18   - alias: 'widget.panelInterop',
  17 + extend: 'Ext.tab.Panel',
  18 + alias: 'widget.panelInterop',
19 19  
20 20 requires: [
21 21 'amdaUI.ParamsMgrUI', 'amdaUI.EpnTapUI'
22 22 ],
23 23  
24   - constructor: function(config) {
25   - this.init(config);
26   - this.callParent(arguments);
27   - },
28   -
29   - onSwitchConnect : Ext.emptyFn,
30   -
31   - updateStatus : function(isConnected)
32   - {
33   - var sampTab = this.getComponent('samp_tab_panel');
34   -
35   - var sampButton = sampTab.dockedItems.items[0].items.items[1];
36   - sampButton.setIconCls(isConnected ? 'icon-connected' : 'icon-disconnected');
37   - },
38   -
39   - /*updateClients : function(clients)
40   - {
41   - var sampTab = this.getComponent('samp_tab_panel');
42   -
43   - var sampDataView = sampTab.query('dataview')[0];
44   -
45   - sampDataView.store.loadData(clients);
46   - },*/
47   -
48   - getSampToolBar : function()
49   - {
50   - var me = this;
51   - return [
52   - 'SAMP connection : ',
53   - {
54   - iconCls : 'icon-disconnected',
55   - handler: function() {
56   - if (me.onSwitchConnect)
57   - me.onSwitchConnect();
58   - }
59   - }
60   - ];
61   - },
62   -
63   - getSampClientsDataView : function(clientsStore)
64   - {
65   - var tpl = new Ext.XTemplate(
66   - '<tpl for=".">',
67   - '<div style="margin: 2px;border: 1px solid #99BDE8;" class="clientinfo">',
68   - '<img src="{iconUrl}" width=24 height=24/><br/>',
69   - '<b>Name : </b><span>{name}</span><br/>',
70   - '<b>Identificator : </b><span>{id}</span><br/>',
71   - '<b>Description : </b><span>{descriptionText}</span><br/>',
72   - //'<b>Documentation : </b><span>{documentationUrl}</span><br/>',
73   - '</div>',
74   - '</tpl>'
75   - );
76   -
77   - return {
78   - xtype : 'dataview',
79   - store : clientsStore,
80   - tpl: tpl,
81   - emptyText: 'No clients to show',
82   - itemSelector : 'div.clientinfo',
83   - overClass:'x-view-over',
84   - autoScroll : true,
85   - width : 300,
86   - height : 300
87   - };
88   - },
89   -
90   - getSampTab : function (clientsStore)
91   - {
92   - var me = this;
93   -
94   - return {
95   - xtype : 'panel',
96   - id : 'samp_tab_panel',
97   - title : 'SAMP',
98   - layout : 'fit',
99   - items : [
100   - this.getSampClientsDataView(clientsStore)
101   - ],
102   - tbar : me.getSampToolBar()
103   - };
104   - },
105   -
106   - getEpnTapTab: function() {
107   - return {
108   - xtype : 'panelEpnTap',
109   - id : 'epnTapTab',
110   - title : 'EPN-TAP'
111   - };
112   - },
113   -
114   - init : function(config) {
115   -
116   - var me = this;
  24 + constructor: function(config) {
  25 + this.init(config);
  26 + this.callParent(arguments);
  27 + },
  28 +
  29 + onSwitchConnect : Ext.emptyFn,
  30 +
  31 + updateStatus: function(isConnected) {
  32 + var sampTab = this.getComponent('samp_tab_panel');
  33 +
  34 + var sampButton = sampTab.dockedItems.items[0].items.items[1];
  35 + sampButton.setIconCls(isConnected ? 'icon-connected' : 'icon-disconnected');
  36 + },
  37 +
  38 + /*updateClients : function(clients)
  39 + {
  40 + var sampTab = this.getComponent('samp_tab_panel');
  41 +
  42 + var sampDataView = sampTab.query('dataview')[0];
  43 +
  44 + sampDataView.store.loadData(clients);
  45 + },*/
  46 +
  47 + getSampToolBar: function() {
  48 + var me = this;
  49 + return [
  50 + 'SAMP connection : ',
  51 + {
  52 + iconCls: 'icon-disconnected',
  53 + handler: function() {
  54 + if (me.onSwitchConnect)
  55 + me.onSwitchConnect();
  56 + }
  57 + }
  58 + ];
  59 + },
  60 +
  61 + getSampClientsDataView: function(clientsStore) {
  62 + var tpl = new Ext.XTemplate(
  63 + '<tpl for=".">',
  64 + '<div style="margin: 2px;border: 1px solid #99BDE8;" class="clientinfo">',
  65 + '<img src="{iconUrl}" width=24 height=24/><br/>',
  66 + '<b>Name : </b><span>{name}</span><br/>',
  67 + '<b>Identificator : </b><span>{id}</span><br/>',
  68 + '<b>Description : </b><span>{descriptionText}</span><br/>',
  69 + //'<b>Documentation : </b><span>{documentationUrl}</span><br/>',
  70 + '</div>',
  71 + '</tpl>'
  72 + );
  73 +
  74 + return {
  75 + xtype : 'dataview',
  76 + store : clientsStore,
  77 + tpl: tpl,
  78 + emptyText: 'No clients to show',
  79 + itemSelector : 'div.clientinfo',
  80 + overClass:'x-view-over',
  81 + autoScroll : true,
  82 + width : 300,
  83 + height : 300
  84 + };
  85 + },
  86 +
  87 + getSampTab: function (clientsStore) {
  88 + var me = this;
  89 + return {
  90 + xtype : 'panel',
  91 + id : 'samp_tab_panel',
  92 + title : 'SAMP',
  93 + layout : 'fit',
  94 + items : [
  95 + this.getSampClientsDataView(clientsStore)
  96 + ],
  97 + tbar : me.getSampToolBar()
  98 + };
  99 + },
117 100  
118   - this.onSwitchConnect = config.onSwitchConnect;
119   - var activeTab = config.activeTab ? config.activeTab : 0;
  101 + init: function(config) {
  102 + var me = this;
  103 + this.onSwitchConnect = config.onSwitchConnect;
  104 + var activeTab = config.activeTab ? config.activeTab : 0;
120 105  
121 106 var myConf = {
122 107 plain : true,
... ... @@ -128,15 +113,14 @@ Ext.define(&#39;amdaUI.InteropUI&#39;, {
128 113 },
129 114 items: [
130 115 this.getSampTab(config.clientsStore),
131   - { xtype: 'paramsMgrPanel', baseId: config.baseId, layout: 'hbox'},
132   - this.getEpnTapTab()
  116 + {xtype: 'paramsMgrPanel', baseId: config.baseId, layout: 'hbox'},
  117 + {xtype: 'panelEpnTap'}
133 118 ],
134   - listeners: {
135   - afterrender: function() { config.loadTab(this.getActiveTab()); },
136   - tabchange: function(tabpanel, tab) { config.loadTab(tab); }
137   - }
  119 + listeners: {
  120 + afterrender: function() { config.loadTab(this.getActiveTab()); },
  121 + tabchange: function(tabpanel, tab) { config.loadTab(tab); }
  122 + }
138 123 };
139   -
140 124 Ext.apply (this , Ext.apply (arguments, myConf));
141 125 }
142 126 });
... ...