Commit d29f50120af73b8efeb47f13b6b46dd4c8a72464

Authored by Benjamin Renard
1 parent d50add6f

Fix doPlot

js/app/controllers/PlotModule.js
... ... @@ -62,7 +62,7 @@ Ext.define('amdaDesktop.PlotModule', {
62 62 var me = this;
63 63  
64 64  
65   -
  65 + console.log(session.result);
66 66 Ext.each(session.result, function (tabResult, index) {
67 67 if (logExecTime && tabResult.exectime)
68 68 {
... ... @@ -109,7 +109,7 @@ Ext.define('amdaDesktop.PlotModule', {
109 109  
110 110 var win = myDesktopApp.getDesktop().createWindow({
111 111 id : tabResult.id+"-win",
112   - title : 'Plot '+(tabResult.index+1),
  112 + title : tabResult.title,
113 113 width : size.width,
114 114 height: size.height,
115 115 x : x,
... ...
js/app/models/BkgJobNode.js
... ... @@ -10,9 +10,6 @@
10 10  
11 11 Ext.define('amdaModel.BkgJobNode', {
12 12 extend: 'amdaModel.ExecutableNode',
13   - requires: [
14   - 'amdaPlotObj.PlotRequestObject'
15   - ],
16 13 action : null,
17 14  
18 15 statics: {
... ...
js/app/models/InteractiveNode.js
... ... @@ -11,10 +11,6 @@
11 11 Ext.define('amdaModel.InteractiveNode', {
12 12 extend: 'amdaModel.AmdaNode',
13 13  
14   - requires: [
15   - 'amdaPlotObj.PlotRequestObject'
16   - ],
17   -
18 14 fields: [
19 15 {name: 'contextNode', type: 'amdaModel.AmdaNode', persist: false},
20 16 {name: 'objectDataModel', type: 'string', persist: false},
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -28,6 +28,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
28 28  
29 29 fields : [
30 30 {name: 'id', type: 'int'},
  31 + {name: 'tab-index', type: 'int', defaultValue: 0, persist: false},
  32 + {name: 'tab-title', type: 'string', defaultValue: '', persist: false},
31 33  
32 34 {name: 'file-format', type: 'string'},
33 35 {name: 'file-output', type: 'string'},
... ... @@ -233,6 +235,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
233 235 requestValues['leaf'] = true;
234 236  
235 237 requestValues['id'] = this.get('id');
  238 + requestValues['tab-index'] = this.get('tab-index');
  239 + requestValues['tab-title'] = this.get('tab-title');
236 240  
237 241 requestValues['file-format'] = this.get('file-format');
238 242 requestValues['file-output'] = this.get('file-output');
... ...
js/app/views/PlotComponents/PlotTabContent.js
... ... @@ -25,6 +25,8 @@ Ext.define('amdaPlotComp.PlotTabContent', {
25 25 plotTree: null,
26 26 plotElement: null,
27 27 plotOutput: null,
  28 +
  29 + tabIndex: 0,
28 30  
29 31 constructor: function(config) {
30 32 this.init(config);
... ... @@ -46,9 +48,15 @@ Ext.define('amdaPlotComp.PlotTabContent', {
46 48 },
47 49  
48 50 doPlot : function() {
  51 + this.plotNode.get('object').set('tab-index', this.tabIndex);
  52 + this.plotNode.get('object').set('tab-title', this.getPlotTitle());
49 53 this.plotNode.execute();
50 54 },
51 55  
  56 + getPlotTitle: function() {
  57 + return (this.plotNode.get('text') != '') ? this.plotNode.get('text') : 'Plot '+(this.tabIndex + 1);
  58 + },
  59 +
52 60 savePlot : function() {
53 61 var object = this.plotNode.get('object');
54 62 if (!object)
... ... @@ -123,6 +131,7 @@ Ext.define('amdaPlotComp.PlotTabContent', {
123 131  
124 132 init : function(config) {
125 133 this.plotNode = config.plotNode;
  134 + this.tabIndex = config.tabIndex;
126 135  
127 136 this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelectorTab' + this.plotNode.id, border : false, flex: 6, collapsible: true, collapseDirection : 'bottom'} );
128 137 this.plotElement = new amdaPlotComp.PlotElementPanel({flex: 11});
... ...
js/app/views/PlotComponents/PlotTabPanel.js
... ... @@ -39,10 +39,10 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
39 39 addPlotNode: function(plotNode, selectTab)
40 40 {
41 41 var tabNumber = this.getTabBar().items.getCount();
42   - var tabContent = new amdaPlotComp.PlotTabContent({plotNode: plotNode});
  42 + var tabContent = new amdaPlotComp.PlotTabContent({plotNode: plotNode, tabIndex: tabNumber-1});
43 43 var me = this;
44 44 var tabComp = this.add({
45   - title: (plotNode.get('text') != '') ? plotNode.get('text') : 'Plot '+tabNumber,
  45 + title: tabContent.getPlotTitle(),
46 46 closable: true,
47 47 layout: 'fit',
48 48 bodyStyle: 'background: none',
... ... @@ -84,8 +84,9 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
84 84 {
85 85 var tabItem = this.items.getAt(i);
86 86 var tabContent = tabItem.items.getAt(0);
  87 + tabContent.tabIndex = i;
87 88 var plotNode = tabContent.plotNode;
88   - var title = (plotNode.get('text') != '') ? plotNode.get('text') : 'Plot '+(i + 1);
  89 + var title = tabContent.getPlotTitle();
89 90 tabItem.setTitle(title);
90 91 if (!this.getActiveTab())
91 92 this.setActiveTab(tabItem);
... ...