Commit bab90f22a9435bb4360ccdd8202dd43b990b16ed
1 parent
29c449bb
Exists in
master
and in
111 other branches
format + #5668
Showing
1 changed file
with
440 additions
and
459 deletions
Show diff stats
js/app/views/PlotTabResultUI.js
... | ... | @@ -5,67 +5,63 @@ |
5 | 5 | * @extends Ext. panel.Panel |
6 | 6 | * @brief Plot Tab Result UI definition (View) |
7 | 7 | * @author |
8 | - * @version $Id: PlotTabResultUI.js benjamin $ | |
9 | - ******************************************************************************** | |
10 | - * FT Id : Date : Name - Description | |
11 | - ******************************************************************************* | |
12 | - * | |
8 | + * @version $Id: PlotTabResultUI.js benjamin | |
13 | 9 | */ |
14 | 10 | |
15 | 11 | Ext.define('amdaUI.PlotTabResultUI', { |
16 | - extend: 'Ext.panel.Panel', | |
17 | - | |
18 | - alias: 'widget.plotTabResult', | |
12 | + extend: 'Ext.panel.Panel', | |
19 | 13 | |
20 | - requires: [ | |
21 | - 'amdaPlotComp.PlotZoomPlug', | |
22 | - 'amdaPlotComp.PlotExtendShiftPlug', | |
23 | - 'amdaPlotComp.PlotContextManager', | |
24 | - 'amdaPlotComp.PlotResultImage' | |
25 | - ], | |
26 | - | |
27 | - panelImage : null, | |
28 | - crtContext : null, | |
29 | - tabId : '', | |
30 | - multiPlotCheck : null, | |
31 | - navToolBar : null, | |
32 | - isTTNavBar : false, | |
33 | - crtTTFileIndex : 0, | |
34 | - disableSynchronize: false, | |
14 | + alias: 'widget.plotTabResult', | |
15 | + | |
16 | + requires: [ | |
17 | + 'amdaPlotComp.PlotZoomPlug', | |
18 | + 'amdaPlotComp.PlotExtendShiftPlug', | |
19 | + 'amdaPlotComp.PlotContextManager', | |
20 | + 'amdaPlotComp.PlotResultImage' | |
21 | + ], | |
35 | 22 | |
36 | - hiddenForm: null, | |
23 | + panelImage : null, | |
24 | + crtContext : null, | |
25 | + tabId : '', | |
26 | + multiPlotCheck : null, | |
27 | + navToolBar : null, | |
28 | + isTTNavBar : false, | |
29 | + crtTTFileIndex : 0, | |
30 | + disableSynchronize: false, | |
31 | + | |
32 | + hiddenForm: null, | |
37 | 33 | |
38 | - constructor: function(config) { | |
39 | - this.addEvents({'pagesize':true}); | |
40 | - | |
41 | - this.init(config); | |
42 | - this.callParent(arguments); | |
43 | - }, | |
34 | + constructor: function(config) { | |
35 | + this.addEvents({'pagesize':true}); | |
36 | + | |
37 | + this.init(config); | |
38 | + this.callParent(arguments); | |
39 | + }, | |
44 | 40 | |
45 | - getImageSize : function() { | |
46 | - if (!this.crtContext) | |
47 | - return { | |
48 | - width : 0, | |
49 | - height : 0 | |
50 | - }; | |
51 | - | |
52 | - return { | |
53 | - width : this.crtContext.page.width * this.sliderPage.getValue()/100., | |
54 | - height : this.crtContext.page.height * this.sliderPage.getValue()/100. | |
55 | - } | |
56 | - }, | |
41 | + getImageSize : function() { | |
42 | + if (!this.crtContext) | |
43 | + return { | |
44 | + width : 0, | |
45 | + height : 0 | |
46 | + }; | |
47 | + | |
48 | + return { | |
49 | + width : this.crtContext.page.width * this.sliderPage.getValue()/100., | |
50 | + height : this.crtContext.page.height * this.sliderPage.getValue()/100. | |
51 | + } | |
52 | + }, | |
57 | 53 | |
58 | - getImageUrl: function(resultFolder, plotFile) { | |
59 | - return 'data/'+sessionID +'/RES/'+resultFolder+ '/' + plotFile; | |
60 | - }, | |
54 | + getImageUrl: function(resultFolder, plotFile) { | |
55 | + return 'data/'+sessionID +'/RES/'+resultFolder+ '/' + plotFile; | |
56 | + }, | |
61 | 57 | |
62 | - getInteractiveMultiPlotState: function() { | |
63 | - if (!this.multiPlotCheck) | |
64 | - return false; | |
65 | - return this.multiPlotCheck.getValue(); | |
66 | - }, | |
58 | + getInteractiveMultiPlotState: function() { | |
59 | + if (!this.multiPlotCheck) | |
60 | + return false; | |
61 | + return this.multiPlotCheck.getValue(); | |
62 | + }, | |
67 | 63 | |
68 | - toPixelOnSourceImage : function(value) { | |
64 | + toPixelOnSourceImage : function(value) { | |
69 | 65 | return value*100/this.sliderPage.getValue(); |
70 | 66 | }, |
71 | 67 | |
... | ... | @@ -290,21 +286,21 @@ Ext.define('amdaUI.PlotTabResultUI', { |
290 | 286 | if (panel.plotArea.hasSpectro) |
291 | 287 | { |
292 | 288 | me.contextualMenu.add([ |
293 | - { | |
294 | - text:'Instant cut at this position', | |
295 | - handler : function () | |
296 | - { | |
297 | - var timeAxisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panel, 'timeAxis'); | |
298 | - if (timeAxisContext == null) | |
299 | - return; | |
300 | - var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(timeAxisContext, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos); | |
301 | - var crtTime = new Date(crtTimestamp*1000); | |
302 | - crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset()); | |
303 | - me.callInteractivePlot({'action' : 'instant', 'tabId' : this.tabId, 'panelId' : panel.id, 'time' : crtTime}); | |
304 | - }, | |
305 | - scope: me | |
306 | - }, | |
307 | - '-' | |
289 | + { | |
290 | + text:'Instant cut at this position', | |
291 | + handler : function () | |
292 | + { | |
293 | + var timeAxisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panel, 'timeAxis'); | |
294 | + if (timeAxisContext == null) | |
295 | + return; | |
296 | + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(timeAxisContext, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos); | |
297 | + var crtTime = new Date(crtTimestamp*1000); | |
298 | + crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset()); | |
299 | + me.callInteractivePlot({'action' : 'instant', 'tabId' : this.tabId, 'panelId' : panel.id, 'time' : crtTime}); | |
300 | + }, | |
301 | + scope: me | |
302 | + }, | |
303 | + '-' | |
308 | 304 | ]); |
309 | 305 | } |
310 | 306 | if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos)) |
... | ... | @@ -315,110 +311,107 @@ Ext.define('amdaUI.PlotTabResultUI', { |
315 | 311 | me.contextualMenu.add('-'); |
316 | 312 | |
317 | 313 | me.contextualMenu.add([ |
318 | - { | |
319 | - text:'Extend/Shift Time request', | |
320 | - handler : function () | |
321 | - { | |
322 | - var extendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id'); | |
323 | - extendShiftPlugin.show(me.tabId); | |
324 | - }, | |
325 | - scope: me | |
326 | - }, | |
327 | - '-', | |
328 | - { | |
329 | - text: 'Save Plot', | |
330 | - handler : function () | |
331 | - { | |
332 | - if (me.hiddenForm == null) | |
333 | - me.hiddenForm = Ext.create('Ext.form.Panel', { | |
334 | - title:'hiddenForm', | |
335 | - renderTo: Ext.getBody(), | |
336 | - standardSubmit: true, | |
337 | - url: 'php/downloadPlot.php', | |
338 | - timeout: 120000, | |
339 | - height:100, | |
340 | - width: 100, | |
341 | - hidden:true, | |
342 | - items:[ | |
343 | - ] | |
344 | - }); | |
314 | + { | |
315 | + text:'Extend/Shift Time request', | |
316 | + handler : function () | |
317 | + { | |
318 | + var extendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id'); | |
319 | + extendShiftPlugin.show(me.tabId); | |
320 | + }, | |
321 | + scope: me | |
322 | + }, | |
323 | + '-', | |
324 | + { | |
325 | + text: 'Save Plot', | |
326 | + handler : function () | |
327 | + { | |
328 | + if (me.hiddenForm == null) | |
329 | + me.hiddenForm = Ext.create('Ext.form.Panel', { | |
330 | + title:'hiddenForm', | |
331 | + renderTo: Ext.getBody(), | |
332 | + standardSubmit: true, | |
333 | + url: 'php/downloadPlot.php', | |
334 | + timeout: 120000, | |
335 | + height:100, | |
336 | + width: 100, | |
337 | + hidden:true, | |
338 | + items:[] | |
339 | + }); | |
345 | 340 | |
346 | - me.hiddenForm.getForm().submit({ | |
347 | - params: { | |
348 | - sessionId: sessionID, | |
349 | - tabId : me.tabId | |
350 | - }, | |
351 | - success: function(form, action) { | |
352 | - }, | |
353 | - failure: function(form, action) { | |
354 | - } | |
355 | - }); | |
356 | - } | |
357 | - } | |
341 | + me.hiddenForm.getForm().submit({ | |
342 | + params: { | |
343 | + sessionId: sessionID, | |
344 | + tabId : me.tabId | |
345 | + }, | |
346 | + success: function(form, action) {}, | |
347 | + failure: function(form, action) {} | |
348 | + }); | |
349 | + } | |
350 | + } | |
358 | 351 | ]); |
359 | 352 | |
360 | 353 | me.contextualMenu.showAt(absoluteX, absoluteY); |
361 | 354 | } |
362 | - }); | |
355 | + }); | |
363 | 356 | |
364 | - return this.panelImage; | |
365 | - }, | |
357 | + return this.panelImage; | |
358 | + }, | |
366 | 359 | |
367 | - updatePlotImage: function(configResult, newPlot) { | |
368 | - this.crtContext = configResult.context; | |
369 | - | |
370 | - this.crtTTFileIndex = configResult.ttFileIndex; | |
371 | - | |
372 | - if (this.isTTNavBar != (!configResult.isInterval) || (this.isSuperposeMode != this.crtContext.page.superposeMode)) | |
373 | - { | |
374 | - //Update navigation bar | |
375 | - this.updateNavToolBar(!configResult.isInterval, this.crtContext.page.superposeMode); | |
376 | - } | |
377 | - | |
378 | - this.updateTimeTableInfo(); | |
379 | - | |
380 | - if (this.multiPlotCheck) | |
381 | - { | |
382 | - this.disableSynchronize = true; | |
383 | - this.multiPlotCheck.setValue(configResult.multiplot); | |
384 | - this.disableSynchronize = false; | |
385 | - } | |
386 | - | |
387 | - this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile)); | |
388 | - | |
389 | - var size = this.getImageSize(); | |
390 | - this.panelImage.setSize(size.width, size.height); | |
391 | - | |
392 | - this.panelImage.refreshMe(); | |
393 | - }, | |
360 | + updatePlotImage: function(configResult, newPlot) { | |
361 | + this.crtContext = configResult.context; | |
362 | + | |
363 | + this.crtTTFileIndex = configResult.ttFileIndex; | |
364 | + | |
365 | + if (this.isTTNavBar != (!configResult.isInterval) || (this.isSuperposeMode != this.crtContext.page.superposeMode)) | |
366 | + { | |
367 | + //Update navigation bar | |
368 | + this.updateNavToolBar(!configResult.isInterval, this.crtContext.page.superposeMode); | |
369 | + } | |
370 | + | |
371 | + this.updateTimeTableInfo(); | |
372 | + | |
373 | + if (this.multiPlotCheck) | |
374 | + { | |
375 | + this.disableSynchronize = true; | |
376 | + this.multiPlotCheck.setValue(configResult.multiplot); | |
377 | + this.disableSynchronize = false; | |
378 | + } | |
379 | + | |
380 | + this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile)); | |
381 | + | |
382 | + var size = this.getImageSize(); | |
383 | + this.panelImage.setSize(size.width, size.height); | |
384 | + | |
385 | + this.panelImage.refreshMe(); | |
386 | + }, | |
394 | 387 | |
395 | - updateTimeTableInfo: function() | |
396 | - { | |
397 | - if (!this.navToolBar) | |
398 | - return; | |
399 | - | |
400 | - var ttNameField = this.navToolBar.items.get('tt-table-'+this.tabId); | |
401 | - if (ttNameField) | |
402 | - ttNameField.setValue(this.crtContext.page.ttName); | |
403 | - | |
404 | - var ttNumberField = this.navToolBar.items.get('tt-number-'+this.tabId); | |
405 | - if (ttNumberField) | |
406 | - ttNumberField.setValue(this.crtContext.page.ttIndex + 1); | |
407 | - | |
408 | - var ttTotalField = this.navToolBar.items.get('tt-total-'+this.tabId); | |
409 | - if (ttTotalField) | |
410 | - ttTotalField.setValue(this.crtContext.page.ttNbIntervals); | |
411 | - }, | |
388 | + updateTimeTableInfo: function() | |
389 | + { | |
390 | + if (!this.navToolBar) | |
391 | + return; | |
392 | + | |
393 | + var ttNameField = this.navToolBar.items.get('tt-table-'+this.tabId); | |
394 | + if (ttNameField) | |
395 | + ttNameField.setValue(this.crtContext.page.ttName); | |
396 | + | |
397 | + var ttNumberField = this.navToolBar.items.get('tt-number-'+this.tabId); | |
398 | + if (ttNumberField) | |
399 | + ttNumberField.setValue(this.crtContext.page.ttIndex + 1); | |
400 | + | |
401 | + var ttTotalField = this.navToolBar.items.get('tt-total-'+this.tabId); | |
402 | + if (ttTotalField) | |
403 | + ttTotalField.setValue(this.crtContext.page.ttNbIntervals); | |
404 | + }, | |
412 | 405 | |
413 | - callInteractivePlot : function(obj) { | |
414 | - loadMask.show(true); | |
415 | - | |
416 | - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); | |
417 | - var multiPlotState = plotModule.getInteractiveMultiPlotState(); | |
418 | - | |
419 | - AmdaAction.interactivePlot(obj, multiPlotState, function (result, e) { | |
420 | - loadMask.hide(); | |
421 | - var t = e.getTransaction(); | |
406 | + callInteractivePlot : function(obj) { | |
407 | + loadMask.show(true); | |
408 | + | |
409 | + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); | |
410 | + var multiPlotState = plotModule.getInteractiveMultiPlotState(); | |
411 | + | |
412 | + AmdaAction.interactivePlot(obj, multiPlotState, function (result, e) { | |
413 | + loadMask.hide(); | |
414 | + var t = e.getTransaction(); | |
422 | 415 | if (e.status) |
423 | 416 | { |
424 | 417 | if (result) |
... | ... | @@ -438,303 +431,291 @@ Ext.define('amdaUI.PlotTabResultUI', { |
438 | 431 | // FAILURE |
439 | 432 | myDesktopApp.errorMsg('Error System - '+e.message); |
440 | 433 | } |
441 | - },this); | |
442 | - }, | |
443 | - | |
444 | - updateNavToolBar : function(isTimeTable, isSuperposeMode) { | |
445 | - if (this.navToolBar) | |
446 | - this.navToolBar.removeAll(true); | |
447 | - | |
448 | - this.multiPlotCheck = Ext.create('Ext.form.field.Checkbox', { | |
449 | - boxLabel : 'Linked to Multi Plot Mode', | |
450 | - scope: this, | |
451 | - handler: function(check, checked) { | |
452 | - if (!this.disableSynchronize) | |
453 | - this.callInteractivePlot({'action' : 'synchronize', 'tabId' : this.tabId}); | |
454 | - }, | |
455 | - scope: this | |
456 | - }); | |
457 | - | |
458 | - var commonItemsCfg = [ | |
459 | - { | |
460 | - xtype: 'tbspacer', | |
461 | - width: 50 | |
462 | - }, | |
463 | - this.multiPlotCheck, | |
464 | - '->', | |
465 | - { | |
466 | - text: 'Get HST Data', | |
467 | - scope: this, | |
468 | - menu: [ | |
469 | - { | |
470 | - text: 'Giant Planet Auroral Emissions', | |
471 | - scope: this, | |
472 | - handler: function() | |
473 | - { | |
474 | - var me = this; | |
475 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.astro.id, true, function (module) { | |
476 | - var startTime = new Date(me.crtContext.page.startTime*1000); | |
477 | - startTime = Ext.Date.add(startTime, Ext.Date.MINUTE, startTime.getTimezoneOffset()); | |
478 | - | |
479 | - var stopTime = new Date(me.crtContext.page.stopTime*1000); | |
480 | - stopTime = Ext.Date.add(stopTime, Ext.Date.MINUTE, stopTime.getTimezoneOffset()); | |
481 | - | |
482 | - module.createWindow(startTime,stopTime); | |
483 | - }); | |
484 | - } | |
485 | - } | |
486 | - ] | |
487 | - } | |
488 | - ]; | |
489 | - | |
490 | - if (isTimeTable) | |
491 | - { | |
492 | - var navigationItemsCfg = [ | |
493 | - { | |
494 | - text: 'Previous', | |
495 | - scope: this, | |
496 | - handler: function(){ | |
497 | - var ttFileIndex = this.crtTTFileIndex; | |
498 | - var ttintervalIndex = this.crtContext.page.ttIndex; | |
499 | - | |
500 | - if (ttintervalIndex <= 0) | |
501 | - { | |
502 | - if (ttFileIndex <= 0) | |
503 | - { | |
504 | - myDesktopApp.errorMsg('You are on the first interval of your request'); | |
505 | - return; | |
506 | - } | |
507 | - else | |
508 | - { | |
509 | - --ttFileIndex; | |
510 | - ttintervalIndex = 0; | |
511 | - } | |
512 | - } | |
513 | - else | |
514 | - --ttintervalIndex; | |
515 | - this.callInteractivePlot({'action' : 'goto', 'tabId' : this.tabId, 'ttFileIndex' : ttFileIndex, 'intIndex' : ttintervalIndex}); | |
516 | - } | |
517 | - }, | |
518 | - '-', | |
519 | - { | |
520 | - text: 'Next', | |
521 | - scope: this, | |
522 | - handler: function(){ | |
523 | - var ttFileIndex = this.crtTTFileIndex; | |
524 | - var ttintervalIndex = this.crtContext.page.ttIndex; | |
525 | - | |
526 | - if (ttintervalIndex >= this.crtContext.page.ttNbIntervals-1) | |
527 | - { | |
528 | - ++ttFileIndex; | |
529 | - ttintervalIndex = 0; | |
530 | - } | |
531 | - else | |
532 | - ++ttintervalIndex; | |
533 | - this.callInteractivePlot({'action' : 'goto', 'tabId' : this.tabId, 'ttFileIndex' : ttFileIndex, 'intIndex' : ttintervalIndex}); | |
534 | - } | |
535 | - }, | |
536 | - '-', | |
537 | - { | |
538 | - text: 'Go to Interval #', | |
539 | - scope: this, | |
540 | - handler: function(bt){ | |
541 | - var ttGotoNumberField = this.navToolBar.items.get('tt-goto-number-'+this.tabId); | |
542 | - var goToIndex = ttGotoNumberField.getValue() - 1; | |
543 | - if ((goToIndex < 0) || (goToIndex >= this.crtContext.page.ttNbIntervals)) | |
544 | - myDesktopApp.errorMsg('This interval number is outside of the current timeTable'); | |
545 | - else | |
546 | - this.callInteractivePlot({'action' : 'goto', 'tabId' : this.tabId, 'ttFileIndex' : this.crtTTFileIndex, 'intIndex' : goToIndex}); | |
547 | - } | |
548 | - }, | |
549 | - { | |
550 | - xtype: 'numberfield', | |
551 | - id : 'tt-goto-number-'+this.tabId, | |
552 | - hideTrigger: true, | |
553 | - width: 40, | |
554 | - minValue: 1 | |
555 | - }, | |
556 | - ' ', | |
557 | - ' ', | |
558 | - ' ', | |
559 | - { | |
560 | - xtype: 'textfield', | |
561 | - id: 'tt-table-'+this.tabId, | |
562 | - labelAlign: 'right', | |
563 | - labelWidth: 30, | |
564 | - fieldLabel: 'Table', | |
565 | - width: 130, | |
566 | - disabled : true | |
567 | - }, | |
568 | - { | |
569 | - xtype: 'textfield', | |
570 | - id: 'tt-number-'+this.tabId, | |
571 | - labelAlign: 'right', | |
572 | - labelWidth: 30, | |
573 | - fieldLabel: 'Int #', | |
574 | - width: 70, | |
575 | - disabled : true | |
576 | - }, | |
577 | - { | |
578 | - xtype: 'textfield', | |
579 | - id: 'tt-total-'+this.tabId, | |
580 | - labelAlign: 'right', | |
581 | - labelWidth: 30, | |
582 | - fieldLabel: 'Total', | |
583 | - width: 70, | |
584 | - disabled : true | |
585 | - } | |
586 | - ]; | |
587 | - } | |
588 | - else | |
589 | - { | |
590 | - var navigationItemsCfg = [ | |
591 | - { | |
592 | - text: 'Backward', | |
593 | - scope: this, | |
594 | - handler: function(){ | |
595 | - this.callInteractivePlot({'action' : 'backward', 'tabId' : this.tabId}); | |
596 | - } | |
597 | - }, | |
598 | - '-', | |
599 | - { | |
600 | - text: '1/2 Backward', | |
601 | - scope: this, | |
602 | - handler: function(){ | |
603 | - this.callInteractivePlot({'action' : 'halfbackward', 'tabId' : this.tabId}); | |
604 | - } | |
605 | - }, | |
606 | - '-', | |
607 | - { | |
608 | - text: '1/2 Forward', | |
609 | - scope: this, | |
610 | - handler: function(){ | |
611 | - this.callInteractivePlot({'action' : 'halfforward', 'tabId' : this.tabId}); | |
612 | - } | |
613 | - }, | |
614 | - '-', | |
615 | - { | |
616 | - text: 'Forward', | |
617 | - scope: this, | |
618 | - handler: function(){ | |
619 | - this.callInteractivePlot({'action' : 'forward', 'tabId' : this.tabId}); | |
620 | - } | |
621 | - } | |
622 | - ]; | |
623 | - } | |
624 | - | |
625 | - var toolItemsCfg = navigationItemsCfg; | |
626 | - Ext.each(commonItemsCfg, function(item){ | |
627 | - toolItemsCfg.push(item); | |
628 | - }); | |
629 | - | |
630 | - if (!this.navToolBar) | |
631 | - { | |
632 | - var toolConfig = { | |
633 | - dock: 'top', | |
634 | - items: toolItemsCfg | |
635 | - }; | |
636 | - | |
637 | - this.navToolBar = Ext.create('Ext.toolbar.Toolbar', toolConfig); | |
638 | - } | |
639 | - else | |
640 | - this.navToolBar.add(toolItemsCfg); | |
641 | - | |
642 | - this.navToolBar.setDisabled(isSuperposeMode); | |
643 | - | |
644 | - this.isTTNavBar = isTimeTable; | |
645 | - this.isSuperposeMode = isSuperposeMode; | |
646 | - }, | |
434 | + },this); | |
435 | + }, | |
647 | 436 | |
648 | - init: function(configResult){ | |
649 | - this.crtContext = configResult.context; | |
650 | - this.tabId = configResult.tabId; | |
651 | - | |
652 | - this.coordinatesField = new Ext.toolbar.TextItem({ | |
653 | - width: 300, | |
654 | - text : '' | |
655 | - }); | |
656 | - | |
657 | - this.sliderPage = new Ext.slider.Single({ | |
658 | - width: 130, | |
659 | - value: 75, | |
660 | - increment: 5, | |
661 | - minValue: 50, | |
662 | - maxValue: 100, | |
663 | - fieldLabel : 'Resize', | |
664 | - labelWidth : 40, | |
665 | - listeners: { | |
666 | - scope : this, | |
667 | - changecomplete: function(s, v) | |
668 | - { | |
669 | - var zoomPlugin = this.getPlugin('plot-zoom-plugin-id'); | |
670 | - zoomPlugin.close(); | |
671 | - var size = this.getImageSize(); | |
672 | - this.panelImage.width = size.width; | |
673 | - this.panelImage.height = size.height; | |
674 | - this.panelImage.doComponentLayout(); | |
675 | - this.fireEvent('pagesize',this,v); | |
676 | - } | |
677 | - } | |
678 | - }); | |
679 | - | |
680 | - var mouseToolbar = { | |
681 | - xtype: 'toolbar', | |
682 | - height: 25, | |
683 | - dock: 'bottom', | |
684 | - items:[ | |
685 | - this.coordinatesField, | |
686 | - '->', | |
687 | - this.sliderPage | |
688 | - ] | |
689 | - }; | |
437 | + updateNavToolBar : function(isTimeTable, isSuperposeMode) { | |
438 | + if (this.navToolBar) | |
439 | + this.navToolBar.removeAll(true); | |
440 | + | |
441 | + this.multiPlotCheck = Ext.create('Ext.form.field.Checkbox', { | |
442 | + boxLabel : 'Linked to Multi Plot Mode', | |
443 | + scope: this, | |
444 | + handler: function(check, checked) { | |
445 | + if (!this.disableSynchronize) | |
446 | + this.callInteractivePlot({'action' : 'synchronize', 'tabId' : this.tabId}); | |
447 | + }, | |
448 | + scope: this | |
449 | + }); | |
450 | + | |
451 | + var commonItemsCfg = [ | |
452 | + { | |
453 | + xtype: 'tbspacer', | |
454 | + width: 50 | |
455 | + }, | |
456 | + this.multiPlotCheck, | |
457 | + '->', | |
458 | + { | |
459 | + text: 'Get HST Data', | |
460 | + scope: this, | |
461 | + menu: [ | |
462 | + { | |
463 | + text: 'Giant Planet Auroral Emissions', | |
464 | + scope: this, | |
465 | + handler: function() | |
466 | + { | |
467 | + var me = this; | |
468 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.astro.id, true, function (module) { | |
469 | + var startTime = new Date(me.crtContext.page.startTime*1000); | |
470 | + startTime = Ext.Date.add(startTime, Ext.Date.MINUTE, startTime.getTimezoneOffset()); | |
471 | + | |
472 | + var stopTime = new Date(me.crtContext.page.stopTime*1000); | |
473 | + stopTime = Ext.Date.add(stopTime, Ext.Date.MINUTE, stopTime.getTimezoneOffset()); | |
474 | + | |
475 | + module.createWindow(startTime,stopTime); | |
476 | + }); | |
477 | + } | |
478 | + }] | |
479 | + }]; | |
480 | + | |
481 | + if (isTimeTable){ | |
482 | + var navigationItemsCfg = [{ | |
483 | + text: 'Previous', | |
484 | + scope: this, | |
485 | + handler: function(){ | |
486 | + var ttFileIndex = this.crtTTFileIndex; | |
487 | + var ttintervalIndex = this.crtContext.page.ttIndex; | |
488 | + | |
489 | + if (ttintervalIndex <= 0){ | |
490 | + if (ttFileIndex <= 0){ | |
491 | + myDesktopApp.errorMsg('You are on the first interval of your request'); | |
492 | + return; | |
493 | + } | |
494 | + else { | |
495 | + --ttFileIndex; | |
496 | + ttintervalIndex = 0; | |
497 | + } | |
498 | + } | |
499 | + else | |
500 | + --ttintervalIndex; | |
501 | + this.callInteractivePlot({'action' : 'goto', 'tabId' : this.tabId, 'ttFileIndex' : ttFileIndex, 'intIndex' : ttintervalIndex}); | |
502 | + } | |
503 | + }, | |
504 | + '-', | |
505 | + { | |
506 | + text: 'Next', | |
507 | + scope: this, | |
508 | + handler: function(){ | |
509 | + var ttFileIndex = this.crtTTFileIndex; | |
510 | + var ttintervalIndex = this.crtContext.page.ttIndex; | |
511 | + | |
512 | + if (ttintervalIndex >= this.crtContext.page.ttNbIntervals-1){ | |
513 | + ++ttFileIndex; | |
514 | + ttintervalIndex = 0; | |
515 | + } | |
516 | + else | |
517 | + ++ttintervalIndex; | |
518 | + | |
519 | + this.callInteractivePlot({'action' : 'goto', 'tabId' : this.tabId, 'ttFileIndex' : ttFileIndex, 'intIndex' : ttintervalIndex}); | |
520 | + } | |
521 | + }, | |
522 | + '-', | |
523 | + { | |
524 | + text: 'Go to Interval #', | |
525 | + scope: this, | |
526 | + handler: function(bt){ | |
527 | + var ttGotoNumberField = this.navToolBar.items.get('tt-goto-number-'+this.tabId); | |
528 | + var goToIndex = ttGotoNumberField.getValue() - 1; | |
529 | + if ((goToIndex < 0) || (goToIndex >= this.crtContext.page.ttNbIntervals)) | |
530 | + myDesktopApp.errorMsg('This interval number is outside of the current timeTable'); | |
531 | + else | |
532 | + this.callInteractivePlot({'action' : 'goto', 'tabId' : this.tabId, 'ttFileIndex' : this.crtTTFileIndex, 'intIndex' : goToIndex}); | |
533 | + } | |
534 | + }, | |
535 | + { | |
536 | + xtype: 'numberfield', | |
537 | + id : 'tt-goto-number-'+this.tabId, | |
538 | + hideTrigger: true, | |
539 | + width: 50, | |
540 | + minValue: 1 | |
541 | + }, | |
542 | + ' ', | |
543 | + ' ', | |
544 | + ' ', | |
545 | + { | |
546 | + xtype: 'textfield', | |
547 | + id: 'tt-table-'+this.tabId, | |
548 | + labelAlign: 'right', | |
549 | + labelWidth: 30, | |
550 | + fieldLabel: 'Table', | |
551 | + width: 130, | |
552 | + disabled : true | |
553 | + }, | |
554 | + { | |
555 | + xtype: 'textfield', | |
556 | + id: 'tt-number-'+this.tabId, | |
557 | + labelAlign: 'right', | |
558 | + labelWidth: 30, | |
559 | + fieldLabel: 'Int #', | |
560 | + width: 90, | |
561 | + disabled : true | |
562 | + }, | |
563 | + { | |
564 | + xtype: 'textfield', | |
565 | + id: 'tt-total-'+this.tabId, | |
566 | + labelAlign: 'right', | |
567 | + labelWidth: 30, | |
568 | + fieldLabel: 'Total', | |
569 | + width: 90, | |
570 | + disabled : true | |
571 | + }]; | |
572 | + } | |
573 | + else | |
574 | + { | |
575 | + var navigationItemsCfg = [ | |
576 | + { | |
577 | + text: 'Backward', | |
578 | + scope: this, | |
579 | + handler: function(){ | |
580 | + this.callInteractivePlot({'action' : 'backward', 'tabId' : this.tabId}); | |
581 | + } | |
582 | + }, | |
583 | + '-', | |
584 | + { | |
585 | + text: '1/2 Backward', | |
586 | + scope: this, | |
587 | + handler: function(){ | |
588 | + this.callInteractivePlot({'action' : 'halfbackward', 'tabId' : this.tabId}); | |
589 | + } | |
590 | + }, | |
591 | + '-', | |
592 | + { | |
593 | + text: '1/2 Forward', | |
594 | + scope: this, | |
595 | + handler: function(){ | |
596 | + this.callInteractivePlot({'action' : 'halfforward', 'tabId' : this.tabId}); | |
597 | + } | |
598 | + }, | |
599 | + '-', | |
600 | + { | |
601 | + text: 'Forward', | |
602 | + scope: this, | |
603 | + handler: function(){ | |
604 | + this.callInteractivePlot({'action' : 'forward', 'tabId' : this.tabId}); | |
605 | + } | |
606 | + }]; | |
607 | + } | |
608 | + | |
609 | + var toolItemsCfg = navigationItemsCfg; | |
610 | + Ext.each(commonItemsCfg, function(item){ | |
611 | + toolItemsCfg.push(item); | |
612 | + }); | |
613 | + | |
614 | + if (!this.navToolBar) | |
615 | + { | |
616 | + var toolConfig = { | |
617 | + dock: 'top', | |
618 | + items: toolItemsCfg | |
619 | + }; | |
620 | + | |
621 | + this.navToolBar = Ext.create('Ext.toolbar.Toolbar', toolConfig); | |
622 | + } | |
623 | + else | |
624 | + this.navToolBar.add(toolItemsCfg); | |
625 | + | |
626 | + this.navToolBar.setDisabled(isSuperposeMode); | |
627 | + | |
628 | + this.isTTNavBar = isTimeTable; | |
629 | + this.isSuperposeMode = isSuperposeMode; | |
630 | + }, | |
631 | + | |
632 | + init: function(configResult){ | |
633 | + this.crtContext = configResult.context; | |
634 | + this.tabId = configResult.tabId; | |
635 | + | |
636 | + this.coordinatesField = new Ext.toolbar.TextItem({ | |
637 | + width: 300, | |
638 | + text : '' | |
639 | + }); | |
640 | + | |
641 | + this.sliderPage = new Ext.slider.Single({ | |
642 | + width: 130, | |
643 | + value: 75, | |
644 | + increment: 5, | |
645 | + minValue: 50, | |
646 | + maxValue: 100, | |
647 | + fieldLabel : 'Resize', | |
648 | + labelWidth : 40, | |
649 | + listeners: { | |
650 | + scope : this, | |
651 | + changecomplete: function(s, v) | |
652 | + { | |
653 | + var zoomPlugin = this.getPlugin('plot-zoom-plugin-id'); | |
654 | + zoomPlugin.close(); | |
655 | + var size = this.getImageSize(); | |
656 | + this.panelImage.width = size.width; | |
657 | + this.panelImage.height = size.height; | |
658 | + this.panelImage.doComponentLayout(); | |
659 | + this.fireEvent('pagesize',this,v); | |
660 | + } | |
661 | + } | |
662 | + }); | |
663 | + | |
664 | + var mouseToolbar = { | |
665 | + xtype: 'toolbar', | |
666 | + height: 25, | |
667 | + dock: 'bottom', | |
668 | + items:[ | |
669 | + this.coordinatesField, | |
670 | + '->', | |
671 | + this.sliderPage | |
672 | + ] | |
673 | + }; | |
690 | 674 | |
691 | - this.contextualMenu = Ext.create('Ext.menu.Menu', { | |
692 | - width: 200, | |
693 | - plain: true, | |
694 | - items: [] | |
695 | - }); | |
696 | - | |
697 | - this.updateNavToolBar(!configResult.isInterval, this.crtContext.page.superposeMode); | |
698 | - | |
699 | - this.updateTimeTableInfo(); | |
700 | - | |
701 | - if (this.multiPlotCheck) | |
702 | - { | |
703 | - this.disableSynchronize = true; | |
704 | - this.multiPlotCheck.setValue(configResult.multiplot); | |
705 | - this.disableSynchronize = false; | |
706 | - } | |
707 | - | |
708 | - var plotResultTabPanelConfig = { | |
709 | - preventHeader : true, | |
710 | - autoScroll: true, | |
711 | - items: [ | |
712 | - this.createPlotImage(configResult.folder, configResult.plotFile) | |
713 | - ], | |
714 | - dockedItems: [this.navToolBar, mouseToolbar], | |
715 | - plugins: [ | |
716 | - { | |
717 | - ptype: 'plotZoomPlugin', | |
718 | - pluginId : 'plot-zoom-plugin-id' | |
719 | - }, | |
720 | - { | |
721 | - ptype: 'plotExtendShiftPlugin', | |
722 | - pluginId : 'plot-extendshift-plugin-id' | |
723 | - } | |
724 | - ], | |
725 | - listeners: { | |
726 | - scope : this, | |
727 | - destroy : function () { | |
728 | - var zoomPlugin = this.getPlugin('plot-zoom-plugin-id'); | |
729 | - if (zoomPlugin) | |
730 | - zoomPlugin.close(); | |
731 | - var exttendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id'); | |
732 | - if (exttendShiftPlugin) | |
733 | - exttendShiftPlugin.close(); | |
734 | - } | |
735 | - } | |
736 | - }; | |
737 | - | |
738 | - Ext.apply(this , plotResultTabPanelConfig); | |
739 | - } | |
740 | -}); | |
741 | 675 | \ No newline at end of file |
676 | + this.contextualMenu = Ext.create('Ext.menu.Menu', { | |
677 | + width: 200, | |
678 | + plain: true, | |
679 | + items: [] | |
680 | + }); | |
681 | + | |
682 | + this.updateNavToolBar(!configResult.isInterval, this.crtContext.page.superposeMode); | |
683 | + | |
684 | + this.updateTimeTableInfo(); | |
685 | + | |
686 | + if (this.multiPlotCheck) | |
687 | + { | |
688 | + this.disableSynchronize = true; | |
689 | + this.multiPlotCheck.setValue(configResult.multiplot); | |
690 | + this.disableSynchronize = false; | |
691 | + } | |
692 | + | |
693 | + var plotResultTabPanelConfig = { | |
694 | + preventHeader : true, | |
695 | + autoScroll: true, | |
696 | + items: [ this.createPlotImage(configResult.folder, configResult.plotFile)], | |
697 | + dockedItems: [this.navToolBar, mouseToolbar], | |
698 | + plugins: [ | |
699 | + { | |
700 | + ptype: 'plotZoomPlugin', | |
701 | + pluginId : 'plot-zoom-plugin-id' | |
702 | + }, | |
703 | + { | |
704 | + ptype: 'plotExtendShiftPlugin', | |
705 | + pluginId : 'plot-extendshift-plugin-id' | |
706 | + }], | |
707 | + listeners: { | |
708 | + scope : this, | |
709 | + destroy : function () { | |
710 | + var zoomPlugin = this.getPlugin('plot-zoom-plugin-id'); | |
711 | + if (zoomPlugin) | |
712 | + zoomPlugin.close(); | |
713 | + var exttendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id'); | |
714 | + if (exttendShiftPlugin) | |
715 | + exttendShiftPlugin.close(); | |
716 | + } | |
717 | + } | |
718 | + }; | |
719 | + | |
720 | + Ext.apply(this , plotResultTabPanelConfig); | |
721 | + } | |
722 | +}); | |
... | ... |