Commit dbb7bcbee20c7ee8e3ca26af48b166b63419d070

Authored by Benjamin Renard
1 parent a8c54fb9

Add curves defintion for plot

Add id definition for all plot elements
Add information about element in plot tree
generic_data/Functions/plotCurves.xml 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?xml version="1.0"?>
  2 +<curves>
  3 + <curve id="venus_bowshock" name="Venus Bowshock" functionName="venus_bowshock">
  4 + <params>
  5 + <param name="param1" internal="true" defaultValue="145"/>
  6 + <param name="param2" internal="true" defaultValue="1.35"/>
  7 + <param name="param3" internal="true" defaultValue="1.18"/>
  8 + <param name="param4" internal="true" defaultValue="0.55"/>
  9 + </params>
  10 + </curve>
  11 + <curve id="venus_magnetopause" name="Venus Magnetopause" functionName="venus_magnetopause">
  12 + <params>
  13 + <param name="param1" internal="true" defaultValue="1.07"/>
  14 + <param name="param2" internal="true" defaultValue="-4"/>
  15 + <param name="param3" internal="true" defaultValue="1.5"/>
  16 + <param name="param4" internal="true" defaultValue="3"/>
  17 + </params>
  18 + </curve>
  19 + <curve id="circle" name="Circle" functionName="circle">
  20 + <params>
  21 + <param name="radius" internal="false" defaultValue="1"/>
  22 + </params>
  23 + </curve>
  24 +</curves>
... ...
js/app/models/PlotObjects/PlotConstantObject.js
... ... @@ -15,12 +15,14 @@
15 15  
16 16 Ext.define('amdaPlotObj.PlotConstantObject', {
17 17 extend: 'Ext.data.Model',
  18 + idProperty: 'id',
18 19  
19 20 requires: [
20 21 'amdaPlotObj.PlotObjectConfig'
21 22 ],
22 23  
23 24 fields : [
  25 + {name: 'id', type: 'string'},
24 26 {name: 'constant-axis-id', type: 'string'},
25 27 {name: 'constant-time-value', type: 'date',
26 28 defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1),
... ... @@ -52,6 +54,8 @@ Ext.define(&#39;amdaPlotObj.PlotConstantObject&#39;, {
52 54 {
53 55 var constantValues = new Object();
54 56  
  57 + constantValues['id'] = this.get('id');
  58 +
55 59 constantValues['constant-axis-id'] = this.get('constant-axis-id');
56 60 constantValues['constant-time-value'] = this.get('constant-time-value');
57 61 constantValues['constant-float-value'] = this.get('constant-float-value');
... ...
js/app/models/PlotObjects/PlotCurveDef.js 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotCurveDef.js
  4 + * @plugin amdaPlotObj.PlotCurveDef
  5 + * @extends Ext.data.Model
  6 + * @brief Data model for plot curves definition
  7 + * @author Benjamin
  8 + * @version $Id: PlotCurveDef.js $
  9 + ********************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + *******************************************************************************
  12 + * :
  13 + */
  14 +
  15 +Ext.define('amdaPlotObj.PlotCurveDef', {
  16 + extend: 'Ext.data.Model',
  17 + idProperty: 'id',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotCurveDefParam'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'id', mapping: '@id', type:'string'},
  25 + {name: 'name', mapping: '@name', type: 'string'},
  26 + {name: 'functionName', mapping: '@functionName', type: 'string'}
  27 + ],
  28 +
  29 + hasMany : {
  30 + model : 'amdaPlotObj.PlotCurveDefParam',
  31 + name : 'params'
  32 + },
  33 +
  34 + proxy: {
  35 + type: 'ajax',
  36 + url : 'generic_data/Functions/plotCurves.xml',
  37 + reader: {
  38 + type: 'xml',
  39 + root: 'curves',
  40 + record: 'curve'
  41 + }
  42 + }
  43 +});
0 44 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotCurveDefParam.js 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotCurveDefParam.js
  4 + * @plugin amdaPlotObj.PlotCurveDefParam
  5 + * @extends Ext.data.Model
  6 + * @brief Data model for plot params curve definition
  7 + * @author Benjamin
  8 + * @version $Id: PlotCurveDefParam.js $
  9 + ********************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + *******************************************************************************
  12 + * :
  13 + */
  14 +
  15 +Ext.define('amdaPlotObj.PlotCurveDefParam', {
  16 + extend: 'Ext.data.Model',
  17 +
  18 + fields : [
  19 + {name: 'name', mapping: '@name', type: 'string'},
  20 + {name: 'internal', mapping: '@internal', type: 'boolean'},
  21 + {name: 'defaultValue', mapping: '@defaultValue', type:'float'}
  22 + ],
  23 +
  24 + associations : [
  25 + {
  26 + type : 'belongsTo',
  27 + model : 'amdaPlotObj.PlotCurveDef',
  28 + ownerName : 'curve',
  29 + getterName : 'getCurve'
  30 + }
  31 + ],
  32 +
  33 + proxy: {
  34 + type: 'ajax',
  35 + reader: {
  36 + type: 'xml',
  37 + root: 'params',
  38 + record : 'param'
  39 + }
  40 + }
  41 +});
... ...
js/app/models/PlotObjects/PlotCurveObject.js 0 → 100644
... ... @@ -0,0 +1,139 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotCurveObject.js
  4 + * @class amdaPlotObj.PlotCurveObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Curve Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotCurveObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :03/09/2015: BRE - file creation
  13 + */
  14 +
  15 +Ext.define('amdaPlotObj.PlotCurveObject', {
  16 + extend: 'Ext.data.Model',
  17 + idProperty: 'id',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotCurveDef',
  21 + 'amdaPlotObj.PlotCurveParamObject'
  22 + ],
  23 +
  24 + fields : [
  25 + {name: 'id', type: 'string'},
  26 + {name: 'curve-name', type: 'string'},
  27 + {name: 'curve-serie-id', type: 'string'},
  28 + {name: 'curve-line-style', type: 'string'},
  29 + {name: 'curve-line-width', type: 'float'},
  30 + {name: 'curve-line-color', type: 'string'}
  31 + ],
  32 +
  33 + associations : [
  34 + {
  35 + type : 'hasMany',
  36 + model : 'amdaPlotObj.PlotCurveParamObject',
  37 + name : 'params'
  38 + }
  39 + ],
  40 +
  41 + constructor: function(){
  42 + var me = this;
  43 + me.callParent(arguments);
  44 + if ((arguments.length > 0) && arguments[0])
  45 + {
  46 + if (arguments[0].params)
  47 + me.loadParams(arguments[0].params);
  48 + }
  49 + else
  50 + {
  51 + //new object, set default fields values
  52 + me.setDefaultValues();
  53 + }
  54 + },
  55 +
  56 + getCurvesDefStore: function(onCurvesDefGet)
  57 + {
  58 + var curvesDefStore = Ext.data.StoreManager.lookup('curvesDefStore');
  59 +
  60 + if (!curvesDefStore)
  61 + {
  62 + curvesDefStore = Ext.create('Ext.data.Store', {
  63 + model: 'amdaPlotObj.PlotCurveDef',
  64 + storeId: 'curvesDefStore'
  65 + });
  66 +
  67 + curvesDefStore.load({
  68 + scope: this,
  69 + callback: function(records, operation, success) {
  70 + if (onCurvesDefGet != null)
  71 + onCurvesDefGet(curvesDefStore);
  72 + }
  73 + });
  74 + }
  75 + else
  76 + {
  77 + if (onCurvesDefGet != null)
  78 + onCurvesDefGet(curvesDefStore);
  79 + }
  80 + },
  81 +
  82 + setCurveName: function(curveName, onReady)
  83 + {
  84 + this.set('curve-name', curveName);
  85 +
  86 + var me = this;
  87 + this.getCurvesDefStore(function (curvesDefStore) {
  88 + me.params().removeAll();
  89 + curvesDefStore.each(function(curveDef) {
  90 + if (curveDef.get('id') == curveName)
  91 + {
  92 + curveDef.params().each(function (paramDef) {
  93 + me.params().add({
  94 + 'curve-param-name' : paramDef.get('name'),
  95 + 'curve-param-internal' : paramDef.get('internal'),
  96 + 'curve-param-value' : paramDef.get('defaultValue')});
  97 + });
  98 + }
  99 + });
  100 + if (onReady != null)
  101 + onReady(me);
  102 + });
  103 + },
  104 +
  105 + loadParams: function(params)
  106 + {
  107 + this.params().loadData(params);
  108 + },
  109 +
  110 + setDefaultValues: function()
  111 + {
  112 + this.set('curve-name', '');
  113 + this.set('curve-serie-id', '');
  114 + this.set('curve-line-style', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.style);
  115 + this.set('curve-line-width', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.width);
  116 + this.set('curve-line-color', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.color);
  117 + },
  118 +
  119 + getJsonValues : function()
  120 + {
  121 + var curveValues = new Object();
  122 +
  123 + curveValues['id'] = this.get('id');
  124 +
  125 + curveValues['curve-name'] = this.get('curve-name');
  126 + curveValues['curve-serie-id'] = this.get('curve-serie-id');
  127 + curveValues['curve-line-style'] = this.get('curve-line-style');
  128 + curveValues['curve-line-width'] = this.get('curve-line-width');
  129 + curveValues['curve-line-color'] = this.get('curve-line-color');
  130 +
  131 + curveValues['params'] = [];
  132 +
  133 + this.params().each(function (param, index) {
  134 + curveValues['params'][index] = param.getJsonValues();
  135 + });
  136 +
  137 + return curveValues;
  138 + }
  139 +});
0 140 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotCurveParamObject.js 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotCurveParamObject.js
  4 + * @class amdaPlotObj.PlotCurveParamObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Curve Param Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotCurveParamObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :03/09/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotCurveParamObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'curve-param-name', type: 'string'},
  25 + {name: 'curve-param-internal', type: 'boolean'},
  26 + {name: 'curve-param-value', type: 'float'}
  27 + ],
  28 +
  29 + setDefaultValues: function()
  30 + {
  31 + this.set('curve-param-name', '');
  32 + this.set('curve-param-internal', false);
  33 + this.set('curve-param-value', 0.);
  34 + },
  35 +
  36 + getJsonValues : function()
  37 + {
  38 + var paramValues = new Object();
  39 +
  40 + paramValues['curve-param-name'] = this.get('curve-param-name');
  41 + paramValues['curve-param-internal'] = this.get('curve-param-internal');
  42 + paramValues['curve-param-value'] = this.get('curve-param-value');
  43 +
  44 + return paramValues;
  45 + }
  46 +});
... ...
js/app/models/PlotObjects/PlotLegendTextObject.js
... ... @@ -15,12 +15,14 @@
15 15  
16 16 Ext.define('amdaPlotObj.PlotLegendTextObject', {
17 17 extend: 'Ext.data.Model',
  18 + idProperty: 'id',
18 19  
19 20 requires: [
20 21 'amdaPlotObj.PlotObjectConfig'
21 22 ],
22 23  
23 24 fields : [
  25 + {name: 'id', type: 'string'},
24 26 {name: 'legend-text-value', type: 'string'},
25 27 {name: 'legend-text-position', type: 'string'},
26 28 {name: 'legend-text-color', type: 'string'},
... ... @@ -47,6 +49,7 @@ Ext.define(&#39;amdaPlotObj.PlotLegendTextObject&#39;, {
47 49 {
48 50 var legendValues = new Object();
49 51  
  52 + legendValues['id'] = this.get('id');
50 53 legendValues['legend-text-value'] = this.get('legend-text-value');
51 54 legendValues['legend-text-position'] = this.get('legend-text-position');
52 55 legendValues['legend-text-color'] = this.get('legend-text-color');
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -159,9 +159,29 @@ Ext.define(&#39;amdaPlotObj.PlotObjectConfig&#39;, {
159 159 name : 'sans-serif',
160 160 size: '12'
161 161 }
  162 + },
  163 + curves : {
  164 + line : {
  165 + style : 'plain',
  166 + width : 1,
  167 + color : '#000000'
  168 + }
162 169 }
163 170 },
164 171  
  172 + getValueByKey : function(dataList, key)
  173 + {
  174 + var value = '';
  175 + Ext.each(dataList, function (data) {
  176 + if (data.key == key)
  177 + {
  178 + value = data.value;
  179 + return;
  180 + }
  181 + });
  182 + return value;
  183 + },
  184 +
165 185 availableFileFormats : [
166 186 {'key' : 'PNG', 'value' : 'PNG'},
167 187 {'key' : 'PDF', 'value' : 'PDF'},
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -15,10 +15,7 @@
15 15  
16 16 Ext.define('amdaPlotObj.PlotPanelObject', {
17 17 extend: 'Ext.data.Model',
18   -
19   - lastParamId : 0,
20   - lastTextLegendId : 0,
21   - lastConstantId : 0,
  18 + idProperty: 'id',
22 19  
23 20 requires: [
24 21 'amdaPlotObj.PlotObjectConfig',
... ... @@ -27,7 +24,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
27 24 'amdaPlotObj.PlotLegendSeriesObject',
28 25 'amdaPlotObj.PlotLegendTextObject',
29 26 'amdaPlotObj.PlotConstantObject',
30   - 'amdaPlotObj.PlotTextObject'
  27 + 'amdaPlotObj.PlotTextObject',
  28 + 'amdaPlotObj.PlotCurveObject'
31 29 ],
32 30  
33 31 fields : [
... ... @@ -80,7 +78,13 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
80 78 }
81 79 },
82 80 //Only used for timePlot, xyPlot, epochPlot and instantPlot
83   - {name: 'panel-legend-series', type: 'auto', defaultValue: null}
  81 + {name: 'panel-legend-series', type: 'auto', defaultValue: null},
  82 +
  83 + {name: 'last-param-id', type: 'int', defaultValue:0},
  84 + {name: 'last-textlegend-id', type: 'int', defaultValue:0},
  85 + {name: 'last-constant-id', type: 'int', defaultValue:0},
  86 + {name: 'last-textobj-id', type: 'int', defaultValue:0},
  87 + {name: 'last-curve-id', type: 'int', defaultValue:0}
84 88 ],
85 89  
86 90 associations : [
... ... @@ -110,6 +114,11 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
110 114 name : 'textObjs'
111 115 },
112 116 {
  117 + type : 'hasMany',
  118 + model : 'amdaPlotObj.PlotCurveObject',
  119 + name : 'curves'
  120 + },
  121 + {
113 122 type : 'belongsTo',
114 123 model : 'amdaPlotObj.PlotTabObject'
115 124 }
... ... @@ -130,6 +139,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
130 139 me.loadConstants(arguments[0].constants);
131 140 if (arguments[0].textObjs)
132 141 me.loadTextObjs(arguments[0].textObjs);
  142 + if (arguments[0].curves)
  143 + me.loadCurves(arguments[0].curves);
133 144 }
134 145 else
135 146 {
... ... @@ -163,6 +174,11 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
163 174 this.textObjs().loadData(textObjs);
164 175 },
165 176  
  177 + loadCurves: function(curves)
  178 + {
  179 + this.curves().loadData(curves);
  180 + },
  181 +
166 182 initAxes : function()
167 183 {
168 184 this.axes().removeAll();
... ... @@ -231,8 +247,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
231 247 },
232 248  
233 249 createNewParam: function() {
234   - var recs = this.params().add({id : this.get('id')+'-param-'+this.lastParamId});
235   - ++this.lastParamId;
  250 + this.set('last-param-id', this.get('last-param-id') + 1);
  251 + var recs = this.params().add({id : this.get('id')+'-param-'+this.get('last-param-id')});
236 252 var availableDrawingObjects = recs[0].getAvailableDrawingObjectByPlotType(this.get('panel-plot-type'));
237 253 recs[0].updateDrawingType(availableDrawingObjects[0].key, true);
238 254 return recs[0];
... ... @@ -248,8 +264,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
248 264 },
249 265  
250 266 createNewTextLegend: function() {
251   - var recs = this.textLegends().add({id : this.get('id')+'-legend-text-'+this.lastTextLegendId});
252   - ++this.lastTextLegendId;
  267 + this.set('last-textlegend-id', this.get('last-textlegend-id') + 1);
  268 + var recs = this.textLegends().add({id : this.get('id')+'-legend-text-'+this.get('last-textlegend-id')});
253 269 recs[0].setDefaultValues();
254 270 return recs[0];
255 271 },
... ... @@ -264,8 +280,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
264 280 },
265 281  
266 282 createNewConstant: function() {
267   - var recs = this.constants().add({id : this.get('id')+'-constant-'+this.lastConstantId});
268   - ++this.lastConstantId;
  283 + this.set('last-constant-id', this.get('last-constant-id') + 1);
  284 + var recs = this.constants().add({id : this.get('id')+'-constant-'+this.get('last-constant-id')});
269 285 recs[0].setDefaultValues();
270 286 return recs[0];
271 287 },
... ... @@ -280,8 +296,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
280 296 },
281 297  
282 298 createNewTextObject: function() {
283   - var recs = this.textObjs().add({id : this.get('id')+'-text-object-'+this.lastTextObjectId});
284   - ++this.lastTextObjectId;
  299 + this.set('last-textobj-id', this.get('last-textobj-id') + 1);
  300 + var recs = this.textObjs().add({id : this.get('id')+'-text-object-'+this.get('last-textobj-id')});
285 301 recs[0].setDefaultValues();
286 302 return recs[0];
287 303 },
... ... @@ -295,6 +311,22 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
295 311 return true;
296 312 },
297 313  
  314 + createNewCurve: function() {
  315 + this.set('last-curve-id', this.get('last-curve-id') + 1);
  316 + var recs = this.curves().add({id : this.get('id')+'-curve-'+this.get('last-curve-id')});
  317 + recs[0].setDefaultValues();
  318 + return recs[0];
  319 + },
  320 +
  321 + removeCurveById: function(curveId) {
  322 + //Retrieve curve record
  323 + var curveRecord = this.curves().getById(curveId);
  324 + if (curveRecord == null)
  325 + return false;
  326 + this.curves().remove(curveRecord);
  327 + return true;
  328 + },
  329 +
298 330 updatePlotType: function(plotType, forceUpdate) {
299 331 forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false;
300 332  
... ... @@ -380,6 +412,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
380 412 {
381 413 var panelValues = new Object();
382 414  
  415 + panelValues['id'] = this.get('id');
  416 +
383 417 panelValues['panel-background-color'] = this.get('panel-background-color');
384 418 panelValues['panel-title-text'] = this.get('panel-title-text');
385 419 panelValues['panel-title-color'] = this.get('panel-title-color');
... ... @@ -449,6 +483,12 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
449 483 panelValues['textObjs'][index] = textObj.getJsonValues();
450 484 });
451 485  
  486 + panelValues['curves'] = [];
  487 +
  488 + this.curves().each(function (curve, index) {
  489 + panelValues['curves'][index] = curve.getJsonValues();
  490 + });
  491 +
452 492 panelValues['axes'] = [];
453 493  
454 494 this.axes().each(function (axe, index) {
... ... @@ -461,6 +501,12 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
461 501 panelValues['params'][index] = param.getJsonValues();
462 502 });
463 503  
  504 + panelValues['last-param-id'] = this.get('last-param-id');
  505 + panelValues['last-textlegend-id'] = this.get('last-textlegend-id');
  506 + panelValues['last-constant-id'] = this.get('last-constant-id');
  507 + panelValues['last-textobj-id'] = this.get('last-textobj-id');
  508 + panelValues['last-curve-id'] = this.get('last-curve-id');
  509 +
464 510 return panelValues;
465 511 }
466 512 });
467 513 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotParamObject.js
... ... @@ -15,6 +15,7 @@
15 15  
16 16 Ext.define('amdaPlotObj.PlotParamObject', {
17 17 extend: 'Ext.data.Model',
  18 + idProperty: 'id',
18 19  
19 20 requires: [
20 21 'amdaPlotObj.PlotObjectConfig',
... ... @@ -143,6 +144,8 @@ Ext.define(&#39;amdaPlotObj.PlotParamObject&#39;, {
143 144 {
144 145 var paramValues = new Object();
145 146  
  147 + paramValues['id'] = this.get('id');
  148 +
146 149 paramValues['param-id'] = this.get('param-id');
147 150 paramValues['param-drawing-type'] = this.get('param-drawing-type');
148 151  
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -29,7 +29,8 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
29 29 {name: 'file-format', type: 'string'},
30 30 {name: 'file-output', type: 'string'},
31 31 {name: 'file-prefix', type: 'string'},
32   - {name: 'one-file-per-interval', type: 'boolean'}
  32 + {name: 'one-file-per-interval', type: 'boolean'},
  33 + {name: 'last-tab-id', type: 'int', defaultValue: 0}
33 34 ],
34 35  
35 36 hasMany: {
... ... @@ -70,14 +71,19 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
70 71 },
71 72  
72 73 createNewTab: function() {
73   - var recs = this.tabs().add({id : this.lastTabId});
74   - ++this.lastTabId;
  74 + this.set('last-tab-id', this.get('last-tab-id') + 1);
  75 + var recs = this.tabs().add({id : this.get('last-tab-id')});
75 76 recs[0].setDefaultValues();
76 77 return recs[0];
77 78 },
78 79  
79   - removeTab: function(tabId) {
80   - var tabToRemove = this.tabs().get(tabId);
  80 + removeTabById: function(tabId) {
  81 + //Retrieve tab record
  82 + var tabRecord = this.tabs().getById(tabId);
  83 + if (tabRecord == null)
  84 + return false;
  85 + this.tabs().remove(tabRecord);
  86 + return true;
81 87 },
82 88  
83 89 getJsonValues : function(hasId)
... ... @@ -92,6 +98,7 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
92 98  
93 99 requestValues['leaf'] = true;
94 100  
  101 + requestValues['last-tab-id'] = this.get('last-tab-id');
95 102 requestValues['file-format'] = this.get('file-format');
96 103 requestValues['file-output'] = this.get('file-output');
97 104 requestValues['file-prefix'] = this.get('file-prefix');
... ...
js/app/models/PlotObjects/PlotTabObject.js
... ... @@ -17,8 +17,6 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
17 17 extend: 'Ext.data.Model',
18 18 idProperty: 'id',
19 19  
20   - lastPanelId : 0,
21   -
22 20 requires: [
23 21 'amdaPlotObj.PlotObjectConfig',
24 22 'amdaPlotObj.PlotPanelObject',
... ... @@ -51,7 +49,8 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
51 49 {name: 'page-font-bold', type: 'boolean'},
52 50 {name: 'page-font-italic', type: 'boolean'},
53 51 {name: 'page-layout-type', type: 'string'},
54   - {name: 'page-layout-object', type: 'auto', defaultValue: null}
  52 + {name: 'page-layout-object', type: 'auto', defaultValue: null},
  53 + {name: 'last-panel-id', type: 'int', defaultValue: 0}
55 54 ],
56 55  
57 56 associations : [
... ... @@ -100,8 +99,8 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
100 99 },
101 100  
102 101 createNewPanel: function() {
103   - var recs = this.panels().add({id : this.lastPanelId});
104   - ++this.lastPanelId;
  102 + this.set('last-panel-id', this.get('last-panel-id') + 1);
  103 + var recs = this.panels().add({id : this.get('last-panel-id')});
105 104 recs[0].setDefaultValues();
106 105 return recs[0];
107 106 },
... ... @@ -179,6 +178,7 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
179 178 {
180 179 var tabValues = new Object();
181 180  
  181 + tabValues['id'] = this.get('id');
182 182 tabValues['page-title-text'] = this.get('page-title-text');
183 183 tabValues['page-title-color'] = this.get('page-title-color');
184 184 tabValues['page-title-position'] = this.get('page-title-position');
... ... @@ -211,6 +211,8 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
211 211 tabValues['panels'][index] = panel.getJsonValues();
212 212 });
213 213  
  214 + tabValues['last-panel-id'] = this.get('last-panel-id');
  215 +
214 216 return tabValues;
215 217 }
216 218 });
217 219 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotTextObject.js
... ... @@ -15,12 +15,14 @@
15 15  
16 16 Ext.define('amdaPlotObj.PlotTextObject', {
17 17 extend: 'Ext.data.Model',
  18 + idProperty: 'id',
18 19  
19 20 requires: [
20 21 'amdaPlotObj.PlotObjectConfig'
21 22 ],
22 23  
23 24 fields : [
  25 + {name: 'id', type: 'string'},
24 26 {name: 'text-value', type: 'string'},
25 27 {name: 'text-y-axis', type: 'string'},
26 28 {name: 'text-x-relative', type: 'boolean'},
... ... @@ -70,6 +72,8 @@ Ext.define(&#39;amdaPlotObj.PlotTextObject&#39;, {
70 72 {
71 73 var textValues = new Object();
72 74  
  75 + textValues['id'] = this.get('id');
  76 +
73 77 textValues['text-value'] = this.get('text-value');
74 78 textValues['text-y-axis'] = this.get('text-y-axis');
75 79 textValues['text-x-relative'] = this.get('text-x-relative');
... ...
js/app/models/PlotObjects/PlotTreeNode.js
... ... @@ -15,6 +15,10 @@
15 15 Ext.define('amdaPlotObj.PlotTreeNode', {
16 16 extend: 'Ext.data.Model',
17 17  
  18 + requires: [
  19 + 'amdaPlotObj.PlotObjectConfig'
  20 + ],
  21 +
18 22 //Node type
19 23 type: '',
20 24  
... ... @@ -66,9 +70,12 @@ Ext.define(&#39;amdaPlotObj.PlotPageTreeNode&#39;, {
66 70  
67 71 getAdditionalText: function()
68 72 {
69   - var addText = ' ('+this.object.get('page-dimension')+', '+this.object.get('page-orientation');
  73 + var dimension = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageDimensions, this.object.get('page-dimension'));
  74 + var orientation = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageOrientations, this.object.get('page-orientation'));
  75 +
  76 + var addText = ' ('+dimension+', '+orientation;
70 77 if (this.object.get('page-superpose-mode'))
71   - addText += ', superpose';
  78 + addText += ', Epoch superposed mode';
72 79 addText += ')';
73 80 return addText;
74 81 }
... ... @@ -87,7 +94,8 @@ Ext.define(&#39;amdaPlotObj.PlotLayoutTreeNode&#39;, {
87 94  
88 95 getAdditionalText: function()
89 96 {
90   - return ' ('+this.object.get('page-layout-type')+')';
  97 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageLayouts, this.object.get('page-layout-type'));
  98 + return ' ('+type+')';
91 99 }
92 100 });
93 101  
... ... @@ -114,7 +122,22 @@ Ext.define(&#39;amdaPlotObj.PlotPanelTreeNode&#39;, {
114 122  
115 123 getAdditionalText: function()
116 124 {
117   - var addText = ' ('+this.object.get('panel-plot-type')+')';
  125 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePlotTypes, this.object.get('panel-plot-type'));
  126 + var addText = ' (Id = '+this.object.get('id')+', '+type;
  127 + switch (this.object.get('panel-plot-type'))
  128 + {
  129 + case 'instantPlot' :
  130 + addText += (', '+Ext.Date.format(this.object.get('panel-instant-time'), "Y/m/d H:i:s"));
  131 + break;
  132 + case 'epochPlot' :
  133 + addText += (', '+this.object.get('panel-epoch-centertimeid'));
  134 + break;
  135 + case 'xyPlot' :
  136 + if (this.object.get('panel-scatter-isotropic'))
  137 + addText += ', Isotropic';
  138 + break;
  139 + }
  140 + addText += ')';
118 141 return addText;
119 142 }
120 143 });
... ... @@ -228,7 +251,39 @@ Ext.define(&#39;amdaPlotObj.PlotParamTreeNode&#39;, {
228 251  
229 252 getAdditionalText: function()
230 253 {
231   - return this.object.get('param-id')+' ('+this.object.get('param-drawing-type')+')';
  254 + var parentNode = this.parentNode;
  255 + var plotType = parentNode.object.get('panel-plot-type');
  256 + var availableDrawingObjects = this.object.getAvailableDrawingObjectByPlotType(plotType);
  257 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(availableDrawingObjects, this.object.get('param-drawing-type'));
  258 +
  259 + var addText = '';
  260 + switch (plotType)
  261 + {
  262 + case 'xyPlot' :
  263 + addText = this.object.get('param-id')+' = f('+this.object.get('param-drawing-object').get('serie-xaxis-param')+', t)';
  264 + break;
  265 + case 'instantPlot' :
  266 + addText = this.object.get('param-id');
  267 + break;
  268 + default :
  269 + addText = this.object.get('param-id')+' = f(t)';
  270 + }
  271 +
  272 + addText += ', '+type;
  273 +
  274 + switch (this.object.get('param-drawing-type'))
  275 + {
  276 + case 'serie' :
  277 + var yAxis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableYAxes, this.object.get('param-drawing-object').get('serie-yaxis'));
  278 + addText += ', Y '+yAxis;
  279 + break;
  280 + case 'spectro' :
  281 + var yAxis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableYAxes, this.object.get('param-drawing-object').get('spectro-yaxis'));
  282 + addText += ', Y '+yAxis;
  283 + break;
  284 + }
  285 +
  286 + return addText;
232 287 }
233 288 });
234 289  
... ... @@ -263,7 +318,18 @@ Ext.define(&#39;amdaPlotObj.PlotSeriesLegendTreeNode&#39;, {
263 318  
264 319 text: 'Series Legend',
265 320  
266   - type: 'series-legend'
  321 + type: 'series-legend',
  322 +
  323 + getAdditionalText: function()
  324 + {
  325 + var addText = ' (';
  326 + if (this.object.get('panel-legend-series').get('legend-series-activated'))
  327 + addText += 'Activated';
  328 + else
  329 + addText += 'Deactivated';
  330 + addText += ')'
  331 + return addText;
  332 + }
267 333 });
268 334  
269 335 Ext.define('amdaPlotObj.PlotTextLegendsTreeNode', {
... ... @@ -287,7 +353,14 @@ Ext.define(&#39;amdaPlotObj.PlotTextLegendTreeNode&#39;, {
287 353  
288 354 type: 'text-legend',
289 355  
290   - removable: true
  356 + removable: true,
  357 +
  358 + getAdditionalText: function()
  359 + {
  360 + var position = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableLegendTextPositions, this.object.get('legend-text-position'));
  361 + var addText = ' ('+position+')';
  362 + return addText;
  363 + }
291 364 });
292 365  
293 366 Ext.define('amdaPlotObj.PlotDrawingObjectsTreeNode', {
... ... @@ -311,7 +384,14 @@ Ext.define(&#39;amdaPlotObj.PlotConstantTreeNode&#39;, {
311 384  
312 385 type: 'constant',
313 386  
314   - removable: true
  387 + removable: true,
  388 +
  389 + getAdditionalText: function()
  390 + {
  391 + var axis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableConstantAxes, this.object.get('constant-axis-id'));
  392 + var addText = ' ('+axis+')';
  393 + return addText;
  394 + }
315 395 });
316 396  
317 397 Ext.define('amdaPlotObj.PlotTextTreeNode', {
... ... @@ -327,3 +407,17 @@ Ext.define(&#39;amdaPlotObj.PlotTextTreeNode&#39;, {
327 407  
328 408 removable: true
329 409 });
  410 +
  411 +Ext.define('amdaPlotObj.PlotCurveTreeNode', {
  412 + extend: 'amdaPlotObj.PlotTreeNode',
  413 +
  414 + leaf: true,
  415 +
  416 + iconCls: 'icon-plot-add-drawing-curve',
  417 +
  418 + text: 'Curve',
  419 +
  420 + type: 'curve',
  421 +
  422 + removable: true
  423 +});
... ...
js/app/views/PlotComponents/PlotConstantForm.js
... ... @@ -30,6 +30,7 @@ Ext.define(&#39;amdaPlotComp.PlotConstantForm&#39;, {
30 30 return [
31 31 this.addStandardCombo('constant-axis-id', 'Axis attachment', amdaPlotObj.PlotObjectConfig.availableConstantAxes, function (name, value, oldValue) {
32 32 me.updateOptions(value, me.crtTree.getSelectedPlotType());
  33 + me.crtTree.getView().refresh();
33 34 }),
34 35 this.addStandardDate('constant-time-value', 'Value'),
35 36 this.addStandardText('constant-float-value', 'Value'),
... ...
js/app/views/PlotComponents/PlotCurveForm.js 0 → 100644
... ... @@ -0,0 +1,132 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotCurveForm.js
  4 + * @class amdaPlotComp.PlotCurveForm
  5 + * @extends amdaPlotComp.PlotStandardForm
  6 + * @brief Form to define specifics curve options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotCurveForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotCurveForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + requires: [
  15 + 'amdaPlotObj.PlotCurveDef'
  16 + ],
  17 +
  18 + curveParamsContainer : null,
  19 +
  20 + setObject : function(object) {
  21 + this.object = object;
  22 + if (this.object != null)
  23 + {
  24 + this.loadRecord(this.object);
  25 + this.updateParamsContainer();
  26 + this.updateSerieIdList();
  27 + }
  28 + },
  29 +
  30 + updateParamsContainer: function() {
  31 + if (this.curveParamsContainer == null)
  32 + return;
  33 +
  34 + var curveNameField = this.getForm().findField('curve-name');
  35 +
  36 + this.curveParamsContainer.removeAll();
  37 +
  38 + if (curveNameField.getValue() == '')
  39 + return;
  40 +
  41 + var me = this;
  42 + this.object.params().each(function (param) {
  43 + if (param.get('curve-param-internal'))
  44 + return;
  45 +
  46 + var newParamField = Ext.create('Ext.form.field.Number', {
  47 + name: param.get('curve-param-name'),
  48 + fieldLabel: param.get('curve-param-name'),
  49 + decimalPrecision : 3,
  50 + value: param.get('curve-param-value'),
  51 + listeners: {
  52 + change: function(field, newValue, oldValue, eOpts) {
  53 + param.set(param.get('curve-param-name'), newValue);
  54 + },
  55 + scope: me
  56 + }
  57 + });
  58 + me.curveParamsContainer.add(newParamField);
  59 + });
  60 + },
  61 +
  62 + updateCurveList: function(onReady) {
  63 + var curvesDefStore = Ext.data.StoreManager.lookup('curvesDefStore');
  64 +
  65 + var curveNameField = this.getForm().findField('curve-name');
  66 +
  67 + if (!curvesDefStore)
  68 + {
  69 + curvesDefStore = Ext.create('Ext.data.Store', {
  70 + model: 'amdaPlotObj.PlotCurveDef',
  71 + storeId: 'curvesDefStore'
  72 + });
  73 +
  74 + curveNameField.getStore().removeAll();
  75 + curvesDefStore.load({
  76 + scope: this,
  77 + callback: function(records, operation, success) {
  78 + curvesDefStore.each(function (curveDef) {
  79 + curveNameField.getStore().add({key : curveDef.get('id'), value : curveDef.get('name')});
  80 + });
  81 + if (onReady != null)
  82 + onReady();
  83 + }
  84 + });
  85 + }
  86 + else
  87 + {
  88 + curveNameField.getStore().removeAll();
  89 + curvesDefStore.each(function (curveDef) {
  90 + curveNameField.getStore().add({key : curveDef.get('id'), value : curveDef.get('name')});
  91 + });
  92 + if (onReady != null)
  93 + onReady();
  94 + }
  95 + },
  96 +
  97 + updateSerieIdList: function() {
  98 + var attachedSerieField = this.getForm().findField('curve-serie-id');
  99 + attachedSerieField.getStore().removeAll();
  100 +
  101 + var panelObject = this.crtTree.getSelectedPanelObject();
  102 + if (panelObject == null)
  103 + return;
  104 +
  105 + panelObject.params().each(function(paramObject) {
  106 + var drawingType = paramObject.get('param-drawing-type');
  107 + if ((drawingType == 'serie') || (drawingType == 'orbit-serie'))
  108 + {
  109 + attachedSerieField.getStore().add({key : paramObject.get('id'), value : paramObject.get('id')});
  110 + }
  111 + });
  112 + },
  113 +
  114 + getFormItems: function() {
  115 + var me = this;
  116 +
  117 + this.curveParamsContainer = Ext.create('Ext.container.Container', {
  118 + layout: 'fit'
  119 + });
  120 +
  121 + return [
  122 + this.addStandardCombo('curve-name', 'Curve name', [], function(name, value, oldValue) {
  123 + me.object.setCurveName(value, function (){
  124 + me.updateParamsContainer();
  125 + });
  126 + }),
  127 + this.addStandardCombo('curve-serie-id', 'Attached serie', []),
  128 + this.addStandardFieldSet('Lines', '', this.addStandardLineItems('curve-line')),
  129 + this.curveParamsContainer
  130 + ];
  131 + }
  132 +});
0 133 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotDrawingObjectForm.js
... ... @@ -37,6 +37,15 @@ Ext.define(&#39;amdaPlotComp.PlotDrawingObjectForm&#39;, {
37 37 var textObject = me.object.createNewTextObject();
38 38 me.crtTree.buildPanelAdditionalObjectsNode(me.object, textObject.get('id'));
39 39 }
  40 + },
  41 + {
  42 + xtype: 'button',
  43 + text: 'Add new curve',
  44 + iconCls: 'icon-add',
  45 + handler : function() {
  46 + var curveObject = me.object.createNewCurve();
  47 + me.crtTree.buildPanelAdditionalObjectsNode(me.object, curveObject.get('id'));
  48 + }
40 49 }
41 50 ];
42 51 }
... ...
js/app/views/PlotComponents/PlotElementPanel.js
... ... @@ -25,7 +25,8 @@ Ext.define(&#39;amdaPlotComp.PlotElementPanel&#39;, {
25 25 'amdaPlotComp.PlotLegendsTextForm',
26 26 'amdaPlotComp.PlotDrawingObjectForm',
27 27 'amdaPlotComp.PlotConstantForm',
28   - 'amdaPlotComp.PlotTextForm'
  28 + 'amdaPlotComp.PlotTextForm',
  29 + 'amdaPlotComp.PlotCurveForm'
29 30 ],
30 31  
31 32 elementFormsManager : new Ext.AbstractManager(),
... ... @@ -42,25 +43,30 @@ Ext.define(&#39;amdaPlotComp.PlotElementPanel&#39;, {
42 43  
43 44 this.crtTree = tree;
44 45  
45   - var elementForm = this.getElementForm(type);
46   -
47   - this.add(elementForm);
48   - elementForm.crtTree = tree;
49   - if (elementForm.setObject)
50   - elementForm.setObject(object);
  46 + var me =this;
  47 + this.getElementForm(type, function (elementForm) {
  48 + me.add(elementForm);
  49 + elementForm.crtTree = tree;
  50 + if (elementForm.setObject)
  51 + elementForm.setObject(object);
  52 + });
51 53 },
52 54  
53 55 resetElement: function() {
54 56 this.setElement('',null,null);
55 57 },
56 58  
57   - getElementForm: function(type) {
  59 + getElementForm: function(type, onFormReady) {
58 60 var formId = type;
59 61 if (type == '')
60 62 formId = 'none';
61 63  
62 64 formId += '-element-form';
  65 +
  66 + if (this.rendered)
  67 + this.getEl().mask();
63 68  
  69 + var me = this;
64 70 if (!this.elementFormsManager.get(formId))
65 71 {
66 72 //Create element form
... ... @@ -68,57 +74,136 @@ Ext.define(&#39;amdaPlotComp.PlotElementPanel&#39;, {
68 74 {
69 75 case 'page' :
70 76 this.elementFormsManager.register(new amdaPlotComp.PlotPageForm({id : formId}));
  77 + if (onFormReady != null)
  78 + onFormReady(this.elementFormsManager.get(formId));
  79 + if (this.rendered)
  80 + this.getEl().unmask();
71 81 break;
72 82 case 'panel' :
73 83 this.elementFormsManager.register(new amdaPlotComp.PlotPanelForm({id : formId}));
  84 + if (onFormReady != null)
  85 + onFormReady(this.elementFormsManager.get(formId));
  86 + if (this.rendered)
  87 + this.getEl().unmask();
74 88 break;
75 89 case 'time-axis' :
76 90 this.elementFormsManager.register(new amdaPlotComp.PlotTimeAxisForm({id : formId}));
  91 + if (onFormReady != null)
  92 + onFormReady(this.elementFormsManager.get(formId));
  93 + if (this.rendered)
  94 + this.getEl().unmask();
77 95 break;
78 96 case 'epoch-axis' :
79 97 this.elementFormsManager.register(new amdaPlotComp.PlotEpochAxisForm({id : formId}));
  98 + if (onFormReady != null)
  99 + onFormReady(this.elementFormsManager.get(formId));
  100 + if (this.rendered)
  101 + this.getEl().unmask();
80 102 break;
81 103 case 'color-axis' :
82 104 this.elementFormsManager.register(new amdaPlotComp.PlotColorAxisForm({id : formId}));
  105 + if (onFormReady != null)
  106 + onFormReady(this.elementFormsManager.get(formId));
  107 + if (this.rendered)
  108 + this.getEl().unmask();
83 109 break;
84 110 case 'x-axis' :
85 111 case 'y-left-axis' :
86 112 case 'y-right-axis' :
87 113 this.elementFormsManager.register(new amdaPlotComp.PlotBaseAxisForm({id : formId}));
  114 + if (onFormReady != null)
  115 + onFormReady(this.elementFormsManager.get(formId));
  116 + if (this.rendered)
  117 + this.getEl().unmask();
88 118 break;
89 119 case 'param' :
90 120 this.elementFormsManager.register(new amdaPlotComp.PlotParamForm({id : formId}));
  121 + if (onFormReady != null)
  122 + onFormReady(this.elementFormsManager.get(formId));
  123 + if (this.rendered)
  124 + this.getEl().unmask();
91 125 break;
92 126 case 'layout' :
93 127 this.elementFormsManager.register(new amdaPlotComp.PlotLayoutForm({id : formId}));
  128 + if (onFormReady != null)
  129 + onFormReady(this.elementFormsManager.get(formId));
  130 + if (this.rendered)
  131 + this.getEl().unmask();
94 132 break;
95 133 case 'series-legend' :
96 134 this.elementFormsManager.register(new amdaPlotComp.PlotLegendSeriesForm({id : formId}));
  135 + if (onFormReady != null)
  136 + onFormReady(this.elementFormsManager.get(formId));
  137 + if (this.rendered)
  138 + this.getEl().unmask();
97 139 break;
98 140 case 'text-legend' :
99 141 this.elementFormsManager.register(new amdaPlotComp.PlotLegendTextForm({id : formId}));
  142 + if (onFormReady != null)
  143 + onFormReady(this.elementFormsManager.get(formId));
  144 + if (this.rendered)
  145 + this.getEl().unmask();
100 146 break;
101 147 case 'text-legends' :
102 148 this.elementFormsManager.register(new amdaPlotComp.PlotLegendsTextForm({id : formId}));
  149 + if (onFormReady != null)
  150 + onFormReady(this.elementFormsManager.get(formId));
  151 + if (this.rendered)
  152 + this.getEl().unmask();
103 153 break;
104 154 case 'drawing-objects' :
105 155 this.elementFormsManager.register(new amdaPlotComp.PlotDrawingObjectForm({id : formId}));
  156 + if (onFormReady != null)
  157 + onFormReady(this.elementFormsManager.get(formId));
  158 + if (this.rendered)
  159 + this.getEl().unmask();
106 160 break;
107 161 case 'constant' :
108 162 this.elementFormsManager.register(new amdaPlotComp.PlotConstantForm({id : formId}));
  163 + if (onFormReady != null)
  164 + onFormReady(this.elementFormsManager.get(formId));
  165 + if (this.rendered)
  166 + this.getEl().unmask();
109 167 break;
110 168 case 'text-obj' :
111 169 this.elementFormsManager.register(new amdaPlotComp.PlotTextForm({id : formId}));
  170 + if (onFormReady != null)
  171 + onFormReady(this.elementFormsManager.get(formId));
  172 + if (this.rendered)
  173 + this.getEl().unmask();
  174 + break;
  175 + case 'curve' :
  176 + var curveForm = new amdaPlotComp.PlotCurveForm({id : formId});
  177 + this.elementFormsManager.register(curveForm);
  178 + curveForm.updateCurveList(function () {
  179 + if (onFormReady != null)
  180 + onFormReady(me.elementFormsManager.get(formId));
  181 + if (me.rendered)
  182 + me.getEl().unmask();
  183 + });
112 184 break;
113 185 case '' :
114 186 this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'}));
  187 + if (onFormReady != null)
  188 + onFormReady(this.elementFormsManager.get(formId));
  189 + if (this.rendered)
  190 + this.getEl().unmask();
115 191 break;
116 192 default :
117 193 this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this element'}));
  194 + if (onFormReady != null)
  195 + onFormReady(this.elementFormsManager.get(formId));
  196 + if (this.rendered)
  197 + this.getEl().unmask();
118 198 }
119   -
  199 + return;
120 200 }
121   - return this.elementFormsManager.get(formId);
  201 +
  202 + if (this.rendered)
  203 + this.getEl().unmask();
  204 +
  205 + if (onFormReady != null)
  206 + onFormReady(this.elementFormsManager.get(formId));
122 207 },
123 208  
124 209 init : function(config) {
... ...
js/app/views/PlotComponents/PlotLegendSeriesForm.js
... ... @@ -39,8 +39,12 @@ Ext.define(&#39;amdaPlotComp.PlotLegendSeriesForm&#39;, {
39 39 this.addStandardFont('legend-series-font')
40 40 ];
41 41  
  42 + var me = this;
  43 +
42 44 return [
43   - this.addStandardFieldSet('Activate legend', 'legend-series-activated', legendItems)
  45 + this.addStandardFieldSet('Activate legend', 'legend-series-activated', legendItems, function(name, value, oldValue) {
  46 + me.crtTree.getView().refresh();
  47 + })
44 48 ];
45 49 }
46 50 });
47 51 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotLegendTextForm.js
... ... @@ -18,10 +18,14 @@ Ext.define(&#39;amdaPlotComp.PlotLegendTextForm&#39;, {
18 18 },
19 19  
20 20 getFormItems: function() {
  21 + var me = this;
  22 +
21 23 return [
22 24 this.addStandardText('legend-text-value', 'Text'),
23 25 this.addStandardColor('legend-text-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors),
24   - this.addStandardCombo('legend-text-position', 'Position', amdaPlotObj.PlotObjectConfig.availableLegendTextPositions),
  26 + this.addStandardCombo('legend-text-position', 'Position', amdaPlotObj.PlotObjectConfig.availableLegendTextPositions, function(name, value, oldValue) {
  27 + me.crtTree.getView().refresh();
  28 + }),
25 29 this.addStandardFont('legend-text-font')
26 30 ];
27 31 }
... ...
js/app/views/PlotComponents/PlotPanelForm.js
... ... @@ -10,6 +10,7 @@
10 10  
11 11 Ext.define('amdaPlotComp.PlotPanelForm', {
12 12 extend: 'amdaPlotComp.PlotStandardForm',
  13 + idProperty: 'id',
13 14  
14 15 setObject : function(object) {
15 16 this.object = object;
... ... @@ -120,14 +121,23 @@ Ext.define(&#39;amdaPlotComp.PlotPanelForm&#39;, {
120 121 {
121 122 me.object.updatePlotType(value, true);
122 123 if (!me.crtTree.isSimplifiedView)
  124 + {
123 125 me.crtTree.buildPanelAxesNode(me.object);
  126 + me.crtTree.buildPanelAdditionalObjectsNode(me.object);
  127 + }
124 128 me.crtTree.getView().refresh();
125 129 me.updateOptions(value);
126 130 }
127 131 }),
128   - this.addStandardCheck('panel-scatter-isotropic', 'Isotropic'),
129   - this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id'),
130   - this.addStandardDate('panel-instant-time', 'Instant time'),
  132 + this.addStandardCheck('panel-scatter-isotropic', 'Isotropic', function(name, value, oldValue) {
  133 + me.crtTree.getView().refresh();
  134 + }),
  135 + this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id', function(name, value, oldValue) {
  136 + me.crtTree.getView().refresh();
  137 + }),
  138 + this.addStandardDate('panel-instant-time', 'Instant time', function(name, value, oldValue) {
  139 + me.crtTree.getView().refresh();
  140 + }),
131 141 this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors),
132 142 this.addStandardFieldSet('Manual Bounds', '', boundsItems),
133 143 this.addStandardFieldSet('Manual Margins', '', marginItems),
... ...
js/app/views/PlotComponents/PlotSerieForm.js
... ... @@ -69,10 +69,16 @@ Ext.define(&#39;amdaPlotComp.PlotSerieForm&#39;, {
69 69 },
70 70  
71 71 getFormItems: function() {
  72 + var me = this;
  73 +
72 74 return [
73   - this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter'),
  75 + this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter', function(name, value, oldValue) {
  76 + me.crtTree.getView().refresh();
  77 + }),
74 78 this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaPlotObj.PlotObjectConfig.availableResamplingModes),
75   - this.addStandardCombo('serie-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes),
  79 + this.addStandardCombo('serie-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes, function(name, value, oldValue) {
  80 + me.crtTree.getView().refresh();
  81 + }),
76 82 this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'),
77 83 this.addStandardFieldSet('Lines', 'serie-lines-activated', this.addStandardLineItems('serie-lines')),
78 84 this.addStandardFieldSet('Symbols', 'serie-symbols-activated', this.addStandardSymbolsItems('serie-symbols')),
... ...
js/app/views/PlotComponents/PlotSpectroForm.js
... ... @@ -17,8 +17,11 @@ Ext.define(&#39;amdaPlotComp.PlotSpectroForm&#39;, {
17 17 },
18 18  
19 19 getFormItems: function() {
  20 + var me = this;
20 21 return [
21   - this.addStandardCombo('spectro-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes)
  22 + this.addStandardCombo('spectro-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes, function(name, value, oldValue) {
  23 + me.crtTree.getView().refresh();
  24 + })
22 25 ];
23 26 }
24 27 });
25 28 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -36,7 +36,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
36 36 return [];
37 37 },
38 38  
39   - addStandardText: function(name, label) {
  39 + addStandardText: function(name, label, onChange) {
40 40 return {
41 41 xtype: 'textfield',
42 42 name: name,
... ... @@ -44,13 +44,15 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
44 44 listeners: {
45 45 change: function(field, newValue, oldValue, eOpts) {
46 46 this.object.set(name, newValue);
  47 + if (onChange != null)
  48 + onChange(name, newValue, oldValue);
47 49 },
48 50 scope: this
49 51 }
50 52 };
51 53 },
52 54  
53   - addStandardFloat: function(name, label, min, max, allowBlank) {
  55 + addStandardFloat: function(name, label, min, max, allowBlank, onChange) {
54 56 allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;
55 57  
56 58 return {
... ... @@ -64,6 +66,8 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
64 66 listeners: {
65 67 change: function(field, newValue, oldValue, eOpts) {
66 68 this.object.set(name, newValue);
  69 + if (onChange != null)
  70 + onChange(name, newValue, oldValue);
67 71 },
68 72 scope: this
69 73 }
... ... @@ -112,7 +116,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
112 116 };
113 117 },
114 118  
115   - addStandardFieldSet: function(title, checkboxName, items) {
  119 + addStandardFieldSet: function(title, checkboxName, items, onChangeCheck) {
116 120 return {
117 121 xtype: 'fieldset',
118 122 title: title,
... ... @@ -129,11 +133,19 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
129 133 listeners: {
130 134 expand: function(fieldset, eOpts) {
131 135 if (checkboxName != '')
  136 + {
132 137 this.object.set(checkboxName, true);
  138 + if (onChangeCheck != null)
  139 + onChangeCheck(checkboxName, true, false);
  140 + }
133 141 },
134 142 collapse: function(fieldset, eOpts) {
135 143 if (checkboxName != '')
  144 + {
136 145 this.object.set(checkboxName, false);
  146 + if (onChangeCheck != null)
  147 + onChangeCheck(checkboxName, false, true);
  148 + }
137 149 },
138 150 scope: this
139 151 }
... ... @@ -235,7 +247,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
235 247 };
236 248 },
237 249  
238   - addStandardParamDropTarget: function(name, label) {
  250 + addStandardParamDropTarget: function(name, label, onChange) {
239 251 return {
240 252 xtype: 'textfield',
241 253 name: name,
... ... @@ -245,6 +257,8 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
245 257 listeners: {
246 258 change: function(field, newValue, oldValue, eOpts) {
247 259 this.object.set(name, newValue);
  260 + if (onChange != null)
  261 + onChange(name, newValue, oldValue);
248 262 },
249 263 afterrender: function(field, eOpts ){
250 264 var paramTarget = new Ext.dd.DropTarget(field.el.dom,
... ... @@ -256,6 +270,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
256 270 var selectedRecord = ddSource.dragData.records[0];
257 271  
258 272 field.setValue(selectedRecord.get('id'));
  273 +
259 274 return true;
260 275 }
261 276 }
... ... @@ -266,7 +281,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
266 281 };
267 282 },
268 283  
269   - addStandardDate: function(name, label) {
  284 + addStandardDate: function(name, label, onChange) {
270 285 return {
271 286 xtype: 'datefield',
272 287 name: name,
... ... @@ -277,6 +292,8 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
277 292 listeners: {
278 293 change: function(field, newValue, oldValue, eOpts) {
279 294 this.object.set(name, newValue);
  295 + if (onChange != null)
  296 + onChange(name, newValue, oldValue);
280 297 },
281 298 scope : this
282 299 }
... ...
js/app/views/PlotComponents/PlotTabPanel.js
... ... @@ -38,11 +38,10 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
38 38 addPlotTab: function(tabObject)
39 39 {
40 40 var tabNumber = this.getTabBar().items.getCount();
41   - var tabContent = new amdaPlotComp.PlotTabContent({tabObjectId: tabObject.getId(), plotElementPanel: this.plotElementPanel});
  41 + var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel});
42 42 tabContent.setTabObject(tabObject);
43 43 this.add({
44 44 title: 'Plot '+tabNumber,
45   - tabObjectId: tabObject.getId(),
46 45 closable: true,
47 46 layout: 'fit',
48 47 bodyStyle: 'background: none',
... ... @@ -63,10 +62,8 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
63 62 return true;
64 63 },
65 64 close: function( tab, eOpts ) {
66   - var tabObject = this.object.tabs().getById(tab.tabObjectId);
67   - this.plotElementPanel.resetElement();
68   - if (tabObject != null)
69   - this.object.tabs().remove(tabObject);
  65 + if (tab.items.getAt(0).object)
  66 + this.object.removeTabById(tab.items.getAt(0).object.get('id'));
70 67 },
71 68 destroy: function(tab, eOpts) {
72 69 this.updatePlotTabs();
... ... @@ -79,13 +76,12 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
79 76  
80 77 updatePlotTabs: function()
81 78 {
82   -
83 79 var i = 0;
84 80 for (i = 0; i < this.items.getCount(); ++i)
85 81 {
86 82 var tabNumber = i+1;
87 83 this.items.getAt(i).setTitle('Plot '+tabNumber);
88   - this.items.getAt(i).items.getAt(0).setTabObject(this.object.tabs().getById(this.items.getAt(i).tabObjectId));
  84 + this.items.getAt(i).items.getAt(0).setTabObject(this.object.tabs().getAt(i));
89 85 }
90 86 },
91 87  
... ...
js/app/views/PlotComponents/PlotTextForm.js
... ... @@ -68,7 +68,7 @@ Ext.define(&#39;amdaPlotComp.PlotTextForm&#39;, {
68 68 me.updateOptions(me.crtTree.getSelectedPlotType());
69 69 }),
70 70 this.addStandardFloat('text-x-floatvalue', 'X Position', 0, 1),
71   - this.addStandardDate('text-x-timevalue', 'X Position', 0, 1),
  71 + this.addStandardDate('text-x-timevalue', 'X Position'),
72 72 this.addStandardCheck('text-y-relative', 'Relative Y Position', function(name, value, oldValue) {
73 73 me.updateOptions(me.crtTree.getSelectedPlotType());
74 74 }),
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -234,6 +234,15 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
234 234 selectedTextNode = textNode;
235 235 });
236 236  
  237 + //Curves
  238 + var selectedCurveNode = null;
  239 + panelObject.curves().each(function (curveObject) {
  240 + var curveNode = drawingObjectsNode.appendChild(new amdaPlotObj.PlotCurveTreeNode({object : curveObject}));
  241 + if (curveObject.get('id') == selectedObjectId)
  242 + selectedCurveNode = curveNode;
  243 + });
  244 +
  245 +
237 246 //Refresh & selection
238 247 this.getView().refresh();
239 248 if (selectedConstantNode)
... ... @@ -241,6 +250,9 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
241 250  
242 251 if (selectedTextNode)
243 252 this.getSelectionModel().select(selectedTextNode);
  253 +
  254 + if (selectedCurveNode)
  255 + this.getSelectionModel().select(selectedCurveNode);
244 256 },
245 257  
246 258 addPanelNode: function(panelObject) {
... ... @@ -377,17 +389,25 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
377 389 return selection[0];
378 390 },
379 391  
380   - getSelectedPlotType: function() {
  392 + getSelectedPanelObject: function() {
381 393 var selectedNode = this.getSelectedNode();
382 394 if (selectedNode == null)
383   - return 'none';
  395 + return null;
384 396 var crtNode = selectedNode;
385 397 do {
386 398 if (crtNode.get('type') == 'panel')
387   - return crtNode.object.get('panel-plot-type');
  399 + return crtNode.object;
388 400 crtNode = crtNode.parentNode;
389 401 } while(crtNode != null);
390   - return 'none';
  402 + return null;
  403 + },
  404 +
  405 + getSelectedPlotType: function() {
  406 + var crtPanelObject = this.getSelectedPanelObject();
  407 + if (crtPanelObject == null)
  408 + return 'none';
  409 +
  410 + return crtPanelObject.get('panel-plot-type');
391 411 },
392 412  
393 413 isValidToDrop : function(record,targetNode,position)
... ...