Commit a971060f1197521e9dd281232bfaf05826b46614

Authored by Benjamin Renard
1 parent 27b2a53e

Fix some bugs

Plot navigation
Showing 34 changed files with 651 additions and 179 deletions   Show diff stats
js/app/controllers/PlotModule.js
... ... @@ -61,7 +61,7 @@ Ext.define('amdaDesktop.PlotModule', {
61 61 return size;
62 62 },
63 63  
64   - startInteractiveSession : function(session) {
  64 + updateInteractiveSession : function(session) {
65 65 var me = this;
66 66 Ext.each(session.result, function (tabResult, index) {
67 67 var winResultId = tabResult.id+"-win";
... ... @@ -120,14 +120,9 @@ Ext.define('amdaDesktop.PlotModule', {
120 120 var me = this;
121 121 this.plotResultWindowsManager.each(function (key, value, length) {
122 122 value.close();
123   - me.plotResultWindowsManager.unregister(value);
124 123 });
125 124 },
126 125  
127   - updateInteractiveSession : function(interactiveResult) {
128   -
129   - },
130   -
131 126 getWindowResult: function(winResultId){
132 127 if (!this.plotResultWindowsManager.get(winResultId)) return null;
133 128 return this.plotResultWindowsManager.get(winResultId);
... ...
js/app/models/ExecutableNode.js
... ... @@ -80,7 +80,7 @@ Ext.define('amdaModel.ExecutableNode', {
80 80 if (isInteractivePlot)
81 81 {
82 82 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) {
83   - module.startInteractiveSession(res);
  83 + module.updateInteractiveSession(res);
84 84 });
85 85 }
86 86 else
... ...
js/app/models/PlotObjects/PlotAxisObject.js
... ... @@ -61,6 +61,22 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
61 61 }
62 62 ],
63 63  
  64 + constructor: function(){
  65 + var me = this;
  66 + me.callParent(arguments);
  67 + if ((arguments.length > 0) && arguments[0])
  68 + {
  69 +
  70 + }
  71 + else
  72 + {
  73 + //new object, set default fields values
  74 + me.setDefaultValues();
  75 + }
  76 +
  77 + this.dirty = false;
  78 + },
  79 +
64 80 setDefaultValues: function(type)
65 81 {
66 82 this.set('axis-type', type);
... ... @@ -90,6 +106,11 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
90 106 this.set('axis-color-maxval', 'none');
91 107 },
92 108  
  109 + isDirty : function()
  110 + {
  111 + return this.dirty;
  112 + },
  113 +
93 114 getJsonValues : function()
94 115 {
95 116 var axisValues = new Object();
... ...
js/app/models/PlotObjects/PlotConstantObject.js
... ... @@ -41,6 +41,20 @@ Ext.define('amdaPlotObj.PlotConstantObject', {
41 41 {name: 'constant-line-color', type: 'string'}
42 42 ],
43 43  
  44 + constructor: function(){
  45 + var me = this;
  46 + me.callParent(arguments);
  47 + if ((arguments.length > 0) && arguments[0])
  48 + {
  49 + }
  50 + else
  51 + {
  52 + //new object, set default fields values
  53 + me.setDefaultValues();
  54 + }
  55 + this.dirty = false;
  56 + },
  57 +
44 58 setDefaultValues: function()
45 59 {
46 60 this.set('constant-axis-id', amdaPlotObj.PlotObjectConfig.defaultValues.constants.axisId);
... ...
js/app/models/PlotObjects/PlotCurveObject.js
... ... @@ -51,6 +51,7 @@ Ext.define('amdaPlotObj.PlotCurveObject', {
51 51 //new object, set default fields values
52 52 me.setDefaultValues();
53 53 }
  54 + this.dirty = false;
54 55 },
55 56  
56 57 getCurvesDefStore: function(onCurvesDefGet)
... ... @@ -116,6 +117,20 @@ Ext.define('amdaPlotObj.PlotCurveObject', {
116 117 this.set('curve-line-color', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.color);
117 118 },
118 119  
  120 + isDirty : function()
  121 + {
  122 + if (this.dirty)
  123 + return true;
  124 +
  125 + var d = false;
  126 + this.params().each(function (param, index) {
  127 + if (param.dirty)
  128 + d = true;
  129 + });
  130 +
  131 + return d;
  132 + },
  133 +
119 134 getJsonValues : function()
120 135 {
121 136 var curveValues = new Object();
... ...
js/app/models/PlotObjects/PlotFillObject.js
... ... @@ -31,6 +31,20 @@ Ext.define('amdaPlotObj.PlotFillObject', {
31 31 {name: 'fill-less-color', type: 'string'}
32 32 ],
33 33  
  34 + constructor: function(){
  35 + var me = this;
  36 + me.callParent(arguments);
  37 + if ((arguments.length > 0) && arguments[0])
  38 + {
  39 + }
  40 + else
  41 + {
  42 + //new object, set default fields values
  43 + me.setDefaultValues();
  44 + }
  45 + this.dirty = false;
  46 + },
  47 +
34 48 setDefaultValues: function()
35 49 {
36 50 this.set('fill-type', amdaPlotObj.PlotObjectConfig.defaultValues.fills.type);
... ...
js/app/models/PlotObjects/PlotInstantSerieObject.js
... ... @@ -32,6 +32,20 @@ Ext.define('amdaPlotObj.PlotInstantSerieObject', {
32 32 {name: 'iserie-symbols-color', type: 'string'}
33 33 ],
34 34  
  35 + constructor: function(){
  36 + var me = this;
  37 + me.callParent(arguments);
  38 + if ((arguments.length > 0) && arguments[0])
  39 + {
  40 + }
  41 + else
  42 + {
  43 + //new object, set default fields values
  44 + me.setDefaultValues();
  45 + }
  46 + this.dirty = false;
  47 + },
  48 +
35 49 setDefaultValues: function()
36 50 {
37 51 this.set('iserie-tableonx', false);
... ...
js/app/models/PlotObjects/PlotInstantSpectroObject.js
... ... @@ -24,6 +24,20 @@ Ext.define('amdaPlotObj.PlotInstantSpectroObject', {
24 24 {name: 'ispectro-dimonxaxis', type: 'int'}
25 25 ],
26 26  
  27 + constructor: function(){
  28 + var me = this;
  29 + me.callParent(arguments);
  30 + if ((arguments.length > 0) && arguments[0])
  31 + {
  32 + }
  33 + else
  34 + {
  35 + //new object, set default fields values
  36 + me.setDefaultValues();
  37 + }
  38 + this.dirty = false;
  39 + },
  40 +
27 41 setDefaultValues: function()
28 42 {
29 43 this.set('ispectro-dimonxaxis', 0);
... ...
js/app/models/PlotObjects/PlotLayoutAutoObject.js
... ... @@ -21,18 +21,11 @@ Ext.define('amdaPlotObj.PlotLayoutAutoObject', {
21 21 ],
22 22  
23 23 fields : [
24   - {name: 'layout-panel-height', type: 'float'},
25   - {name: 'layout-panel-spacing', type: 'float'},
26   - {name: 'layout-expand', type: 'boolean'}
  24 + {name: 'layout-panel-height', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight},
  25 + {name: 'layout-panel-spacing', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing},
  26 + {name: 'layout-expand', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand}
27 27 ],
28 28  
29   - setDefaultValues: function()
30   - {
31   - this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight);
32   - this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing);
33   - this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand);
34   - },
35   -
36 29 getJsonValues : function()
37 30 {
38 31 var layoutValues = new Object();
... ...
js/app/models/PlotObjects/PlotLayoutManualObject.js
... ... @@ -27,14 +27,6 @@ Ext.define('amdaPlotObj.PlotLayoutManualObject', {
27 27 {name: 'layout-xyplot-margin-right', type: 'float', useNull:true}
28 28 ],
29 29  
30   - setDefaultValues: function()
31   - {
32   - this.set('layout-timeplot-margin-left', null);
33   - this.set('layout-timeplot-margin-right', null);
34   - this.set('layout-xyplot-margin-left', null);
35   - this.set('layout-xyplot-margin-right', null);
36   - },
37   -
38 30 getJsonValues : function()
39 31 {
40 32 var layoutValues = new Object();
... ...
js/app/models/PlotObjects/PlotLayoutVerticalObject.js
... ... @@ -21,26 +21,15 @@ Ext.define('amdaPlotObj.PlotLayoutVerticalObject', {
21 21 ],
22 22  
23 23 fields : [
24   - {name: 'layout-panel-height', type: 'float'},
25   - {name: 'layout-panel-spacing', type: 'float'},
26   - {name: 'layout-expand', type: 'boolean'},
  24 + {name: 'layout-panel-height', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight},
  25 + {name: 'layout-panel-spacing', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing},
  26 + {name: 'layout-expand', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand},
27 27 //{name: 'layout-timeplot-width', type: 'float', useNull:true},
28 28 {name: 'layout-timeplot-height', type: 'float', useNull:true},
29 29 {name: 'layout-xyplot-width', type: 'float', useNull:true},
30 30 {name: 'layout-xyplot-height', type: 'float', useNull:true}
31 31 ],
32 32  
33   - setDefaultValues: function()
34   - {
35   - this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight);
36   - this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing);
37   - this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand);
38   - //this.set('layout-timeplot-width', null);
39   - this.set('layout-timeplot-height', null);
40   - this.set('layout-xyplot-width', null);
41   - this.set('layout-xyplot-height', null);
42   - },
43   -
44 33 getJsonValues : function()
45 34 {
46 35 var layoutValues = new Object();
... ...
js/app/models/PlotObjects/PlotLegendSeriesObject.js
... ... @@ -21,25 +21,25 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
21 21 ],
22 22  
23 23 fields : [
24   - {name: 'legend-series-activated', type: 'boolean'},
25   - {name: 'legend-series-type', type: 'string'},
26   - {name: 'legend-series-position', type: 'string'},
27   - {name: 'legend-series-showparaminfo', type: 'boolean'},
28   - {name: 'legend-series-defaulttextcolor', type: 'string'},
29   - {name: 'legend-series-border-activated', type: 'boolean'},
30   - {name: 'legend-series-border-color', type: 'string'},
31   - {name: 'legend-series-intervalinfo-activated', type: 'boolean'},
32   - {name: 'legend-series-intervalinfo-type', type: 'string'},
33   - {name: 'legend-series-font-activated', type: 'boolean'},
34   - {name: 'legend-series-font-name', type: 'string'},
35   - {name: 'legend-series-font-size', type: 'int'},
36   - {name: 'legend-series-font-bold', type: 'boolean'},
37   - {name: 'legend-series-font-italic', type: 'boolean'}
  24 + {name: 'legend-series-activated', type: 'boolean', defaultValue: false},
  25 + {name: 'legend-series-type', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type},
  26 + {name: 'legend-series-position', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position},
  27 + {name: 'legend-series-showparaminfo', type: 'boolean', defaultValue: true},
  28 + {name: 'legend-series-defaulttextcolor', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.text.color},
  29 + {name: 'legend-series-border-activated', type: 'boolean', defaultValue: false},
  30 + {name: 'legend-series-border-color', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.border.color},
  31 + {name: 'legend-series-intervalinfo-activated', type: 'boolean', defaultValue: false},
  32 + {name: 'legend-series-intervalinfo-type', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.intervalinfo.type},
  33 + {name: 'legend-series-font-activated', type: 'boolean', defaultValue: false},
  34 + {name: 'legend-series-font-name', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name},
  35 + {name: 'legend-series-font-size', type: 'int', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size},
  36 + {name: 'legend-series-font-bold', type: 'boolean', defaultValue: false},
  37 + {name: 'legend-series-font-italic', type: 'boolean', defaultValue: false}
38 38 ],
39 39  
40 40 setDefaultValues: function()
41 41 {
42   - this.set('legend-series-activated', false);
  42 + /*this.set('legend-series-activated', false);
43 43 this.set('legend-series-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type);
44 44 this.set('legend-series-position', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position);
45 45 this.set('legend-series-showparaminfo', true);
... ... @@ -52,7 +52,7 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
52 52 this.set('legend-series-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name);
53 53 this.set('legend-series-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size);
54 54 this.set('legend-series-font-bold', false);
55   - this.set('legend-series-font-italic', false);
  55 + this.set('legend-series-font-italic', false);*/
56 56 },
57 57  
58 58 getShortInfo : function()
... ...
js/app/models/PlotObjects/PlotLegendTextObject.js
... ... @@ -33,6 +33,20 @@ Ext.define('amdaPlotObj.PlotLegendTextObject', {
33 33 {name: 'legend-text-font-italic', type: 'boolean'}
34 34 ],
35 35  
  36 + constructor: function(){
  37 + var me = this;
  38 + me.callParent(arguments);
  39 + if ((arguments.length > 0) && arguments[0])
  40 + {
  41 + }
  42 + else
  43 + {
  44 + //new object, set default fields values
  45 + me.setDefaultValues();
  46 + }
  47 + this.dirty = false;
  48 + },
  49 +
36 50 setDefaultValues: function()
37 51 {
38 52 this.set('legend-text-value', '');
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -140,8 +140,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
140 140 me.loadAxes(arguments[0].axes);
141 141 if (arguments[0].params)
142 142 me.loadParams(arguments[0].params);
143   - if (arguments[0].textLegends)
144   - me.loadTextLegends(arguments[0].textLegends);
  143 + if (arguments[0]['text-legends'])
  144 + me.loadTextLegends(arguments[0]['text-legends']);
145 145 if (arguments[0].constants)
146 146 me.loadConstants(arguments[0].constants);
147 147 if (arguments[0].textObjs)
... ... @@ -150,12 +150,15 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
150 150 me.loadCurves(arguments[0].curves);
151 151 if (arguments[0].fills)
152 152 me.loadFills(arguments[0].fills);
  153 + if (arguments[0]['panel-series-legend'])
  154 + me.loadSeriesLegend(arguments[0]['panel-series-legend']);
153 155 }
154 156 else
155 157 {
156 158 //new object, set default fields values
157 159 me.setDefaultValues();
158 160 }
  161 + this.dirty = false;
159 162 },
160 163  
161 164 loadAxes: function(axes)
... ... @@ -193,6 +196,12 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
193 196 this.fills().loadData(fills);
194 197 },
195 198  
  199 + loadSeriesLegend: function(seriesLegend)
  200 + {
  201 + this.set('panel-legend-series', new amdaPlotObj.PlotLegendSeriesObject(seriesLegend));
  202 + this.get('panel-legend-series').dirty = false;
  203 + },
  204 +
196 205 initAxes : function()
197 206 {
198 207 this.axes().removeAll();
... ... @@ -264,7 +273,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
264 273 this.set('last-param-id', this.get('last-param-id') + 1);
265 274 var recs = this.params().add({id : this.get('last-param-id')});
266 275 var availableDrawingObjects = recs[0].getAvailableDrawingObjectByPlotType(this.get('panel-plot-type'));
267   - recs[0].updateDrawingType(availableDrawingObjects[0].key, true);
  276 + recs[0].changeDrawingType(availableDrawingObjects[0].key);
  277 + this.dirty = true;
268 278 return recs[0];
269 279 },
270 280  
... ... @@ -274,6 +284,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
274 284 if (paramRecord == null)
275 285 return false;
276 286 this.params().remove(paramRecord);
  287 + this.dirty = true;
277 288 return true;
278 289 },
279 290  
... ... @@ -281,6 +292,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
281 292 this.set('last-textlegend-id', this.get('last-textlegend-id') + 1);
282 293 var recs = this.textLegends().add({id : this.get('last-textlegend-id')});
283 294 recs[0].setDefaultValues();
  295 + this.dirty = true;
284 296 return recs[0];
285 297 },
286 298  
... ... @@ -290,6 +302,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
290 302 if (textLegendRecord == null)
291 303 return false;
292 304 this.textLegends().remove(textLegendRecord);
  305 + this.dirty = true;
293 306 return true;
294 307 },
295 308  
... ... @@ -297,6 +310,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
297 310 this.set('last-constant-id', this.get('last-constant-id') + 1);
298 311 var recs = this.constants().add({id : this.get('last-constant-id')});
299 312 recs[0].setDefaultValues();
  313 + this.dirty = true;
300 314 return recs[0];
301 315 },
302 316  
... ... @@ -306,6 +320,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
306 320 if (constantRecord == null)
307 321 return false;
308 322 this.constants().remove(constantRecord);
  323 + this.dirty = true;
309 324 return true;
310 325 },
311 326  
... ... @@ -313,6 +328,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
313 328 this.set('last-textobj-id', this.get('last-textobj-id') + 1);
314 329 var recs = this.textObjs().add({id : this.get('last-textobj-id')});
315 330 recs[0].setDefaultValues();
  331 + this.dirty = true;
316 332 return recs[0];
317 333 },
318 334  
... ... @@ -322,6 +338,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
322 338 if (textObjRecord == null)
323 339 return false;
324 340 this.textObjs().remove(textObjRecord);
  341 + this.dirty = true;
325 342 return true;
326 343 },
327 344  
... ... @@ -329,6 +346,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
329 346 this.set('last-curve-id', this.get('last-curve-id') + 1);
330 347 var recs = this.curves().add({id : this.get('last-curve-id')});
331 348 recs[0].setDefaultValues();
  349 + this.dirty = true;
332 350 return recs[0];
333 351 },
334 352  
... ... @@ -338,6 +356,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
338 356 if (curveRecord == null)
339 357 return false;
340 358 this.curves().remove(curveRecord);
  359 + this.dirty = true;
341 360 return true;
342 361 },
343 362  
... ... @@ -345,6 +364,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
345 364 this.set('last-fill-id', this.get('last-fill-id') + 1);
346 365 var recs = this.fills().add({id : this.get('last-fill-id')});
347 366 recs[0].setDefaultValues();
  367 + this.dirty = true;
348 368 return recs[0];
349 369 },
350 370  
... ... @@ -354,13 +374,12 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
354 374 if (fillRecord == null)
355 375 return false;
356 376 this.fills().remove(fillRecord);
  377 + this.dirty = true;
357 378 return true;
358 379 },
359 380  
360   - updatePlotType: function(plotType, forceUpdate) {
361   - forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false;
362   -
363   - if (!forceUpdate && (plotType == this.get('panel-plot-type')))
  381 + changePlotType: function(plotType) {
  382 + if (plotType == this.get('panel-plot-type'))
364 383 return;
365 384  
366 385 this.set('panel-plot-type', plotType);
... ... @@ -375,7 +394,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
375 394 });
376 395 if (!compatibleDrawingType)
377 396 {
378   - param.updateDrawingType(availableDrawingObjects[0].key, forceUpdate);
  397 + param.changeDrawingType(availableDrawingObjects[0].key);
379 398 }
380 399 });
381 400 this.initAxes();
... ... @@ -385,7 +404,6 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
385 404 if (this.get('panel-legend-series') == null)
386 405 {
387 406 this.set('panel-legend-series', new amdaPlotObj.PlotLegendSeriesObject());
388   - this.get('panel-legend-series').setDefaultValues();
389 407 }
390 408 }
391 409 else
... ... @@ -445,7 +463,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
445 463  
446 464 this.set('panel-epoch-centertimeid', "");
447 465  
448   - this.updatePlotType(amdaPlotObj.PlotObjectConfig.defaultValues.panel.plotType);
  466 + this.changePlotType(amdaPlotObj.PlotObjectConfig.defaultValues.panel.plotType);
449 467 },
450 468  
451 469 getPanelShortInfo : function()
... ... @@ -468,6 +486,68 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
468 486 return info;
469 487 },
470 488  
  489 + isDirty : function()
  490 + {
  491 + if (this.dirty)
  492 + return true;
  493 + var d = false;
  494 +
  495 + this.axes().each(function (axe, index) {
  496 + if (axe.isDirty())
  497 + d = true;
  498 + });
  499 + if (d)
  500 + return d;
  501 +
  502 + this.params().each(function (param, index) {
  503 + if (param.isDirty())
  504 + d = true;
  505 + });
  506 + if (d)
  507 + return d;
  508 +
  509 + this.textLegends().each(function (text, index) {
  510 + if (text.dirty)
  511 + d = true;
  512 + });
  513 + if (d)
  514 + return d;
  515 +
  516 + this.constants().each(function (constant, index) {
  517 + if (constant.dirty)
  518 + d = true;
  519 + });
  520 + if (d)
  521 + return d;
  522 +
  523 + this.textObjs().each(function (textObj, index) {
  524 + if (textObj.dirty)
  525 + d = true;
  526 + });
  527 + if (d)
  528 + return d;
  529 +
  530 + this.curves().each(function (curve, index) {
  531 + if (curve.isDirty())
  532 + d = true;
  533 + });
  534 + if (d)
  535 + return d;
  536 +
  537 + this.fills().each(function (fill, index) {
  538 + if (fill.dirty)
  539 + d = true;
  540 + });
  541 + if (d)
  542 + return d;
  543 +
  544 + if (this.get('panel-legend-series') != null)
  545 + if (this.get('panel-legend-series').dirty)
  546 + return true;
  547 +
  548 + return false;
  549 + },
  550 +
471 551 getJsonValues : function()
472 552 {
473 553 var panelValues = new Object();
... ... @@ -522,7 +602,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
522 602 if (this.get('panel-plot-type') == 'instantPlot')
523 603 panelValues['panel-instant-time'] = this.get('panel-instant-time');
524 604  
525   - if ((this.get('panel-legend-series') != null) && this.get('panel-legend-series').get('legend-series-activated'))
  605 + if (this.get('panel-legend-series') != null)
526 606 panelValues['panel-series-legend'] = this.get('panel-legend-series').getJsonValues();
527 607  
528 608 panelValues['text-legends'] = [];
... ...
js/app/models/PlotObjects/PlotParamObject.js
... ... @@ -45,12 +45,12 @@ Ext.define('amdaPlotObj.PlotParamObject', {
45 45 constructor: function(){
46 46 var me = this;
47 47 me.callParent(arguments);
48   - me.updateDrawingType(this.get('param-drawing-type'), true);
49 48 if ((arguments.length > 0) && arguments[0])
50 49 {
51 50 if (arguments[0]['param-drawing-object'])
52 51 me.loadDrawingObject(arguments[0]['param-drawing-object']);
53 52 }
  53 + this.dirty = false;
54 54 },
55 55  
56 56 loadDrawingObject: function(drawing)
... ... @@ -58,44 +58,40 @@ Ext.define('amdaPlotObj.PlotParamObject', {
58 58 var drawingObject = this.get('param-drawing-object');
59 59 if (drawingObject == null)
60 60 return;
61   - Ext.Object.each(drawing, function(key,value) {
62   - drawingObject.set(key,value);
63   - });
  61 + this.set('param-drawing-object', this.createDrawingObjectByType(this.get('param-drawing-type'), drawing));
  62 + drawingObject.dirty = false;
64 63 },
65 64  
66   - updateDrawingType: function(type, forceUpdate)
  65 + createDrawingObjectByType : function(type, data)
67 66 {
68   - forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false;
69   -
70   - if (!forceUpdate && (type == this.get('param-drawing-type')))
71   - return;
72   -
73   - this.set('param-drawing-type', type);
74   -
75 67 //Create drawing object in relation with the type
76 68 switch (type)
77 69 {
78 70 case 'serie' :
79   - this.set('param-drawing-object', new amdaPlotObj.PlotSerieObject());
80   - break;
  71 + return new amdaPlotObj.PlotSerieObject(data);
81 72 case 'spectro' :
82   - this.set('param-drawing-object', new amdaPlotObj.PlotSpectroObject());
83   - break;
  73 + return new amdaPlotObj.PlotSpectroObject(data);
84 74 case 'status-bar' :
85   - this.set('param-drawing-object', new amdaPlotObj.PlotStatusBarObject());
86   - break;
  75 + return new amdaPlotObj.PlotStatusBarObject(data);
87 76 case 'tick-bar' :
88   - this.set('param-drawing-object', new amdaPlotObj.PlotTickBarObject());
89   - break;
  77 + return new amdaPlotObj.PlotTickBarObject(data);
90 78 case 'iserie' :
91   - this.set('param-drawing-object', new amdaPlotObj.PlotInstantSerieObject());
92   - break;
  79 + return new amdaPlotObj.PlotInstantSerieObject(data);
93 80 case 'ispectro' :
94   - this.set('param-drawing-object', new amdaPlotObj.PlotInstantSpectroObject());
95   - break;
  81 + return new amdaPlotObj.PlotInstantSpectroObject(data);
96 82 default :
97   - this.set('param-drawing-object', null);
  83 + return null;
98 84 }
  85 + },
  86 +
  87 + changeDrawingType: function(type)
  88 + {
  89 + if (type == this.get('param-drawing-type'))
  90 + return;
  91 +
  92 + this.set('param-drawing-type', type);
  93 +
  94 + this.set('param-drawing-object', this.createDrawingObjectByType(type));
99 95  
100 96 //Set drawing object to default status
101 97 if (this.get('param-drawing-object') != null)
... ... @@ -137,7 +133,7 @@ Ext.define('amdaPlotObj.PlotParamObject', {
137 133  
138 134 setDefaultValues: function(type)
139 135 {
140   - this.updateDrawingType(type, true);
  136 + this.changeDrawingType(type);
141 137 },
142 138  
143 139 getShortInfo : function(plotType)
... ... @@ -175,6 +171,16 @@ Ext.define('amdaPlotObj.PlotParamObject', {
175 171 return info;
176 172 },
177 173  
  174 + isDirty : function()
  175 + {
  176 + if (this.dirty)
  177 + return true;
  178 + if (this.get('param-drawing-object') != null)
  179 + return this.get('param-drawing-object').dirty;
  180 +
  181 + return false;
  182 + },
  183 +
178 184 getJsonValues : function()
179 185 {
180 186 var paramValues = new Object();
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -72,6 +72,7 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
72 72 this.set('last-tab-id', this.get('last-tab-id') + 1);
73 73 var recs = this.tabs().add({id : this.get('last-tab-id')});
74 74 recs[0].setDefaultValues();
  75 + this.dirty = true;
75 76 return recs[0];
76 77 },
77 78  
... ... @@ -81,9 +82,26 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
81 82 if (tabRecord == null)
82 83 return false;
83 84 this.tabs().remove(tabRecord);
  85 + this.dirty = true;
84 86 return true;
85 87 },
86 88  
  89 + isDirty : function()
  90 + {
  91 + if (this.get('id') == '')
  92 + return false;
  93 +
  94 + if (this.dirty)
  95 + return true;
  96 +
  97 + var d = false;
  98 + this.tabs().each(function (tab, index) {
  99 + if (tab.isDirty())
  100 + d = true;
  101 + });
  102 + return d;
  103 + },
  104 +
87 105 getJsonValues : function(hasId)
88 106 {
89 107 var requestValues = new Object();
... ...
js/app/models/PlotObjects/PlotSerieObject.js
... ... @@ -56,6 +56,20 @@ Ext.define('amdaPlotObj.PlotSerieObject', {
56 56 {name: 'serie-timetick-font-italic', type: 'boolean'}
57 57 ],
58 58  
  59 + constructor: function(){
  60 + var me = this;
  61 + me.callParent(arguments);
  62 + if ((arguments.length > 0) && arguments[0])
  63 + {
  64 + }
  65 + else
  66 + {
  67 + //new object, set default fields values
  68 + me.setDefaultValues();
  69 + }
  70 + this.dirty = false;
  71 + },
  72 +
59 73 setDefaultValues: function()
60 74 {
61 75 this.set('serie-yaxis', amdaPlotObj.PlotObjectConfig.defaultValues.serie.yAxis);
... ...
js/app/models/PlotObjects/PlotSpectroObject.js
... ... @@ -24,6 +24,20 @@ Ext.define('amdaPlotObj.PlotSpectroObject', {
24 24 {name: 'spectro-yaxis', type: 'string'}
25 25 ],
26 26  
  27 + constructor: function(){
  28 + var me = this;
  29 + me.callParent(arguments);
  30 + if ((arguments.length > 0) && arguments[0])
  31 + {
  32 + }
  33 + else
  34 + {
  35 + //new object, set default fields values
  36 + me.setDefaultValues();
  37 + }
  38 + this.dirty = false;
  39 + },
  40 +
27 41 setDefaultValues: function()
28 42 {
29 43 this.set('spectro-yaxis', amdaPlotObj.PlotObjectConfig.defaultValues.spectro.yAxis);
... ...
js/app/models/PlotObjects/PlotStatusBarObject.js
... ... @@ -23,6 +23,20 @@ Ext.define('amdaPlotObj.PlotTickBarObject', {
23 23 fields : [
24 24 ],
25 25  
  26 + constructor: function(){
  27 + var me = this;
  28 + me.callParent(arguments);
  29 + if ((arguments.length > 0) && arguments[0])
  30 + {
  31 + }
  32 + else
  33 + {
  34 + //new object, set default fields values
  35 + me.setDefaultValues();
  36 + }
  37 + this.dirty = false;
  38 + },
  39 +
26 40 setDefaultValues: function()
27 41 {
28 42 },
... ...
js/app/models/PlotObjects/PlotTabObject.js
... ... @@ -70,7 +70,6 @@ Ext.define('amdaPlotObj.PlotTabObject', {
70 70 constructor: function(){
71 71 var me = this;
72 72 me.callParent(arguments);
73   - me.setLayout(this.get('page-layout-type'), true);
74 73 if ((arguments.length > 0) && arguments[0])
75 74 {
76 75 if (arguments[0].panels)
... ... @@ -83,6 +82,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
83 82 //new object, set default fields values
84 83 me.setDefaultValues();
85 84 }
  85 + this.dirty = false;
86 86 },
87 87  
88 88 loadPanels: function(panels)
... ... @@ -92,18 +92,16 @@ Ext.define('amdaPlotObj.PlotTabObject', {
92 92  
93 93 loadLayoutObject: function(layout)
94 94 {
95   - var layoutObject = this.get('page-layout-object');
96   - if (layoutObject == null)
97   - return;
98   - Ext.Object.each(layout, function(key,value) {
99   - layoutObject.set(key,value);
100   - });
  95 + this.set('page-layout-object', this.createLayoutByType(this.get('page-layout-type'), layout));
  96 + if (this.get('page-layout-object') != null)
  97 + this.get('page-layout-object').dirty = false;
101 98 },
102 99  
103 100 createNewPanel: function() {
104 101 this.set('last-panel-id', this.get('last-panel-id') + 1);
105 102 var recs = this.panels().add({id : this.get('last-panel-id')});
106 103 recs[0].setDefaultValues();
  104 + this.dirty = true;
107 105 return recs[0];
108 106 },
109 107  
... ... @@ -113,37 +111,33 @@ Ext.define('amdaPlotObj.PlotTabObject', {
113 111 if (panelRecord == null)
114 112 return false;
115 113 this.panels().remove(panelRecord);
  114 + this.dirty = true;
116 115 return true;
117 116 },
118 117  
119   - setLayout: function(layoutType, forceUpdate)
  118 + createLayoutByType : function(layoutType, data)
120 119 {
121   - forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false;
122   -
123   - if (!forceUpdate && (layoutType == this.get('page-layout-type')))
124   - return;
125   -
126   - this.set('page-layout-type', layoutType);
127   -
128 120 //Create layout object in relation with the type
129 121 switch (layoutType)
130 122 {
131 123 case 'vertical' :
132   - this.set('page-layout-object', new amdaPlotObj.PlotLayoutVerticalObject());
133   - break;
  124 + return new amdaPlotObj.PlotLayoutVerticalObject(data);
134 125 case 'auto' :
135   - this.set('page-layout-object', new amdaPlotObj.PlotLayoutAutoObject());
136   - break;
  126 + return new amdaPlotObj.PlotLayoutAutoObject(data);
137 127 case 'manual' :
138   - this.set('page-layout-object', new amdaPlotObj.PlotLayoutManualObject());
139   - break;
  128 + return new amdaPlotObj.PlotLayoutManualObject(data);
140 129 default :
141   - this.set('page-layout-object', null);
  130 + return null;
142 131 }
  132 + },
  133 +
  134 + setLayout: function(layoutType)
  135 + {
  136 + if (layoutType == this.get('page-layout-type'))
  137 + return;
143 138  
144   - //Set layout object to default status
145   - if (this.get('page-layout-object') != null)
146   - this.get('page-layout-object').setDefaultValues();
  139 + this.set('page-layout-type', layoutType);
  140 + this.set('page-layout-object', this.createLayoutByType(layoutType));
147 141 },
148 142  
149 143 setDefaultValues: function()
... ... @@ -176,8 +170,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
176 170 this.set('page-font-bold', false);
177 171 this.set('page-font-italic', false);
178 172  
179   - this.set('page-layout-type', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type);
180   - this.setLayout(amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type, true);
  173 + this.setLayout(amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type);
181 174 },
182 175  
183 176 getPageShortInfo : function()
... ... @@ -197,6 +190,23 @@ Ext.define('amdaPlotObj.PlotTabObject', {
197 190 return type;
198 191 },
199 192  
  193 + isDirty : function()
  194 + {
  195 + if (this.dirty)
  196 + return true;
  197 +
  198 + if (this.get('page-layout-object') != null)
  199 + if (this.get('page-layout-object').dirty)
  200 + return true;
  201 +
  202 + var d = false;
  203 + this.panels().each(function (panel, index) {
  204 + if (panel.isDirty())
  205 + d = true;
  206 + });
  207 + return d;
  208 + },
  209 +
200 210 getJsonValues : function()
201 211 {
202 212 var tabValues = new Object();
... ...
js/app/models/PlotObjects/PlotTextObject.js
... ... @@ -50,6 +50,20 @@ Ext.define('amdaPlotObj.PlotTextObject', {
50 50 {name: 'text-font-italic', type: 'boolean'}
51 51 ],
52 52  
  53 + constructor: function(){
  54 + var me = this;
  55 + me.callParent(arguments);
  56 + if ((arguments.length > 0) && arguments[0])
  57 + {
  58 + }
  59 + else
  60 + {
  61 + //new object, set default fields values
  62 + me.setDefaultValues();
  63 + }
  64 + this.dirty = false;
  65 + },
  66 +
53 67 setDefaultValues: function()
54 68 {
55 69 this.set('text-value', '');
... ...
js/app/models/PlotObjects/PlotTickBarObject.js
... ... @@ -23,6 +23,20 @@ Ext.define('amdaPlotObj.PlotStatusBarObject', {
23 23 fields : [
24 24 ],
25 25  
  26 + constructor: function(){
  27 + var me = this;
  28 + me.callParent(arguments);
  29 + if ((arguments.length > 0) && arguments[0])
  30 + {
  31 + }
  32 + else
  33 + {
  34 + //new object, set default fields values
  35 + me.setDefaultValues();
  36 + }
  37 + this.dirty = false;
  38 + },
  39 +
26 40 setDefaultValues: function()
27 41 {
28 42 },
... ...
js/app/views/PlotComponents/PlotConstantForm.js
... ... @@ -15,6 +15,7 @@ Ext.define('amdaPlotComp.PlotConstantForm', {
15 15 this.object = object;
16 16 if (this.object != null)
17 17 this.loadRecord(this.object);
  18 + this.updateOptions(this.object.get('constant-axis-id'), this.crtTree.getSelectedPlotType());
18 19 },
19 20  
20 21 updateOptions: function(axisId, plotType) {
... ... @@ -29,8 +30,11 @@ Ext.define('amdaPlotComp.PlotConstantForm', {
29 30 var me = this;
30 31 return [
31 32 this.addStandardCombo('constant-axis-id', 'Axis attachment', amdaPlotObj.PlotObjectConfig.availableConstantAxes, function (name, value, oldValue) {
32   - me.updateOptions(value, me.crtTree.getSelectedPlotType());
33   - me.crtTree.getView().refresh();
  33 + if (me.object.get('constant-axis-id') != value)
  34 + {
  35 + me.updateOptions(value, me.crtTree.getSelectedPlotType());
  36 + me.crtTree.getView().refresh();
  37 + }
34 38 }),
35 39 this.addStandardDate('constant-time-value', 'Value'),
36 40 this.addStandardText('constant-float-value', 'Value'),
... ...
js/app/views/PlotComponents/PlotCurveForm.js
... ... @@ -50,7 +50,7 @@ Ext.define('amdaPlotComp.PlotCurveForm', {
50 50 value: param.get('curve-param-value'),
51 51 listeners: {
52 52 change: function(field, newValue, oldValue, eOpts) {
53   - param.set(param.get('curve-param-name'), newValue);
  53 + param.set('curve-param-value', newValue);
54 54 },
55 55 scope: me
56 56 }
... ... @@ -120,9 +120,10 @@ Ext.define('amdaPlotComp.PlotCurveForm', {
120 120  
121 121 return [
122 122 this.addStandardCombo('curve-name', 'Curve name', [], function(name, value, oldValue) {
123   - me.object.setCurveName(value, function (){
124   - me.updateParamsContainer();
125   - });
  123 + if (me.object.get('curve-name') != value)
  124 + me.object.setCurveName(value, function (){
  125 + me.updateParamsContainer();
  126 + });
126 127 }),
127 128 this.addStandardCombo('curve-serie-id', 'Attached serie', []),
128 129 this.addStandardFieldSet('Lines', '', this.addStandardLineItems('curve-line')),
... ...
js/app/views/PlotComponents/PlotElementPanel.js
... ... @@ -40,6 +40,13 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
40 40 this.callParent(arguments);
41 41 },
42 42  
  43 + destroy: function() {
  44 + this.elementFormsManager.each(function (key, value, length) {
  45 + this.elementFormsManager.unregister(value);
  46 + }, this);
  47 + this.callParent();
  48 + },
  49 +
43 50 setElement: function(type, object, tree) {
44 51 this.removeAll(false);
45 52  
... ...
js/app/views/PlotComponents/PlotFillForm.js
... ... @@ -22,6 +22,7 @@ Ext.define('amdaPlotComp.PlotFillForm', {
22 22 this.updateSerieIdLists();
23 23 this.updateConstantIdList();
24 24 this.loadRecord(this.object);
  25 + this.updateOptions();
25 26 }
26 27 },
27 28  
... ... @@ -77,8 +78,11 @@ Ext.define('amdaPlotComp.PlotFillForm', {
77 78 return [
78 79  
79 80 this.addStandardCombo('fill-type', 'Fill type', amdaPlotObj.PlotObjectConfig.availableFillTypes, function(name, value, oldValue) {
80   - me.updateOptions();
81   - me.crtTree.getView().refresh();
  81 + if (me.object.get('fill-type') != value)
  82 + {
  83 + me.updateOptions();
  84 + me.crtTree.getView().refresh();
  85 + }
82 86 }),
83 87 this.addStandardCombo('fill-firstserie-id', 'First serie Id', []),
84 88 this.addStandardCombo('fill-secondserie-id', 'Second serie Id', []),
... ...
js/app/views/PlotComponents/PlotLayoutForm.js
... ... @@ -21,6 +21,13 @@ Ext.define('amdaPlotComp.PlotLayoutForm', {
21 21  
22 22 layoutOptionsFormsManager : new Ext.AbstractManager(),
23 23  
  24 + destroy: function() {
  25 + this.layoutOptionsFormsManager.each(function (key, value, length) {
  26 + this.layoutOptionsFormsManager.unregister(value);
  27 + }, this);
  28 + this.callParent();
  29 + },
  30 +
24 31 setObject : function(object) {
25 32 this.object = object;
26 33 this.loadRecord(this.object);
... ... @@ -59,10 +66,10 @@ Ext.define('amdaPlotComp.PlotLayoutForm', {
59 66  
60 67 },
61 68  
62   - updateLayoutOptions: function(forceUpdate) {
  69 + updateLayoutOptions: function() {
63 70 var typeField = this.getForm().findField('page-layout-type');
64 71 var layoutType = typeField.getValue();
65   - this.object.setLayout(layoutType, forceUpdate);
  72 + this.object.setLayout(layoutType);
66 73  
67 74 this.layoutOptionsContainer.removeAll(false);
68 75  
... ... @@ -82,8 +89,11 @@ Ext.define('amdaPlotComp.PlotLayoutForm', {
82 89  
83 90 return [
84 91 this.addStandardCombo('page-layout-type', 'Layout type', amdaPlotObj.PlotObjectConfig.availablePageLayouts, function(name, value, oldValue) {
85   - me.updateLayoutOptions(value != oldValue);
86   - me.crtTree.getView().refresh();
  92 + if (me.object.get('page-layout-type') != value)
  93 + {
  94 + me.updateLayoutOptions();
  95 + me.crtTree.getView().refresh();
  96 + }
87 97 }),
88 98 this.layoutOptionsContainer
89 99 ];
... ...
js/app/views/PlotComponents/PlotLegendSeriesForm.js
... ... @@ -13,6 +13,7 @@ Ext.define('amdaPlotComp.PlotLegendSeriesForm', {
13 13  
14 14 setObject : function(object) {
15 15 this.object = object.get('panel-legend-series');
  16 + console.log(this.object);
16 17 if (this.object != null)
17 18 this.loadRecord(this.object);
18 19 var legendTypeField = this.getForm().findField('legend-series-type');
... ...
js/app/views/PlotComponents/PlotOutputForm.js
... ... @@ -13,27 +13,32 @@ Ext.define('amdaPlotComp.PlotOutputForm', {
13 13  
14 14 title: 'Output options',
15 15  
16   - updateOneFilePerIntOption : function() {
17   - var formatField = this.getForm().findField('file-format');
  16 + setObject : function(object) {
  17 + this.object = object;
  18 + this.loadRecord(this.object);
  19 + this.updateOutputOption(this.object.get('file-format'));
  20 + this.updateOneFilePerIntOption(this.object.get('file-format'));
  21 + this.updateFilePrefixOption(this.object.get('file-output'));
  22 + },
  23 +
  24 + updateOneFilePerIntOption : function(format) {
18 25 var oneFilePerIntField = this.getForm().findField('one-file-per-interval');
19 26  
20   - oneFilePerIntField.setDisabled((formatField.getValue() == 'PNG') || (formatField.getValue() == 'SVG'));
  27 + oneFilePerIntField.setDisabled((format == 'PNG') || (format == 'SVG'));
21 28 },
22 29  
23   - updateFilePrefixOption : function() {
  30 + updateFilePrefixOption : function(output) {
24 31 var prefixField = this.getForm().findField('file-prefix');
25   - var outputField = this.getForm().findField('file-output');
26 32  
27   - if (outputField.getValue() == 'INTERACTIVE')
  33 + if (output == 'INTERACTIVE')
28 34 prefixField.setValue("");
29   - prefixField.setDisabled(outputField.getValue() == 'INTERACTIVE');
  35 + prefixField.setDisabled(output == 'INTERACTIVE');
30 36 },
31 37  
32   - updateOutputOption : function() {
33   - var formatField = this.getForm().findField('file-format');
  38 + updateOutputOption : function(format) {
34 39 var outputField = this.getForm().findField('file-output');
35 40  
36   - if (formatField.getValue() == 'PNG')
  41 + if (format == 'PNG')
37 42 {
38 43 outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForPng);
39 44 outputField.setValue('INTERACTIVE');
... ... @@ -43,6 +48,8 @@ Ext.define('amdaPlotComp.PlotOutputForm', {
43 48 outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForOtherFormats);
44 49 if (outputField.getValue() == 'INTERACTIVE')
45 50 outputField.setValue('TGZ');
  51 + else
  52 + outputField.setValue('TGZ');
46 53 }
47 54 },
48 55  
... ... @@ -51,11 +58,15 @@ Ext.define('amdaPlotComp.PlotOutputForm', {
51 58  
52 59 return [
53 60 this.addStandardCombo('file-format', 'File format', amdaPlotObj.PlotObjectConfig.availableFileFormats, function(name, value, oldValue) {
54   - me.updateOutputOption();
55   - me.updateOneFilePerIntOption();
  61 + if (me.object.get('file-format') != value)
  62 + {
  63 + me.updateOutputOption(value);
  64 + me.updateOneFilePerIntOption(value);
  65 + }
56 66 }),
57 67 this.addStandardCombo('file-output', 'File output', amdaPlotObj.PlotObjectConfig.availableFileOutputs, function(name, value, oldValue) {
58   - me.updateFilePrefixOption();
  68 + if (me.object.get('file-output') != value)
  69 + me.updateFilePrefixOption(value);
59 70 }),
60 71 this.addStandardText('file-prefix', 'File prefix'),
61 72 this.addStandardCheck('one-file-per-interval', 'One file per interval'),
... ...
js/app/views/PlotComponents/PlotPanelForm.js
... ... @@ -117,9 +117,9 @@ Ext.define('amdaPlotComp.PlotPanelForm', {
117 117 var me = this;
118 118 return [
119 119 this.addStandardCombo('panel-plot-type', 'Plot type', amdaPlotObj.PlotObjectConfig.availablePlotTypes, function(name, value, oldValue) {
120   - if (value != oldValue)
  120 + if (value != me.object.get('panel-plot-type'))
121 121 {
122   - me.object.updatePlotType(value, true);
  122 + me.object.changePlotType(value);
123 123 if (!me.crtTree.tabObject.get('tree-simplified-view'))
124 124 {
125 125 me.crtTree.buildPanelAxesNode(me.object);
... ...
js/app/views/PlotComponents/PlotParamForm.js
... ... @@ -24,10 +24,17 @@ Ext.define('amdaPlotComp.PlotParamForm', {
24 24  
25 25 drawingOptionsFormsManager : new Ext.AbstractManager(),
26 26  
  27 + destroy: function() {
  28 + this.drawingOptionsFormsManager.each(function (key, value, length) {
  29 + this.drawingOptionsFormsManager.unregister(value);
  30 + }, this);
  31 + this.callParent();
  32 + },
  33 +
27 34 setObject : function(object) {
28 35 this.object = object;
29 36 this.loadRecord(this.object);
30   - this.updateDrawingOptions();
  37 + this.updateDrawingOptions(this.object.get('param-drawing-type'));
31 38 },
32 39  
33 40 getDrawingOptionsForm: function(type) {
... ... @@ -71,15 +78,14 @@ Ext.define('amdaPlotComp.PlotParamForm', {
71 78  
72 79 },
73 80  
74   - updateDrawingOptions: function(forceUpdate) {
  81 + updateDrawingOptions: function(drawingType) {
75 82 var typeField = this.getForm().findField('param-drawing-type');
76 83  
77 84 var availableDrawingObjects = this.object.getAvailableDrawingObjectByPlotType(this.crtTree.getSelectedPlotType());
78 85 typeField.getStore().loadData(availableDrawingObjects);
79   -
80   - var drawingType = typeField.getValue();
81   -
82   - this.object.updateDrawingType(drawingType, forceUpdate);
  86 + typeField.suspendEvents();
  87 + typeField.setValue(drawingType);
  88 + typeField.resumeEvents(false);
83 89  
84 90 this.drawingOptionsContainer.removeAll(false);
85 91  
... ... @@ -99,8 +105,12 @@ Ext.define('amdaPlotComp.PlotParamForm', {
99 105  
100 106 return [
101 107 this.addStandardCombo('param-drawing-type', 'Drawing type', [{'key' : '', 'value' : 'None'}], function(name, value, oldValue) {
102   - me.updateDrawingOptions(value != oldValue);
103   - me.crtTree.getView().refresh();
  108 + if (me.object.get('param-drawing-type') != value)
  109 + {
  110 + me.object.changeDrawingType(value);
  111 + me.crtTree.getView().refresh();
  112 + me.updateDrawingOptions(value);
  113 + }
104 114 }),
105 115 this.drawingOptionsContainer
106 116 ];
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -91,9 +91,9 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
91 91 editable: false,
92 92 listeners: {
93 93 change: function(combo, newValue, oldValue, eOpts) {
94   - this.object.set(name, newValue);
95 94 if (onChange != null)
96 95 onChange(name, newValue, oldValue);
  96 + this.object.set(name, newValue);
97 97 },
98 98 scope: this
99 99 }
... ...
js/app/views/PlotTabResultUI.js
... ... @@ -314,7 +314,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
314 314 if (result.success)
315 315 {
316 316 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) {
317   - module.startInteractiveSession(result);
  317 + module.updateInteractiveSession(result);
318 318 });
319 319 }
320 320 else
... ... @@ -331,6 +331,131 @@ Ext.define('amdaUI.PlotTabResultUI', {
331 331 },this);
332 332 },
333 333  
  334 + createToolBar : function(isTimeTable) {
  335 + var interoperItemCfg = {
  336 + text: 'Get HST Data',
  337 + scope: this,
  338 + menu: [
  339 + {
  340 + text: 'Giant Planet Auroral Emissions',
  341 + scope: this,
  342 + handler: function()
  343 + {
  344 + var me = this;
  345 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.astro.id, true, function (module) {
  346 + //module.createWindow(me.object.get('startDate'),me.object.get('stopDate'));
  347 + });
  348 + }
  349 + }
  350 + ]
  351 + };
  352 +
  353 + if (isTimeTable) {
  354 + var toolConfig = {
  355 + dock: 'top',
  356 + items: [
  357 + {
  358 + text: 'Previous',
  359 + scope: this,
  360 + handler: function(){
  361 + }
  362 + },
  363 + '-',
  364 + {
  365 + text: 'Next',
  366 + scope: this,
  367 + handler: function(){
  368 + }
  369 + },
  370 + '-',
  371 + {
  372 + text: 'Go to Interval #',
  373 + scope: this,
  374 + handler: function(bt){
  375 + }
  376 + },
  377 + {
  378 + xtype: 'numberfield',
  379 + hideTrigger: true,
  380 + width: 40,
  381 + minValue: 1
  382 + },
  383 + ' ',
  384 + ' ',
  385 + ' ',
  386 + {
  387 + xtype: 'textfield',
  388 + labelAlign: 'right',
  389 + labelWidth: 30,
  390 + fieldLabel: 'Table',
  391 + width: 130,
  392 + disabled : true
  393 + },
  394 + {
  395 + xtype: 'textfield',
  396 + labelAlign: 'right',
  397 + labelWidth: 30,
  398 + fieldLabel: 'Int #',
  399 + width: 70,
  400 + disabled : true
  401 + },
  402 + {
  403 + xtype: 'textfield',
  404 + labelAlign: 'right',
  405 + labelWidth: 30,
  406 + fieldLabel: 'Total',
  407 + width: 70,
  408 + disabled : true
  409 + },
  410 + '->',
  411 + interoperItemCfg
  412 + ]
  413 + };
  414 + }
  415 + else {
  416 + var toolConfig = {
  417 + dock: 'top',
  418 + items: [ {
  419 + text: 'Backward',
  420 + scope: this,
  421 + handler: function(){
  422 + this.callInteractivePlot({'action' : 'backward', 'tabId' : this.tabId});
  423 + }
  424 + },
  425 + '-' ,
  426 + {
  427 + text: '1/2 Backward',
  428 + scope: this,
  429 + handler: function(){
  430 + this.callInteractivePlot({'action' : 'halfbackward', 'tabId' : this.tabId});
  431 + }
  432 + },
  433 + '-',
  434 + {
  435 + text: '1/2 Forward',
  436 + scope: this,
  437 + handler: function(){
  438 + this.callInteractivePlot({'action' : 'halfforward', 'tabId' : this.tabId});
  439 + }
  440 + },
  441 + '-',
  442 + {
  443 + text: 'Forward',
  444 + scope: this,
  445 + handler: function(){
  446 + this.callInteractivePlot({'action' : 'forward', 'tabId' : this.tabId});
  447 + }
  448 + },
  449 + '->',
  450 + interoperItemCfg
  451 + ]
  452 + };
  453 + }
  454 +
  455 + var toolBar = Ext.create('Ext.toolbar.Toolbar', toolConfig);
  456 + return toolBar;
  457 + },
  458 +
334 459 init: function(configResult){
335 460 this.crtContext = configResult.context;
336 461 this.tabId = configResult.tabId;
... ... @@ -363,8 +488,6 @@ Ext.define('amdaUI.PlotTabResultUI', {
363 488 }
364 489 });
365 490  
366   -
367   -
368 491 var mouseToolbar = {
369 492 xtype: 'toolbar',
370 493 height: 25,
... ... @@ -382,13 +505,15 @@ Ext.define('amdaUI.PlotTabResultUI', {
382 505 items: []
383 506 });
384 507  
  508 + var navToolBar = this.createToolBar(false);
  509 +
385 510 var plotResultTabPanelConfig = {
386 511 preventHeader : true,
387 512 autoScroll: true,
388 513 items: [
389 514 this.createPlotImage(configResult.folder, configResult.plotFile)
390 515 ],
391   - dockedItems: [mouseToolbar],
  516 + dockedItems: [navToolBar, mouseToolbar],
392 517 plugins: [ {
393 518 ptype: 'plotZoomPlugin',
394 519 pluginId : 'plot-zoom-plugin-id'
... ...
js/app/views/PlotUI.js
... ... @@ -46,14 +46,49 @@ Ext.define('amdaUI.PlotUI', {
46 46 this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate'));
47 47 },
48 48  
49   - /**
50   - * save method called by Save button to launch the save process
51   - */
52   - saveProcess : function(){
53   - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
54   - if (plotModule)
55   - plotModule.linkedNode.create();
56   - },
  49 + saveProcess : function() {
  50 + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  51 + if (!plotModule)
  52 + return;
  53 +
  54 + if ((this.object.get('id') != '') && (plotModule.linkedNode.get('text') == this.object.get('name')))
  55 + //update existing request
  56 + plotModule.linkedNode.update();
  57 + else
  58 + {
  59 + var me = this;
  60 + //Request Name validation
  61 + plotModule.linkedNode.isValidName(this.object.get('name'), function (res) {
  62 + if (!res)
  63 + {
  64 + myDesktopApp.errorMsg('Error during object validation');
  65 + return;
  66 + }
  67 +
  68 + if (!res.valid)
  69 + {
  70 + if (res.error)
  71 + myDesktopApp.errorMsg(res.error);
  72 + else
  73 + myDesktopApp.errorMsg('Invalid object name');
  74 + return;
  75 + }
  76 +
  77 + //Save
  78 + if (me.object.get('id') != '')
  79 + {
  80 + //Duplicate request
  81 + plotModule.createLinkedNode();
  82 + plotModule.linkedNode.set('object',me.object);
  83 + }
  84 + else
  85 + {
  86 + //Create new request
  87 + }
  88 + plotModule.linkedNode.create();
  89 + });
  90 + }
  91 + },
57 92  
58 93 resetProcess : function(){
59 94 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
... ... @@ -77,15 +112,7 @@ Ext.define('amdaUI.PlotUI', {
77 112 * plot method called by 'Do Plot' button to launch the plot process
78 113 */
79 114 doPlot : function(){
80   - var timeSource = this.timeSelector.getActiveTimeSource();
81   - var multiPlotForm = this.multiPlotIntervalPanel.getForm();
82   - multiPlotForm.updateRecord(this.object);
83   - this.object.set('timesrc', timeSource);
84   - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
85   - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
86   - this.plotTabs.updateTimeObject();
87   -
88   - // fire execution
  115 + this.updateObject();
89 116 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
90 117 if (plotModule)
91 118 plotModule.linkedNode.execute();
... ... @@ -96,13 +123,26 @@ Ext.define('amdaUI.PlotUI', {
96 123 * @return false
97 124 */
98 125 fclose : function() {
99   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) {
  126 + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  127 + if (module)
100 128 module.closeInteractiveSession();
101   - });
102 129  
103   - return false;
  130 + return this.object.isDirty();
104 131 },
105 132  
  133 + /**
  134 + * update this.object from form
  135 + */
  136 + updateObject : function(){
  137 + var timeSource = this.timeSelector.getActiveTimeSource();
  138 + var multiPlotForm = this.multiPlotIntervalPanel.getForm();
  139 + multiPlotForm.updateRecord(this.object);
  140 + this.object.set('timesrc', timeSource);
  141 + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
  142 + this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
  143 + this.plotTabs.updateTimeObject();
  144 + },
  145 +
106 146 addTT : function(newTTName,newTTid)
107 147 {
108 148 this.timeSelector.addTT(newTTName,newTTid);
... ...