Commit fd5552a4bd7b6f5a2371b3110d4baf5c618f3dec

Authored by Benjamin Renard
1 parent dbb7bcbe

Info for plot elements in tree

Fix some pb with plot elements id
Serie id definition for a curve element
js/app/models/PlotObjects/PlotAxisObject.js
... ... @@ -15,6 +15,7 @@
15 15  
16 16 Ext.define('amdaPlotObj.PlotAxisObject', {
17 17 extend: 'Ext.data.Model',
  18 + idProperty: 'id',
18 19  
19 20 requires: [
20 21 'amdaPlotObj.PlotObjectConfig'
... ... @@ -93,6 +94,7 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
93 94 {
94 95 var axisValues = new Object();
95 96  
  97 + axisValues['id'] = this.get('id');
96 98 axisValues['axis-type'] = this.get('axis-type');
97 99 axisValues['axis-reverse'] = this.get('axis-reverse');
98 100 axisValues['axis-scale'] = this.get('axis-scale');
... ...
js/app/models/PlotObjects/PlotConstantObject.js
... ... @@ -22,7 +22,7 @@ Ext.define('amdaPlotObj.PlotConstantObject', {
22 22 ],
23 23  
24 24 fields : [
25   - {name: 'id', type: 'string'},
  25 + {name: 'id', type: 'int'},
26 26 {name: 'constant-axis-id', type: 'string'},
27 27 {name: 'constant-time-value', type: 'date',
28 28 defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1),
... ... @@ -50,6 +50,12 @@ Ext.define('amdaPlotObj.PlotConstantObject', {
50 50 this.set('constant-line-color', amdaPlotObj.PlotObjectConfig.defaultValues.constants.line.color);
51 51 },
52 52  
  53 + getShortInfo : function()
  54 + {
  55 + var axis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableConstantAxes, this.get('constant-axis-id'));
  56 + return 'Id : '+this.get('id')+', '+axis;
  57 + },
  58 +
53 59 getJsonValues : function()
54 60 {
55 61 var constantValues = new Object();
... ...
js/app/models/PlotObjects/PlotCurveObject.js
... ... @@ -22,9 +22,9 @@ Ext.define('amdaPlotObj.PlotCurveObject', {
22 22 ],
23 23  
24 24 fields : [
25   - {name: 'id', type: 'string'},
  25 + {name: 'id', type: 'int'},
26 26 {name: 'curve-name', type: 'string'},
27   - {name: 'curve-serie-id', type: 'string'},
  27 + {name: 'curve-serie-id', type: 'int', useNull:true},
28 28 {name: 'curve-line-style', type: 'string'},
29 29 {name: 'curve-line-width', type: 'float'},
30 30 {name: 'curve-line-color', type: 'string'}
... ... @@ -110,12 +110,12 @@ Ext.define('amdaPlotObj.PlotCurveObject', {
110 110 setDefaultValues: function()
111 111 {
112 112 this.set('curve-name', '');
113   - this.set('curve-serie-id', '');
  113 + this.set('curve-serie-id', null);
114 114 this.set('curve-line-style', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.style);
115 115 this.set('curve-line-width', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.width);
116 116 this.set('curve-line-color', amdaPlotObj.PlotObjectConfig.defaultValues.curves.line.color);
117 117 },
118   -
  118 +
119 119 getJsonValues : function()
120 120 {
121 121 var curveValues = new Object();
... ...
js/app/models/PlotObjects/PlotLegendSeriesObject.js
... ... @@ -55,6 +55,16 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
55 55 this.set('legend-series-font-italic', false);
56 56 },
57 57  
  58 + getShortInfo : function()
  59 + {
  60 + var info = '';
  61 + if (this.get('legend-series-activated'))
  62 + info += 'Activated';
  63 + else
  64 + info += 'Deactivated';
  65 + return info;
  66 + },
  67 +
58 68 getJsonValues : function()
59 69 {
60 70 var legendValues = new Object();
... ...
js/app/models/PlotObjects/PlotLegendTextObject.js
... ... @@ -22,7 +22,7 @@ Ext.define('amdaPlotObj.PlotLegendTextObject', {
22 22 ],
23 23  
24 24 fields : [
25   - {name: 'id', type: 'string'},
  25 + {name: 'id', type: 'int'},
26 26 {name: 'legend-text-value', type: 'string'},
27 27 {name: 'legend-text-position', type: 'string'},
28 28 {name: 'legend-text-color', type: 'string'},
... ... @@ -45,6 +45,12 @@ Ext.define('amdaPlotObj.PlotLegendTextObject', {
45 45 this.set('legend-text-font-italic', false);
46 46 },
47 47  
  48 + getShortInfo : function()
  49 + {
  50 + var position = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableLegendTextPositions, this.get('legend-text-position'));
  51 + return position;
  52 + },
  53 +
48 54 getJsonValues : function()
49 55 {
50 56 var legendValues = new Object();
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -248,7 +248,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
248 248  
249 249 createNewParam: function() {
250 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')});
  251 + var recs = this.params().add({id : this.get('last-param-id')});
252 252 var availableDrawingObjects = recs[0].getAvailableDrawingObjectByPlotType(this.get('panel-plot-type'));
253 253 recs[0].updateDrawingType(availableDrawingObjects[0].key, true);
254 254 return recs[0];
... ... @@ -265,7 +265,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
265 265  
266 266 createNewTextLegend: function() {
267 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')});
  268 + var recs = this.textLegends().add({id : this.get('last-textlegend-id')});
269 269 recs[0].setDefaultValues();
270 270 return recs[0];
271 271 },
... ... @@ -281,7 +281,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
281 281  
282 282 createNewConstant: function() {
283 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')});
  284 + var recs = this.constants().add({id : this.get('last-constant-id')});
285 285 recs[0].setDefaultValues();
286 286 return recs[0];
287 287 },
... ... @@ -297,7 +297,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
297 297  
298 298 createNewTextObject: function() {
299 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')});
  300 + var recs = this.textObjs().add({id : this.get('last-textobj-id')});
301 301 recs[0].setDefaultValues();
302 302 return recs[0];
303 303 },
... ... @@ -313,7 +313,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
313 313  
314 314 createNewCurve: function() {
315 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')});
  316 + var recs = this.curves().add({id : this.get('last-curve-id')});
317 317 recs[0].setDefaultValues();
318 318 return recs[0];
319 319 },
... ... @@ -363,6 +363,15 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
363 363 this.set('panel-legend-series', null);
364 364 this.textLegends().removeAll();
365 365 }
  366 +
  367 + if ((plotType == 'tickPlot') || (plotType == 'statusPlot'))
  368 + {
  369 + this.textObjs().removeAll();
  370 + this.constants().removeAll();
  371 + this.curves().removeAll();
  372 + }
  373 + else if (plotType != 'xyPlot')
  374 + this.curves().removeAll();
366 375 },
367 376  
368 377 setDefaultValues: function()
... ... @@ -408,6 +417,26 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
408 417 this.updatePlotType(amdaPlotObj.PlotObjectConfig.defaultValues.panel.plotType);
409 418 },
410 419  
  420 + getPanelShortInfo : function()
  421 + {
  422 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePlotTypes, this.get('panel-plot-type'));
  423 + var info = 'Id = '+this.get('id')+', '+type;
  424 + switch (this.get('panel-plot-type'))
  425 + {
  426 + case 'instantPlot' :
  427 + info += (', '+Ext.Date.format(this.get('panel-instant-time'), "Y/m/d H:i:s"));
  428 + break;
  429 + case 'epochPlot' :
  430 + info += (', '+this.get('panel-epoch-centertimeid'));
  431 + break;
  432 + case 'xyPlot' :
  433 + if (this.get('panel-scatter-isotropic'))
  434 + info += ', Isotropic';
  435 + break;
  436 + }
  437 + return info;
  438 + },
  439 +
411 440 getJsonValues : function()
412 441 {
413 442 var panelValues = new Object();
... ...
js/app/models/PlotObjects/PlotParamObject.js
... ... @@ -28,7 +28,7 @@ Ext.define('amdaPlotObj.PlotParamObject', {
28 28 ],
29 29  
30 30 fields : [
31   - {name: 'id', type: 'string'},
  31 + {name: 'id', type: 'int'},
32 32 {name: 'param-id', type: 'string'},
33 33 {name: 'param-drawing-type', type: 'string'},
34 34 {name: 'param-drawing-object', type: 'auto'}
... ... @@ -140,6 +140,41 @@ Ext.define('amdaPlotObj.PlotParamObject', {
140 140 this.updateDrawingType(type, true);
141 141 },
142 142  
  143 + getShortInfo : function(plotType)
  144 + {
  145 + var availableDrawingObjects = this.getAvailableDrawingObjectByPlotType(plotType);
  146 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(availableDrawingObjects, this.get('param-drawing-type'));
  147 +
  148 + var info = '';
  149 + switch (plotType)
  150 + {
  151 + case 'xyPlot' :
  152 + info = this.get('param-id')+' = f('+this.get('param-drawing-object').get('serie-xaxis-param')+', t)';
  153 + break;
  154 + case 'instantPlot' :
  155 + info = this.get('param-id');
  156 + break;
  157 + default :
  158 + info = this.get('param-id')+' = f(t)';
  159 + }
  160 +
  161 + info += ', '+type;
  162 +
  163 + switch (this.get('param-drawing-type'))
  164 + {
  165 + case 'serie' :
  166 + var yAxis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableYAxes, this.get('param-drawing-object').get('serie-yaxis'));
  167 + info += ', Y '+yAxis;
  168 + break;
  169 + case 'spectro' :
  170 + var yAxis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableYAxes, this.get('param-drawing-object').get('spectro-yaxis'));
  171 + info += ', Y '+yAxis;
  172 + break;
  173 + }
  174 +
  175 + return info;
  176 + },
  177 +
143 178 getJsonValues : function()
144 179 {
145 180 var paramValues = new Object();
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -17,8 +17,6 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
17 17 extend: 'amdaModel.AmdaTimeObject',
18 18 idProperty: 'id',
19 19  
20   - lastTabId : 0,
21   -
22 20 requires: [
23 21 'amdaPlotObj.PlotObjectConfig',
24 22 'amdaPlotObj.PlotTabObject'
... ... @@ -98,7 +96,6 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
98 96  
99 97 requestValues['leaf'] = true;
100 98  
101   - requestValues['last-tab-id'] = this.get('last-tab-id');
102 99 requestValues['file-format'] = this.get('file-format');
103 100 requestValues['file-output'] = this.get('file-output');
104 101 requestValues['file-prefix'] = this.get('file-prefix');
... ... @@ -137,6 +134,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
137 134 requestValues['tabs'][index] = tab.getJsonValues();
138 135 });
139 136  
  137 + requestValues['last-tab-id'] = this.get('last-tab-id');
  138 +
140 139 return requestValues;
141 140 }
142 141 });
143 142 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotTabObject.js
... ... @@ -26,7 +26,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
26 26 ],
27 27  
28 28 fields : [
29   - {name: 'id', type: 'string'},
  29 + {name: 'id', type: 'int'},
30 30 {name: 'page-title-text', type: 'string'},
31 31 {name: 'page-title-color', type: 'string'},
32 32 {name: 'page-title-position', type: 'string'},
... ... @@ -174,6 +174,23 @@ Ext.define('amdaPlotObj.PlotTabObject', {
174 174 this.setLayout(amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type, true);
175 175 },
176 176  
  177 + getPageShortInfo : function()
  178 + {
  179 + var dimension = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageDimensions, this.get('page-dimension'));
  180 + var orientation = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageOrientations, this.get('page-orientation'));
  181 +
  182 + var info = dimension+', '+orientation;
  183 + if (this.get('page-superpose-mode'))
  184 + info += ', Epoch superposed mode';
  185 + return info;
  186 + },
  187 +
  188 + getLayoutShortInfo : function()
  189 + {
  190 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageLayouts, this.get('page-layout-type'));
  191 + return type;
  192 + },
  193 +
177 194 getJsonValues : function()
178 195 {
179 196 var tabValues = new Object();
... ...
js/app/models/PlotObjects/PlotTextObject.js
... ... @@ -22,7 +22,7 @@ Ext.define('amdaPlotObj.PlotTextObject', {
22 22 ],
23 23  
24 24 fields : [
25   - {name: 'id', type: 'string'},
  25 + {name: 'id', type: 'int'},
26 26 {name: 'text-value', type: 'string'},
27 27 {name: 'text-y-axis', type: 'string'},
28 28 {name: 'text-x-relative', type: 'boolean'},
... ...
js/app/models/PlotObjects/PlotTreeNode.js
... ... @@ -70,14 +70,7 @@ Ext.define('amdaPlotObj.PlotPageTreeNode', {
70 70  
71 71 getAdditionalText: function()
72 72 {
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;
77   - if (this.object.get('page-superpose-mode'))
78   - addText += ', Epoch superposed mode';
79   - addText += ')';
80   - return addText;
  73 + return ' ('+this.object.getPageShortInfo()+')';
81 74 }
82 75 });
83 76  
... ... @@ -94,8 +87,7 @@ Ext.define('amdaPlotObj.PlotLayoutTreeNode', {
94 87  
95 88 getAdditionalText: function()
96 89 {
97   - var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageLayouts, this.object.get('page-layout-type'));
98   - return ' ('+type+')';
  90 + return ' ('+this.object.getLayoutShortInfo()+')';
99 91 }
100 92 });
101 93  
... ... @@ -122,23 +114,7 @@ Ext.define('amdaPlotObj.PlotPanelTreeNode', {
122 114  
123 115 getAdditionalText: function()
124 116 {
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 += ')';
141   - return addText;
  117 + return ' ('+this.object.getPanelShortInfo()+')';
142 118 }
143 119 });
144 120  
... ... @@ -253,37 +229,7 @@ Ext.define('amdaPlotObj.PlotParamTreeNode', {
253 229 {
254 230 var parentNode = this.parentNode;
255 231 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 + return this.object.getShortInfo(plotType);
287 233 }
288 234 });
289 235  
... ... @@ -322,13 +268,9 @@ Ext.define('amdaPlotObj.PlotSeriesLegendTreeNode', {
322 268  
323 269 getAdditionalText: function()
324 270 {
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;
  271 + if (this.object.get('panel-legend-series'))
  272 + return ' ('+this.object.get('panel-legend-series').getShortInfo()+')';
  273 + return '';
332 274 }
333 275 });
334 276  
... ... @@ -357,9 +299,7 @@ Ext.define('amdaPlotObj.PlotTextLegendTreeNode', {
357 299  
358 300 getAdditionalText: function()
359 301 {
360   - var position = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableLegendTextPositions, this.object.get('legend-text-position'));
361   - var addText = ' ('+position+')';
362   - return addText;
  302 + return ' ('+this.object.getShortInfo()+')';
363 303 }
364 304 });
365 305  
... ... @@ -388,9 +328,7 @@ Ext.define('amdaPlotObj.PlotConstantTreeNode', {
388 328  
389 329 getAdditionalText: function()
390 330 {
391   - var axis = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableConstantAxes, this.object.get('constant-axis-id'));
392   - var addText = ' ('+axis+')';
393   - return addText;
  331 + return ' ('+this.object.getShortInfo()+')';
394 332 }
395 333 });
396 334  
... ...
js/app/views/PlotComponents/PlotCurveForm.js
... ... @@ -21,9 +21,9 @@ Ext.define('amdaPlotComp.PlotCurveForm', {
21 21 this.object = object;
22 22 if (this.object != null)
23 23 {
  24 + this.updateSerieIdList();
24 25 this.loadRecord(this.object);
25 26 this.updateParamsContainer();
26   - this.updateSerieIdList();
27 27 }
28 28 },
29 29  
... ... @@ -106,9 +106,11 @@ Ext.define('amdaPlotComp.PlotCurveForm', {
106 106 var drawingType = paramObject.get('param-drawing-type');
107 107 if ((drawingType == 'serie') || (drawingType == 'orbit-serie'))
108 108 {
109   - attachedSerieField.getStore().add({key : paramObject.get('id'), value : paramObject.get('id')});
  109 + attachedSerieField.getStore().add({key : paramObject.get('id'), value : paramObject.getShortInfo(panelObject.get('panel-plot-type'))});
110 110 }
111 111 });
  112 +
  113 + console.log(attachedSerieField.getStore());
112 114 },
113 115  
114 116 getFormItems: function() {
... ...
js/app/views/PlotComponents/PlotDrawingObjectForm.js
... ... @@ -11,42 +11,68 @@
11 11 Ext.define('amdaPlotComp.PlotDrawingObjectForm', {
12 12 extend: 'amdaPlotComp.PlotStandardForm',
13 13  
  14 + addConstantBtn : null,
  15 + addTextBtn : null,
  16 + addCurveBtn : null,
  17 +
14 18 setObject : function(object) {
15 19 this.object = object;
16 20 if (this.object != null)
17 21 this.loadRecord(this.object);
  22 + this.updateOptions();
  23 + },
  24 +
  25 + updateOptions: function() {
  26 + if (this.object == null)
  27 + {
  28 + this.addConstantBtn.setDisabled(true);
  29 + this.addTextBtn.setDisabled(true);
  30 + this.addCurveBtn.setDisabled(true);
  31 + return;
  32 + }
  33 +
  34 + this.addConstantBtn.setDisabled((this.object.get('panel-plot-type') == 'tickPlot') || (this.object.get('panel-plot-type') == 'statusPlot'));
  35 + this.addTextBtn.setDisabled((this.object.get('panel-plot-type') == 'tickPlot') || (this.object.get('panel-plot-type') == 'statusPlot'));
  36 + this.addCurveBtn.setDisabled(this.object.get('panel-plot-type') != 'xyPlot');
18 37 },
19 38  
20 39 getFormItems: function() {
21 40 var me = this;
22   - return [
23   - {
24   - xtype: 'button',
25   - text: 'Add new constant',
26   - iconCls: 'icon-add',
27   - handler : function() {
28   - var constantObject = me.object.createNewConstant();
29   - me.crtTree.buildPanelAdditionalObjectsNode(me.object, constantObject.get('id'));
30   - }
31   - },
32   - {
33   - xtype: 'button',
34   - text: 'Add new text',
35   - iconCls: 'icon-add',
36   - handler : function() {
37   - var textObject = me.object.createNewTextObject();
38   - me.crtTree.buildPanelAdditionalObjectsNode(me.object, textObject.get('id'));
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   - }
  41 +
  42 + this.addConstantBtn = Ext.create('Ext.button.Button', {
  43 + text: 'Add new constant',
  44 + iconCls: 'icon-add',
  45 + name: 'add-constant-btn',
  46 + handler : function() {
  47 + var constantObject = me.object.createNewConstant();
  48 + me.crtTree.buildPanelAdditionalObjectsNode(me.object, constantObject);
  49 + }
  50 + });
  51 +
  52 + this.addTextBtn = Ext.create('Ext.button.Button', {
  53 + text: 'Add new text',
  54 + iconCls: 'icon-add',
  55 + name: 'add-text-btn',
  56 + handler : function() {
  57 + var textObject = me.object.createNewTextObject();
  58 + me.crtTree.buildPanelAdditionalObjectsNode(me.object, textObject);
  59 + }
  60 + });
  61 +
  62 + this.addCurveBtn = Ext.create('Ext.button.Button', {
  63 + text: 'Add new curve',
  64 + iconCls: 'icon-add',
  65 + name: 'add-curve-btn',
  66 + handler : function() {
  67 + var curveObject = me.object.createNewCurve();
  68 + me.crtTree.buildPanelAdditionalObjectsNode(me.object, curveObject);
49 69 }
  70 + });
  71 +
  72 + return [
  73 + this.addConstantBtn,
  74 + this.addTextBtn,
  75 + this.addCurveBtn
50 76 ];
51 77 }
52 78 });
53 79 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotLegendsTextForm.js
... ... @@ -26,7 +26,7 @@ Ext.define('amdaPlotComp.PlotLegendsTextForm', {
26 26 iconCls: 'icon-add',
27 27 handler : function() {
28 28 var textLegendObject = me.object.createNewTextLegend();
29   - me.crtTree.buildPanelAdditionalObjectsNode(me.object, textLegendObject.get('id'));
  29 + me.crtTree.buildPanelAdditionalObjectsNode(me.object, textLegendObject);
30 30 }
31 31 }
32 32 ];
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -162,8 +162,8 @@ Ext.define('amdaPlotComp.PlotTree', {
162 162 this.getSelectionModel().select(selectedParamNode);
163 163 },
164 164  
165   - buildPanelAdditionalObjectsNode: function(panelObject, selectedObjectId) {
166   - selectedObjectId = (typeof selectedObjectId !== 'undefined') ? selectedObjectId : '';
  165 + buildPanelAdditionalObjectsNode: function(panelObject, selectedObject) {
  166 + selectedObject = (typeof selectedObject !== 'undefined') ? selectedObject : null;
167 167  
168 168 var objectsNode = null;
169 169  
... ... @@ -190,13 +190,13 @@ Ext.define('amdaPlotComp.PlotTree', {
190 190 objectsNode.removeAll();
191 191  
192 192 //create legends node
193   - this.buildPanelLegendsNode(panelObject, objectsNode, selectedObjectId);
  193 + this.buildPanelLegendsNode(panelObject, objectsNode, selectedObject);
194 194  
195 195 //create drawing objects node
196   - this.buildDrawingObjectsNode(panelObject, objectsNode, selectedObjectId);
  196 + this.buildDrawingObjectsNode(panelObject, objectsNode, selectedObject);
197 197 },
198 198  
199   - buildPanelLegendsNode: function(panelObject, objectsNode, selectedObjectId) {
  199 + buildPanelLegendsNode: function(panelObject, objectsNode, selectedObject) {
200 200 var legendsNode = objectsNode.appendChild(new amdaPlotObj.PlotLegendsTreeNode({object : panelObject}));
201 201  
202 202 legendsNode.appendChild(new amdaPlotObj.PlotSeriesLegendTreeNode({object : panelObject}));
... ... @@ -206,7 +206,7 @@ Ext.define('amdaPlotComp.PlotTree', {
206 206 var selectedTextLegendNode = null;
207 207 panelObject.textLegends().each(function (legendObject) {
208 208 var textLegendNode = textLegendsNode.appendChild(new amdaPlotObj.PlotTextLegendTreeNode({object : legendObject}));
209   - if (legendObject.get('id') == selectedObjectId)
  209 + if (legendObject == selectedObject)
210 210 selectedTextLegendNode = textLegendNode;
211 211 });
212 212  
... ... @@ -215,14 +215,14 @@ Ext.define('amdaPlotComp.PlotTree', {
215 215 this.getSelectionModel().select(selectedTextLegendNode);
216 216 },
217 217  
218   - buildDrawingObjectsNode: function(panelObject, objectsNode, selectedObjectId) {
  218 + buildDrawingObjectsNode: function(panelObject, objectsNode, selectedObject) {
219 219 var drawingObjectsNode = objectsNode.appendChild(new amdaPlotObj.PlotDrawingObjectsTreeNode({object : panelObject}));
220 220  
221 221 //Constants
222 222 var selectedConstantNode = null;
223 223 panelObject.constants().each(function (constantObject) {
224 224 var constantNode = drawingObjectsNode.appendChild(new amdaPlotObj.PlotConstantTreeNode({object : constantObject}));
225   - if (constantObject.get('id') == selectedObjectId)
  225 + if (constantObject == selectedObject)
226 226 selectedConstantNode = constantNode;
227 227 });
228 228  
... ... @@ -230,7 +230,7 @@ Ext.define('amdaPlotComp.PlotTree', {
230 230 var selectedTextNode = null;
231 231 panelObject.textObjs().each(function (textObject) {
232 232 var textNode = drawingObjectsNode.appendChild(new amdaPlotObj.PlotTextTreeNode({object : textObject}));
233   - if (textObject.get('id') == selectedObjectId)
  233 + if (textObject == selectedObject)
234 234 selectedTextNode = textNode;
235 235 });
236 236  
... ... @@ -238,7 +238,7 @@ Ext.define('amdaPlotComp.PlotTree', {
238 238 var selectedCurveNode = null;
239 239 panelObject.curves().each(function (curveObject) {
240 240 var curveNode = drawingObjectsNode.appendChild(new amdaPlotObj.PlotCurveTreeNode({object : curveObject}));
241   - if (curveObject.get('id') == selectedObjectId)
  241 + if (curveObject == selectedObject)
242 242 selectedCurveNode = curveNode;
243 243 });
244 244  
... ...