Commit acafe456cc63a19fdd3d465105422eb9de8413ad

Authored by Benjamin Renard
1 parent 57e15214

Fix Get Data

js/app/models/DownloadNode.js
@@ -62,91 +62,74 @@ Ext.define('amdaModel.DownloadNode', { @@ -62,91 +62,74 @@ Ext.define('amdaModel.DownloadNode', {
62 }); 62 });
63 }, 63 },
64 64
65 - decodeObject: function(obj) {  
66 - var myValues = new Object();  
67 - myValues.list=[];  
68 -  
69 - if (!obj) {  
70 - var fullObject = this.get('realLinkedNode').get('object');  
71 - }  
72 - else {  
73 - var fullObject = obj;  
74 - }  
75 -  
76 - var i = 0;  
77 - // Todo - BRE - PLOTSAVE  
78 - fullObject.tabs().each(function (tab) {  
79 - // only active tab  
80 - if (tab.get('id') == fullObject.get('last-plotted-tab'))  
81 - {  
82 - tab.panels().each(function (panel) {  
83 - panel.params().each(function (param) {  
84 - var myParam = new Object();  
85 - myParam.paramid = param.get('paramid');  
86 - myParam.type = param.get('type');  
87 - myParam['dim1-index'] = param.get('dim1-index');  
88 - myParam['dim1-sum-type'] = param.get('dim1-sum-type');  
89 - myParam['dim1-min-value'] = param.get('dim1-min-value');  
90 - myParam['dim1-max-value'] = param.get('dim1-max-value');  
91 - myParam['dim1-min-index'] = param.get('dim1-min-index');  
92 - myParam['dim1-max-index'] = param.get('dim1-max-index');  
93 - myParam['dim2-index'] = param.get('dim2-index');  
94 - myParam['dim2-sum-type'] = param.get('dim2-sum-type');  
95 - myParam['dim2-min-value'] = param.get('dim2-min-value');  
96 - myParam['dim2-max-value'] = param.get('dim2-max-value');  
97 - myParam['dim2-min-index'] = param.get('dim2-min-index');  
98 - myParam['dim2-max-index'] = param.get('dim2-max-index');  
99 - myParam.template_args = param.get('template_args');  
100 - if (!param.get('plotonly')) {  
101 - myValues.list[i] = myParam;  
102 - ++i;  
103 - }  
104 - else  
105 - alert('Parameter '+ myParam.paramid + ' is PlotOnly');  
106 - });  
107 - });  
108 - if (tab.get('multi-plot-linked'))  
109 - {  
110 - var object = fullObject.data;  
111 - }  
112 - else  
113 - {  
114 - var object = tab.data;  
115 - }  
116 - myValues.timesrc = object.timesrc;  
117 - // if there's at least one timeTable name into 'timeTables' collection  
118 - if (myValues.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0]  
119 - && object.timeTables  
120 - && object.timeTables.length ){  
121 - // get complete timeTables collection  
122 - var timeTables = object.timeTables;  
123 - // init an empty array for timeTables  
124 - myValues.timeTables=[];  
125 - // for each interval record  
126 - Ext.Array.each(timeTables, function(item, index, all){  
127 - if (!item.$className) {  
128 - myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id};  
129 - }  
130 - // get Json simplified value  
131 - else {  
132 - myValues.timeTables[index] = item.getJsonValues();  
133 - }  
134 - });  
135 - }  
136 - else {  
137 - myValues.startDate = object.startDate;  
138 - myValues.stopDate = object.stopDate;  
139 - myValues.durationDay = object.durationDay;  
140 - myValues.durationHour = object.durationHour;  
141 - myValues.durationMin = object.durationMin;  
142 - myValues.durationSec = object.durationSec;  
143 - }  
144 - }  
145 - });  
146 -  
147 - myValues.name = fullObject.get('name');  
148 - return myValues;  
149 - }, 65 + decodeObject: function(obj) {
  66 + var myValues = new Object();
  67 + myValues.list=[];
  68 +
  69 + if (!obj) {
  70 + var fullObject = this.get('realLinkedNode').get('object');
  71 + }
  72 + else {
  73 + var fullObject = obj;
  74 + }
  75 +
  76 + fullObject.panels().each(function (panel) {
  77 + panel.params().each(function (param) {
  78 + var myParam = new Object();
  79 + myParam.paramid = param.get('paramid');
  80 + myParam.type = param.get('type');
  81 + myParam['dim1-index'] = param.get('dim1-index');
  82 + myParam['dim1-sum-type'] = param.get('dim1-sum-type');
  83 + myParam['dim1-min-value'] = param.get('dim1-min-value');
  84 + myParam['dim1-max-value'] = param.get('dim1-max-value');
  85 + myParam['dim1-min-index'] = param.get('dim1-min-index');
  86 + myParam['dim1-max-index'] = param.get('dim1-max-index');
  87 + myParam['dim2-index'] = param.get('dim2-index');
  88 + myParam['dim2-sum-type'] = param.get('dim2-sum-type');
  89 + myParam['dim2-min-value'] = param.get('dim2-min-value');
  90 + myParam['dim2-max-value'] = param.get('dim2-max-value');
  91 + myParam['dim2-min-index'] = param.get('dim2-min-index');
  92 + myParam['dim2-max-index'] = param.get('dim2-max-index');
  93 + myParam.template_args = param.get('template_args');
  94 + if (!param.get('plotonly')) {
  95 + myValues.list.push(myParam);
  96 + }
  97 + else
  98 + alert('Parameter '+ myParam.paramid + ' is PlotOnly');
  99 + });
  100 + });
  101 + myValues.timesrc = fullObject.get('timesrc');
  102 + // if there's at least one timeTable name into 'timeTables' collection
  103 + if (myValues.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0]
  104 + && fullObject.get('timeTables')
  105 + && fullObject.get('timeTables').length){
  106 + // get complete timeTables collection
  107 + var timeTables = fullObject.get('timeTables');
  108 + // init an empty array for timeTables
  109 + myValues.timeTables=[];
  110 + // for each interval record
  111 + Ext.Array.each(timeTables, function(item, index, all){
  112 + if (!item.$className) {
  113 + myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id};
  114 + }
  115 + // get Json simplified value
  116 + else {
  117 + myValues.timeTables[index] = item.getJsonValues();
  118 + }
  119 + });
  120 + }
  121 + else {
  122 + myValues.startDate = fullObject.get('startDate');
  123 + myValues.stopDate = fullObject.get('stopDate');
  124 + myValues.durationDay = fullObject.get('durationDay');
  125 + myValues.durationHour = fullObject.get('durationHour');
  126 + myValues.durationMin = fullObject.get('durationMin');
  127 + myValues.durationSec = fullObject.get('durationSec');
  128 + }
  129 +
  130 + myValues.name = fullObject.get('name');
  131 + return myValues;
  132 + },
150 133
151 encodeObject: function() { 134 encodeObject: function() {
152 }, 135 },
js/app/views/PlotComponents/PlotTabPanel.js
@@ -43,7 +43,6 @@ Ext.define('amdaPlotComp.PlotTabPanel', { @@ -43,7 +43,6 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
43 var me = this; 43 var me = this;
44 var tabComp = this.add({ 44 var tabComp = this.add({
45 title: (plotNode.get('text') != '') ? plotNode.get('text') : 'Plot '+tabNumber, 45 title: (plotNode.get('text') != '') ? plotNode.get('text') : 'Plot '+tabNumber,
46 - isRendered: false,  
47 closable: true, 46 closable: true,
48 layout: 'fit', 47 layout: 'fit',
49 bodyStyle: 'background: none', 48 bodyStyle: 'background: none',
@@ -99,7 +98,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { @@ -99,7 +98,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
99 return null; 98 return null;
100 }, 99 },
101 100
102 - updateTimeObject : function() { 101 + updateTimeObjects : function() {
103 for (i = 0; i < this.items.getCount(); ++i) 102 for (i = 0; i < this.items.getCount(); ++i)
104 { 103 {
105 this.items.getAt(i).items.getAt(0).updateTimeObject(); 104 this.items.getAt(i).items.getAt(0).updateTimeObject();
js/app/views/PlotUI.js
@@ -70,28 +70,26 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, { @@ -70,28 +70,26 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
70 } 70 }
71 }, 71 },
72 72
73 - resetProcess : function(){  
74 - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);  
75 - plotModule.createLinkedNode();  
76 - var obj = null;  
77 - if ((arguments.length > 0) && (arguments[0] != null)) {  
78 - obj = arguments[0];  
79 - }  
80 - plotModule.createObject(obj);  
81 - this.setObject(plotModule.linkedNode.get('object'));  
82 - }, 73 + resetProcess : function(){
  74 + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  75 + plotModule.createLinkedNode();
  76 + var obj = null;
  77 + if ((arguments.length > 0) && (arguments[0] != null)) {
  78 + obj = arguments[0];
  79 + }
  80 + plotModule.createObject(obj);
  81 + this.setObject(plotModule.linkedNode.get('object'));
  82 + },
83 83
84 - getDataProcess : function(){  
85 - this.updateObject();  
86 - // plot was not called - form only  
87 - if (this.object.get('last-plotted-tab') == 0) {  
88 - this.object.set('last-plotted-tab', this.plotTabs.getSelectedTabId());  
89 - }  
90 - var downObject = amdaModel.DownloadNode.decodeObject(this.object);  
91 - amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject));  
92 -  
93 - amdaModel.DownloadNode.editInModule();  
94 - }, 84 + getDataProcess : function(){
  85 + this.updateObject();
  86 + var plotTab = this.plotTabs.getCurrentPlotTabContent();
  87 + if (!plotTab || !plotTab.plotNode)
  88 + return;
  89 + var downObject = amdaModel.DownloadNode.decodeObject(plotTab.plotNode.get('object'));
  90 + amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject));
  91 + amdaModel.DownloadNode.editInModule();
  92 + },
95 93
96 addParameter : function(node, updateTime){ 94 addParameter : function(node, updateTime){
97 var crtTree = this.plotTabs.getTreeFromPlotTab(this.plotTabs.getActiveTab()); 95 var crtTree = this.plotTabs.getTreeFromPlotTab(this.plotTabs.getActiveTab());
@@ -105,20 +103,13 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, { @@ -105,20 +103,13 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
105 } 103 }
106 }, 104 },
107 105
108 - /** 106 + /**
109 * plot method called by 'Do Plot' button to launch the plot process 107 * plot method called by 'Do Plot' button to launch the plot process
110 */ 108 */
111 doPlot : function(){ 109 doPlot : function(){
112 - var plotTab = this.plotTabs.getCurrentPlotTabContent() 110 + var plotTab = this.plotTabs.getCurrentPlotTabContent();
113 if (plotTab) 111 if (plotTab)
114 plotTab.doPlot(); 112 plotTab.doPlot();
115 -  
116 - /*this.updateObject();  
117 - this.object.set('last-plotted-tab', this.plotTabs.getSelectedTabId());  
118 - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);  
119 - if (plotModule)  
120 - plotModule.linkedNode.execute();*/  
121 -  
122 }, 113 },
123 114
124 /** 115 /**
@@ -133,19 +124,12 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, { @@ -133,19 +124,12 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
133 return this.object.isDirty(); 124 return this.object.isDirty();
134 }, 125 },
135 126
136 - /**  
137 - * update time selector of this.object from form  
138 - */  
139 - updateObject : function(){  
140 - var timeSource = this.timeSelector.getActiveTimeSource();  
141 -  
142 - var multiPlotForm = this.timeSelector.getForm();  
143 - multiPlotForm.updateRecord(this.object);  
144 - this.object.set('timesrc', timeSource);  
145 - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])  
146 - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);  
147 - this.plotTabs.updateTimeObject();  
148 - }, 127 + /**
  128 + * update time selector of this.object from form
  129 + */
  130 + updateObject : function(){
  131 + this.plotTabs.updateTimeObjects();
  132 + },
149 133
150 addTT : function(newTTName,newTTid,timeSelectorId) { 134 addTT : function(newTTName,newTTid,timeSelectorId) {
151 var crtTimeSelector = Ext.getCmp(timeSelectorId); 135 var crtTimeSelector = Ext.getCmp(timeSelectorId);
@@ -244,7 +228,7 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, { @@ -244,7 +228,7 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
244 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); 228 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
245 if (!plotModule) 229 if (!plotModule)
246 return; 230 return;
247 - this.updateObject(); 231 + this.updateObject();
248 this.object.set('active-tab-id', this.plotTabs.getSelectedTabId()); 232 this.object.set('active-tab-id', this.plotTabs.getSelectedTabId());
249 var me = this; 233 var me = this;
250 234