Commit 940afd8d9cb2e501ac06d73a057cf3c3619f1afc

Authored by Benjamin Renard
1 parent e1798fcc

Introduce multiplot object and remove PlotTabObject

js/app/models/MultiplotNode.js 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +/**
  2 + * Project : AMDA-NG4
  3 + * Name : MultiplotNode.js
  4 + * @class amdaModel.MutiplotNode
  5 + * @extends amdaModel.ExecutableNode
  6 + * @brief Basic Model of Node corresponding to a multi-plot request
  7 + * @author Benjamin Renard
  8 + */
  9 +
  10 +Ext.define('amdaModel.MultiplotNode', {
  11 + extend: 'amdaModel.ExecutableNode',
  12 +
  13 + statics: {
  14 + nodeType: 'mutiplot'
  15 + },
  16 +
  17 + constructor : function(config){
  18 + this.callParent(arguments);
  19 + this.set('moduleId',myDesktopApp.dynamicModules.plot.id);
  20 + this.set('objectDataModel','amdaPlotObj.MultiplotRequestObject');
  21 + this.set('nodeType',this.self.nodeType);
  22 + this.set('leaf', true);
  23 + }
  24 +});
... ...
js/app/models/PlotNode.js
... ... @@ -8,7 +8,7 @@
8 8 */
9 9  
10 10 Ext.define('amdaModel.PlotNode', {
11   - extend: 'amdaModel.ExecutableNode',
  11 + extend: 'amdaModel.ExecutableNode',
12 12  
13 13 statics: {
14 14 nodeType: 'request'
... ...
js/app/models/PlotObjects/MultiplotRequestObject.js 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : MultiplotRequestObject.js
  4 + * @class amdaPlotObj.MutiplotRequestObject
  5 + * @extends amdaModel.AmdaTimeObject
  6 + * @brief Multi-Plot Request Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: MultiplotRequestObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :28/02/2020: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.MultiplotRequestObject', {
  17 + extend: 'amdaModel.AmdaTimeObject',
  18 + idProperty: 'id',
  19 +
  20 + hasMany: {
  21 + model : 'amdaPlotObj.PlotNode',
  22 + name : 'plots',
  23 + associationKey:'plots'
  24 + },
  25 +
  26 + constructor: function(){
  27 + var me = this;
  28 + me.callParent(arguments);
  29 + },
  30 +
  31 + createNewPlot: function() {
  32 + },
  33 +
  34 + removePlotById: function(id) {
  35 + },
  36 +
  37 + addPlot: function(plotNode) {
  38 + }
  39 +});
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -5,11 +5,12 @@
5 5 * @extends amdaModel.AmdaTimeObject
6 6 * @brief Plot Request Business Object Definition
7 7 * @author Benjamin Renard
8   - * @version $Id: PlotRequestObject.js benjamin $
  8 + * @version $Id: PlotTabObject.js benjamin $
9 9 ******************************************************************************
10 10 * FT Id : Date : Name - Description
11 11 ******************************************************************************
12   - * : :21/07/2015: BRE - file creation
  12 + * : :22/07/2015: BRE - file creation
  13 + * 20/03/2020: BRE - full rework
13 14 */
14 15  
15 16  
... ... @@ -19,122 +20,253 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
19 20  
20 21 requires: [
21 22 'amdaPlotObj.PlotObjectConfig',
22   - 'amdaPlotObj.PlotTabObject'
  23 + 'amdaPlotObj.PlotPanelObject',
  24 + 'amdaPlotObj.PlotLayoutVerticalObject',
  25 + 'amdaPlotObj.PlotLayoutAutoObject',
  26 + 'amdaPlotObj.PlotLayoutManualObject'
23 27 ],
24 28  
25 29 fields : [
26   - {name: 'id', type:'string'},
  30 + {name: 'id', type: 'int'},
  31 +
27 32 {name: 'file-format', type: 'string'},
28 33 {name: 'file-output', type: 'string'},
29 34 {name: 'file-prefix', type: 'string'},
30 35 {name: 'one-file-per-interval', type: 'boolean'},
31   - {name: 'last-plotted-tab', type: 'int', defaultValue: 0},
32   - {name: 'last-tab-id', type: 'int', defaultValue: 0},
33   - {name: 'active-tab-id', type: 'int', defaultValue: 1}
  36 +
  37 + {name: 'tree-full-view', type: 'boolean'},
  38 + {name: 'multi-plot-linked', type: 'boolean'},
  39 + {name: 'page-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
  40 + {name: 'panels-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
  41 +
  42 + {name: 'page-title-text', type: 'string'},
  43 + {name: 'page-title-color', type: 'string'},
  44 + {name: 'page-title-position', type: 'string'},
  45 + {name: 'page-title-alignment', type: 'string'},
  46 + {name: 'page-title-font-activated', type: 'boolean'},
  47 + {name: 'page-title-font-name', type: 'string'},
  48 + {name: 'page-title-font-size', type: 'int'},
  49 + {name: 'page-title-font-bold', type: 'boolean'},
  50 + {name: 'page-title-font-italic', type: 'boolean'},
  51 + {name: 'page-margins-activated', type: 'boolean'},
  52 + {name: 'page-margin-x', type: 'float'},
  53 + {name: 'page-margin-y', type: 'float'},
  54 + {name: 'page-mode', type: 'string'},
  55 + {name: 'page-orientation', type: 'string'},
  56 + {name: 'page-dimension', type: 'string'},
  57 + {name: 'page-superpose-mode', type: 'boolean'},
  58 + {name: 'page-font-activated', type: 'boolean'},
  59 + {name: 'page-font-name', type: 'string'},
  60 + {name: 'page-font-size', type: 'int'},
  61 + {name: 'page-font-bold', type: 'boolean'},
  62 + {name: 'page-font-italic', type: 'boolean'},
  63 + {name: 'page-layout-type', type: 'string'},
  64 + {name: 'page-layout-object', type: 'auto', defaultValue: null},
  65 + {name: 'last-panel-id', type: 'int', defaultValue: 0}
34 66 ],
35 67  
36   - hasMany: {
37   - model : 'amdaPlotObj.PlotTabObject',
38   - name : 'tabs',
39   - associationKey:'tabs'
40   - },
  68 + associations : [
  69 + {
  70 + type : 'hasMany',
  71 + model : 'amdaPlotObj.PlotPanelObject',
  72 + name : 'panels'
  73 + }
  74 + ],
41 75  
42 76 constructor: function(){
43   - var me = this;
44   - me.callParent(arguments);
45   - if ((arguments.length > 0) && arguments[0] && arguments[0].tabs)
  77 + var me = this;
  78 + me.callParent(arguments);
  79 + if ((arguments.length > 0) && arguments[0])
46 80 {
47   - if (arguments[0].tabs)
48   - me.loadTabs(arguments[0].tabs);
  81 + if (arguments[0].panels)
  82 + me.loadPanels(arguments[0].panels);
  83 + if (arguments[0]['page-layout-object'])
  84 + me.loadLayoutObject(arguments[0]['page-layout-object']);
49 85 }
50 86 else
51 87 {
52 88 //new object, set default fields values
53 89 me.setDefaultValues();
54   - //New object, force the creation of the first tab
55   - me.createNewTab();
56 90 }
  91 + this.dirty = false;
57 92 },
58 93  
59   - loadTabs: function(tabs)
  94 + loadPanels: function(panels)
60 95 {
61   - this.tabs().loadData(tabs);
  96 + this.panels().loadData(panels);
  97 + this.updatePanelIndex();
62 98 },
63 99  
64   - setDefaultValues: function()
  100 + loadLayoutObject: function(layout)
65 101 {
66   - this.set('file-format', amdaPlotObj.PlotObjectConfig.defaultValues.file.format);
67   - this.set('file-output', amdaPlotObj.PlotObjectConfig.defaultValues.file.output);
68   - this.set('file-prefix', '');
69   - this.set('one-file-per-interval', amdaPlotObj.PlotObjectConfig.defaultValues.file.oneFilePerInterval);
70   - this.set('last-plotted-tab', 0);
71   - this.set('name', '');
  102 + this.set('page-layout-object', this.createLayoutByType(this.get('page-layout-type'), layout));
  103 + if (this.get('page-layout-object') != null)
  104 + this.get('page-layout-object').dirty = false;
72 105 },
73 106  
74   - createNewTab: function() {
75   - this.set('last-tab-id', this.get('last-tab-id') + 1);
76   - var data = {id: this.get('last-tab-id')};
77   - var applyDefault = true;
78   - if ((arguments.length > 0) && arguments[0]) {
79   - data = arguments[0];
80   - data['id'] = this.get('last-tab-id');
81   - applyDefault = false;
82   - }
83   - var recs = this.tabs().add(data);
84   - if (applyDefault) {
85   - recs[0].setDefaultValues();
86   - }
  107 + createNewPanel: function() {
  108 + this.set('last-panel-id', this.get('last-panel-id') + 1);
  109 + var recs = this.panels().add({id : this.get('last-panel-id')});
  110 + recs[0].setDefaultValues();
87 111 this.dirty = true;
88   - return recs[0];
  112 + this.updatePanelIndex();
  113 + return recs[0];
89 114 },
90 115  
91   - removeTabById: function(tabId) {
92   - //Retrieve tab record
93   - var tabRecord = this.tabs().getById(tabId);
94   - if (tabRecord == null)
  116 + removePanelById: function(panelId) {
  117 + //Retrieve panel record
  118 + var panelRecord = this.panels().getById(panelId);
  119 + if (panelRecord == null)
95 120 return false;
96   - this.tabs().remove(tabRecord);
  121 + this.panels().remove(panelRecord);
97 122 this.dirty = true;
  123 + this.updatePanelIndex();
98 124 return true;
99 125 },
100 126  
101   - isDirty : function()
  127 + updatePanelIndex: function() {
  128 + this.panels().each(function(panel, index) {
  129 + panel.set('panel-index', index);
  130 + });
  131 + },
  132 +
  133 + createLayoutByType : function(layoutType, data)
102 134 {
103   - if (this.get('id') == '')
104   - return false;
  135 + //Create layout object in relation with the type
  136 + switch (layoutType)
  137 + {
  138 + case 'vertical' :
  139 + return new amdaPlotObj.PlotLayoutVerticalObject(data);
  140 + case 'auto' :
  141 + return new amdaPlotObj.PlotLayoutAutoObject(data);
  142 + case 'manual' :
  143 + return new amdaPlotObj.PlotLayoutManualObject(data);
  144 + default :
  145 + return null;
  146 + }
  147 + },
  148 +
  149 + setLayout: function(layoutType)
  150 + {
  151 + if (layoutType == this.get('page-layout-type'))
  152 + return;
  153 +
  154 + this.set('page-layout-type', layoutType);
  155 + this.set('page-layout-object', this.createLayoutByType(layoutType));
  156 + },
  157 +
  158 + setDefaultValues: function()
  159 + {
  160 + this.set('file-format', amdaPlotObj.PlotObjectConfig.defaultValues.file.format);
  161 + this.set('file-output', amdaPlotObj.PlotObjectConfig.defaultValues.file.output);
  162 + this.set('file-prefix', '');
  163 + this.set('one-file-per-interval', amdaPlotObj.PlotObjectConfig.defaultValues.file.oneFilePerInterval);
  164 + this.set('name', '');
  165 +
  166 + this.set('tree-full-view', amdaPlotObj.PlotObjectConfig.defaultValues.tree.fullView);
105 167  
  168 + this.set('multi-plot-linked', false);
  169 +
  170 + this.set('page-title-text', '');
  171 + this.set('page-title-color', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.color);
  172 + this.set('page-title-position', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.position);
  173 + this.set('page-title-alignment', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.alignment);
  174 +
  175 + this.set('page-title-font-activated', false);
  176 + this.set('page-title-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.name);
  177 + this.set('page-title-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.size);
  178 + this.set('page-title-font-bold', false);
  179 + this.set('page-title-font-italic', false);
  180 +
  181 + this.set('page-margins-activated', false);
  182 + this.set('page-margin-x', amdaPlotObj.PlotObjectConfig.defaultValues.page.xMargin);
  183 + this.set('page-margin-y', amdaPlotObj.PlotObjectConfig.defaultValues.page.yMargin);
  184 + this.set('page-mode', amdaPlotObj.PlotObjectConfig.defaultValues.page.mode);
  185 + this.set('page-orientation', amdaPlotObj.PlotObjectConfig.defaultValues.page.orientation);
  186 + this.set('page-dimension', amdaPlotObj.PlotObjectConfig.defaultValues.page.dimension);
  187 + this.set('page-superpose-mode', false);
  188 + this.set('page-font-activated', false);
  189 + this.set('page-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.name);
  190 + this.set('page-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.size);
  191 + this.set('page-font-bold', false);
  192 + this.set('page-font-italic', false);
  193 +
  194 + this.setLayout(amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type);
  195 + },
  196 +
  197 + getPageShortInfo : function()
  198 + {
  199 + var dimension = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageDimensions, this.get('page-dimension'));
  200 + var orientation = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageOrientations, this.get('page-orientation'));
  201 +
  202 + var info = dimension+', '+orientation;
  203 + if (this.get('page-superpose-mode'))
  204 + info += ', Epoch superposed mode';
  205 + return info;
  206 + },
  207 +
  208 + getLayoutShortInfo : function()
  209 + {
  210 + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageLayouts, this.get('page-layout-type'));
  211 + return type;
  212 + },
  213 +
  214 + isDirty : function()
  215 + {
106 216 if (this.dirty)
107 217 return true;
108 218  
  219 + if (this.get('page-layout-object') != null)
  220 + if (this.get('page-layout-object').dirty)
  221 + return true;
  222 +
109 223 var d = false;
110   - this.tabs().each(function (tab, index) {
111   - if (tab.isDirty())
  224 + this.panels().each(function (panel, index) {
  225 + if (panel.isDirty())
112 226 d = true;
113 227 });
114 228 return d;
115 229 },
116 230  
117   - getJsonValues : function(hasId)
  231 + getJsonValues : function()
118 232 {
119 233 var requestValues = new Object();
120 234  
121   - requestValues['nodeType'] = 'request';
122   -
123   - if (hasId) {
124   - requestValues['id'] = this.get('id');
125   - }
126   -
127   - requestValues['leaf'] = true;
  235 + requestValues['id'] = this.get('id');
  236 +
  237 + requestValues['file-format'] = this.get('file-format');
  238 + requestValues['file-output'] = this.get('file-output');
  239 + requestValues['file-prefix'] = this.get('file-prefix');
  240 + requestValues['one-file-per-interval'] = this.get('one-file-per-interval');
  241 +
  242 + requestValues['tree-full-view'] = this.get('tree-full-view');
  243 + requestValues['multi-plot-linked'] = this.get('multi-plot-linked');
  244 + requestValues['page-node-state'] = this.get('page-node-state');
  245 + requestValues['panels-node-state'] = this.get('panels-node-state');
  246 +
  247 + requestValues['page-title-text'] = this.get('page-title-text');
  248 + requestValues['page-title-color'] = this.get('page-title-color');
  249 + requestValues['page-title-position'] = this.get('page-title-position');
  250 + requestValues['page-title-alignment'] = this.get('page-title-alignment');
  251 + requestValues['page-title-font-activated'] = this.get('page-title-font-activated');
  252 + requestValues['page-title-font-name'] = this.get('page-title-font-name');
  253 + requestValues['page-title-font-size'] = this.get('page-title-font-size');
  254 + requestValues['page-title-font-bold'] = this.get('page-title-font-bold');
  255 + requestValues['page-title-font-italic'] = this.get('page-title-font-italic');
  256 + requestValues['page-margins-activated'] = this.get('page-margins-activated');
  257 + requestValues['page-margin-x'] = this.get('page-margin-x');
  258 + requestValues['page-margin-y'] = this.get('page-margin-y');
  259 + requestValues['page-mode'] = this.get('page-mode');
  260 + requestValues['page-orientation'] = this.get('page-orientation');
  261 + requestValues['page-dimension'] = this.get('page-dimension');
  262 + requestValues['page-superpose-mode'] = this.get('page-superpose-mode');
  263 + requestValues['page-font-activated'] = this.get('page-font-activated');
  264 + requestValues['page-font-name'] = this.get('page-font-name');
  265 + requestValues['page-font-size'] = this.get('page-font-size');
  266 + requestValues['page-font-bold'] = this.get('page-font-bold');
  267 + requestValues['page-font-italic'] = this.get('page-font-italic');
128 268  
129   - requestValues['file-format'] = this.get('file-format');
130   - requestValues['file-output'] = this.get('file-output');
131   - requestValues['file-prefix'] = this.get('file-prefix');
132   - requestValues['one-file-per-interval'] = this.get('one-file-per-interval');
133   - requestValues['last-plotted-tab'] = this.get('last-plotted-tab');
134   - requestValues['name'] = this.get('name');
135   -
136   - requestValues['timesrc'] = this.get('timesrc');
137   -
  269 + requestValues['timesrc'] = this.get('timesrc');
138 270 // if there's at least one timeTable name into 'timeTables' collection
139 271 if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){
140 272 // get complete timeTables collection
... ... @@ -152,23 +284,26 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
152 284 }
153 285 });
154 286 } else {
155   - requestValues['startDate'] = this.get('startDate');
156   - requestValues['stopDate'] = this.get('stopDate');
157   - requestValues['durationDay'] = this.get('durationDay');
158   - requestValues['durationHour'] = this.get('durationHour');
159   - requestValues['durationMin'] = this.get('durationMin');
160   - requestValues['durationSec'] = this.get('durationSec');
161   - }
  287 + requestValues['startDate'] = this.get('startDate');
  288 + requestValues['stopDate'] = this.get('stopDate');
  289 + requestValues['durationDay'] = this.get('durationDay');
  290 + requestValues['durationHour'] = this.get('durationHour');
  291 + requestValues['durationMin'] = this.get('durationMin');
  292 + requestValues['durationSec'] = this.get('durationSec');
  293 + }
162 294  
163   - requestValues['tabs'] = [];
164   -
165   - this.tabs().each(function (tab, index) {
166   - requestValues['tabs'][index] = tab.getJsonValues();
167   - });
168   -
169   - requestValues['active-tab-id'] = this.get('active-tab-id');
170   - requestValues['last-tab-id'] = this.get('last-tab-id');
171   -
172   - return requestValues;
  295 + requestValues['page-layout-type'] = this.get('page-layout-type');
  296 + if (this.get('page-layout-object') != null)
  297 + requestValues['page-layout-object'] = this.get('page-layout-object').getJsonValues();
  298 +
  299 + requestValues['panels'] = [];
  300 +
  301 + this.panels().each(function (panel, index) {
  302 + requestValues['panels'][index] = panel.getJsonValues();
  303 + });
  304 +
  305 + requestValues['last-panel-id'] = this.get('last-panel-id');
  306 +
  307 + return requestValues;
173 308 }
174 309 });
... ...
js/app/models/PlotObjects/PlotTabObject.js deleted
... ... @@ -1,294 +0,0 @@
1   -/**
2   - * Project  : AMDA-NG
3   - * Name : PlotTabObject.js
4   - * @class amdaPlotObj.PlotTabObject
5   - * @extends amdaModel.AmdaTimeObject
6   - * @brief Plot Tab Business Object Definition
7   - * @author Benjamin Renard
8   - * @version $Id: PlotTabObject.js benjamin $
9   - ******************************************************************************
10   - * FT Id : Date : Name - Description
11   - ******************************************************************************
12   - * : :22/07/2015: BRE - file creation
13   - */
14   -
15   -
16   -Ext.define('amdaPlotObj.PlotTabObject', {
17   - extend: 'amdaModel.AmdaTimeObject',
18   - idProperty: 'id',
19   -
20   - requires: [
21   - 'amdaPlotObj.PlotObjectConfig',
22   - 'amdaPlotObj.PlotPanelObject',
23   - 'amdaPlotObj.PlotLayoutVerticalObject',
24   - 'amdaPlotObj.PlotLayoutAutoObject',
25   - 'amdaPlotObj.PlotLayoutManualObject'
26   - ],
27   -
28   - fields : [
29   - {name: 'id', type: 'int'},
30   - {name: 'tab-name', type: 'string', defaultValue: ''},
31   - {name: 'tree-full-view', type: 'boolean'},
32   - {name: 'multi-plot-linked', type: 'boolean'},
33   - {name: 'page-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
34   - {name: 'panels-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
35   - {name: 'page-title-text', type: 'string'},
36   - {name: 'page-title-color', type: 'string'},
37   - {name: 'page-title-position', type: 'string'},
38   - {name: 'page-title-alignment', type: 'string'},
39   - {name: 'page-title-font-activated', type: 'boolean'},
40   - {name: 'page-title-font-name', type: 'string'},
41   - {name: 'page-title-font-size', type: 'int'},
42   - {name: 'page-title-font-bold', type: 'boolean'},
43   - {name: 'page-title-font-italic', type: 'boolean'},
44   - {name: 'page-margins-activated', type: 'boolean'},
45   - {name: 'page-margin-x', type: 'float'},
46   - {name: 'page-margin-y', type: 'float'},
47   - {name: 'page-mode', type: 'string'},
48   - {name: 'page-orientation', type: 'string'},
49   - {name: 'page-dimension', type: 'string'},
50   - {name: 'page-superpose-mode', type: 'boolean'},
51   - {name: 'page-font-activated', type: 'boolean'},
52   - {name: 'page-font-name', type: 'string'},
53   - {name: 'page-font-size', type: 'int'},
54   - {name: 'page-font-bold', type: 'boolean'},
55   - {name: 'page-font-italic', type: 'boolean'},
56   - {name: 'page-layout-type', type: 'string'},
57   - {name: 'page-layout-object', type: 'auto', defaultValue: null},
58   - {name: 'last-panel-id', type: 'int', defaultValue: 0}
59   - ],
60   -
61   - associations : [
62   - {
63   - type : 'hasMany',
64   - model : 'amdaPlotObj.PlotPanelObject',
65   - name : 'panels'
66   - },
67   - {
68   - type : 'belongsTo',
69   - model : 'amdaPlotObj.PlotRequestObject'
70   - }
71   - ],
72   -
73   - constructor: function(){
74   - var me = this;
75   - me.callParent(arguments);
76   - if ((arguments.length > 0) && arguments[0])
77   - {
78   - if (arguments[0].panels)
79   - me.loadPanels(arguments[0].panels);
80   - if (arguments[0]['page-layout-object'])
81   - me.loadLayoutObject(arguments[0]['page-layout-object']);
82   - }
83   - else
84   - {
85   - //new object, set default fields values
86   - me.setDefaultValues();
87   - }
88   - this.dirty = false;
89   - },
90   -
91   - loadPanels: function(panels)
92   - {
93   - this.panels().loadData(panels);
94   - this.updatePanelIndex();
95   - },
96   -
97   - loadLayoutObject: function(layout)
98   - {
99   - this.set('page-layout-object', this.createLayoutByType(this.get('page-layout-type'), layout));
100   - if (this.get('page-layout-object') != null)
101   - this.get('page-layout-object').dirty = false;
102   - },
103   -
104   - createNewPanel: function() {
105   - this.set('last-panel-id', this.get('last-panel-id') + 1);
106   - var recs = this.panels().add({id : this.get('last-panel-id')});
107   - recs[0].setDefaultValues();
108   - this.dirty = true;
109   - this.updatePanelIndex();
110   - return recs[0];
111   - },
112   -
113   - removePanelById: function(panelId) {
114   - //Retrieve panel record
115   - var panelRecord = this.panels().getById(panelId);
116   - if (panelRecord == null)
117   - return false;
118   - this.panels().remove(panelRecord);
119   - this.dirty = true;
120   - this.updatePanelIndex();
121   - return true;
122   - },
123   -
124   - updatePanelIndex: function() {
125   - this.panels().each(function(panel, index) {
126   - panel.set('panel-index', index);
127   - });
128   - },
129   -
130   - createLayoutByType : function(layoutType, data)
131   - {
132   - //Create layout object in relation with the type
133   - switch (layoutType)
134   - {
135   - case 'vertical' :
136   - return new amdaPlotObj.PlotLayoutVerticalObject(data);
137   - case 'auto' :
138   - return new amdaPlotObj.PlotLayoutAutoObject(data);
139   - case 'manual' :
140   - return new amdaPlotObj.PlotLayoutManualObject(data);
141   - default :
142   - return null;
143   - }
144   - },
145   -
146   - setLayout: function(layoutType)
147   - {
148   - if (layoutType == this.get('page-layout-type'))
149   - return;
150   -
151   - this.set('page-layout-type', layoutType);
152   - this.set('page-layout-object', this.createLayoutByType(layoutType));
153   - },
154   -
155   - setDefaultValues: function()
156   - {
157   - this.set('tree-full-view', amdaPlotObj.PlotObjectConfig.defaultValues.tree.fullView);
158   -
159   - this.set('multi-plot-linked', false);
160   -
161   - this.set('page-title-text', '');
162   - this.set('page-title-color', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.color);
163   - this.set('page-title-position', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.position);
164   - this.set('page-title-alignment', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.alignment);
165   -
166   - this.set('page-title-font-activated', false);
167   - this.set('page-title-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.name);
168   - this.set('page-title-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.size);
169   - this.set('page-title-font-bold', false);
170   - this.set('page-title-font-italic', false);
171   -
172   - this.set('page-margins-activated', false);
173   - this.set('page-margin-x', amdaPlotObj.PlotObjectConfig.defaultValues.page.xMargin);
174   - this.set('page-margin-y', amdaPlotObj.PlotObjectConfig.defaultValues.page.yMargin);
175   - this.set('page-mode', amdaPlotObj.PlotObjectConfig.defaultValues.page.mode);
176   - this.set('page-orientation', amdaPlotObj.PlotObjectConfig.defaultValues.page.orientation);
177   - this.set('page-dimension', amdaPlotObj.PlotObjectConfig.defaultValues.page.dimension);
178   - this.set('page-superpose-mode', false);
179   - this.set('page-font-activated', false);
180   - this.set('page-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.name);
181   - this.set('page-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.size);
182   - this.set('page-font-bold', false);
183   - this.set('page-font-italic', false);
184   -
185   - this.setLayout(amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type);
186   - },
187   -
188   - getPageShortInfo : function()
189   - {
190   - var dimension = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageDimensions, this.get('page-dimension'));
191   - var orientation = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageOrientations, this.get('page-orientation'));
192   -
193   - var info = dimension+', '+orientation;
194   - if (this.get('page-superpose-mode'))
195   - info += ', Epoch superposed mode';
196   - return info;
197   - },
198   -
199   - getLayoutShortInfo : function()
200   - {
201   - var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availablePageLayouts, this.get('page-layout-type'));
202   - return type;
203   - },
204   -
205   - isDirty : function()
206   - {
207   - if (this.dirty)
208   - return true;
209   -
210   - if (this.get('page-layout-object') != null)
211   - if (this.get('page-layout-object').dirty)
212   - return true;
213   -
214   - var d = false;
215   - this.panels().each(function (panel, index) {
216   - if (panel.isDirty())
217   - d = true;
218   - });
219   - return d;
220   - },
221   -
222   - getJsonValues : function()
223   - {
224   - var tabValues = new Object();
225   -
226   - tabValues['id'] = this.get('id');
227   - tabValues['tab-name'] = this.get('tab-name');
228   - tabValues['tree-full-view'] = this.get('tree-full-view');
229   - tabValues['multi-plot-linked'] = this.get('multi-plot-linked');
230   - tabValues['page-node-state'] = this.get('page-node-state');
231   - tabValues['panels-node-state'] = this.get('panels-node-state');
232   - tabValues['page-title-text'] = this.get('page-title-text');
233   - tabValues['page-title-color'] = this.get('page-title-color');
234   - tabValues['page-title-position'] = this.get('page-title-position');
235   - tabValues['page-title-alignment'] = this.get('page-title-alignment');
236   - tabValues['page-title-font-activated'] = this.get('page-title-font-activated');
237   - tabValues['page-title-font-name'] = this.get('page-title-font-name');
238   - tabValues['page-title-font-size'] = this.get('page-title-font-size');
239   - tabValues['page-title-font-bold'] = this.get('page-title-font-bold');
240   - tabValues['page-title-font-italic'] = this.get('page-title-font-italic');
241   - tabValues['page-margins-activated'] = this.get('page-margins-activated');
242   - tabValues['page-margin-x'] = this.get('page-margin-x');
243   - tabValues['page-margin-y'] = this.get('page-margin-y');
244   - tabValues['page-mode'] = this.get('page-mode');
245   - tabValues['page-orientation'] = this.get('page-orientation');
246   - tabValues['page-dimension'] = this.get('page-dimension');
247   - tabValues['page-superpose-mode'] = this.get('page-superpose-mode');
248   - tabValues['page-font-activated'] = this.get('page-font-activated');
249   - tabValues['page-font-name'] = this.get('page-font-name');
250   - tabValues['page-font-size'] = this.get('page-font-size');
251   - tabValues['page-font-bold'] = this.get('page-font-bold');
252   - tabValues['page-font-italic'] = this.get('page-font-italic');
253   -
254   - tabValues['timesrc'] = this.get('timesrc');
255   - // if there's at least one timeTable name into 'timeTables' collection
256   - if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){
257   - // get complete timeTables collection
258   - var timeTables = this.get('timeTables');
259   - // init an empty array for timeTables
260   - tabValues['timeTables'] = [];
261   - // for each interval record
262   - Ext.Array.each(timeTables, function(item, index, all){
263   - if (!item.$className) {
264   - tabValues['timeTables'][index] = {timeTableName : item.timeTableName, id : item.id};
265   - }
266   - // get Json simplified value
267   - else {
268   - tabValues['timeTables'][index] = item.getJsonValues();
269   - }
270   - });
271   - } else {
272   - tabValues['startDate'] = this.get('startDate');
273   - tabValues['stopDate'] = this.get('stopDate');
274   - tabValues['durationDay'] = this.get('durationDay');
275   - tabValues['durationHour'] = this.get('durationHour');
276   - tabValues['durationMin'] = this.get('durationMin');
277   - tabValues['durationSec'] = this.get('durationSec');
278   - }
279   -
280   - tabValues['page-layout-type'] = this.get('page-layout-type');
281   - if (this.get('page-layout-object') != null)
282   - tabValues['page-layout-object'] = this.get('page-layout-object').getJsonValues();
283   -
284   - tabValues['panels'] = [];
285   -
286   - this.panels().each(function (panel, index) {
287   - tabValues['panels'][index] = panel.getJsonValues();
288   - });
289   -
290   - tabValues['last-panel-id'] = this.get('last-panel-id');
291   -
292   - return tabValues;
293   - }
294   -});