Commit 509bf9fad4c623d9b790d6f102427ce1c3eca2e2

Authored by Benjamin Renard
1 parent 09eefb2d

Replace panel ID by panel index

js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -31,6 +31,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
31 31  
32 32 fields : [
33 33 {name: 'id', type: 'string'},
  34 + {name: 'panel-index', type: 'int'},
34 35 {name: 'panel-background-color', type: 'string'},
35 36 {name: 'panel-title-text', type: 'string'},
36 37 {name: 'panel-title-color', type: 'string'},
... ... @@ -502,7 +503,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
502 503 getPanelShortInfo : function()
503 504 {
504 505 var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePlotTypes, this.get('panel-plot-type'));
505   - var info = 'Id = '+this.get('id')+', '+type;
  506 + var info = '#'+this.get('panel-index')+', '+type;
506 507 switch (this.get('panel-plot-type'))
507 508 {
508 509 case 'instantPlot' :
... ... @@ -587,6 +588,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
587 588  
588 589 panelValues['id'] = this.get('id');
589 590  
  591 + panelValues['panel-index'] = this.get('panel-index');
  592 +
590 593 panelValues['panel-background-color'] = this.get('panel-background-color');
591 594 panelValues['panel-title-text'] = this.get('panel-title-text');
592 595 panelValues['panel-title-color'] = this.get('panel-title-color');
... ...
js/app/models/PlotObjects/PlotTabObject.js
... ... @@ -88,6 +88,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
88 88 loadPanels: function(panels)
89 89 {
90 90 this.panels().loadData(panels);
  91 + this.updatePanelIndex();
91 92 },
92 93  
93 94 loadLayoutObject: function(layout)
... ... @@ -102,6 +103,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
102 103 var recs = this.panels().add({id : this.get('last-panel-id')});
103 104 recs[0].setDefaultValues();
104 105 this.dirty = true;
  106 + this.updatePanelIndex();
105 107 return recs[0];
106 108 },
107 109  
... ... @@ -112,9 +114,16 @@ Ext.define('amdaPlotObj.PlotTabObject', {
112 114 return false;
113 115 this.panels().remove(panelRecord);
114 116 this.dirty = true;
  117 + this.updatePanelIndex();
115 118 return true;
116 119 },
117 120  
  121 + updatePanelIndex: function() {
  122 + this.panels().each(function(panel, index) {
  123 + panel.set('panel-index', index);
  124 + });
  125 + },
  126 +
118 127 createLayoutByType : function(layoutType, data)
119 128 {
120 129 //Create layout object in relation with the type
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -72,6 +72,7 @@ Ext.define('amdaPlotComp.PlotTree', {
72 72 this.panelsNode.removeAll();
73 73  
74 74 var me = this;
  75 + this.tabObject.updatePanelIndex();
75 76 this.tabObject.panels().each(function (panelObject) {
76 77 me.addPanelNode(panelObject, paramNodeToSelect);
77 78 });
... ...