Commit 41109aaa83cdb1789ff864679a16b26ea4c02ac0

Authored by Benjamin Renard
1 parent 1ecf03bb

Set amdaPlotObj.PlotObjectConfig.defaultValues in constructor

js/app/models/PlotObjects/PlotLayoutAutoObject.js
@@ -14,18 +14,41 @@ @@ -14,18 +14,41 @@
14 14
15 15
16 Ext.define('amdaPlotObj.PlotLayoutAutoObject', { 16 Ext.define('amdaPlotObj.PlotLayoutAutoObject', {
17 - extend: 'Ext.data.Model', 17 + extend: 'Ext.data.Model',
18 18
19 - requires: [  
20 - 'amdaPlotObj.PlotObjectConfig'  
21 - ], 19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
22 22
23 - fields : [  
24 - {name: 'layout-panel-height', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight},  
25 - {name: 'layout-panel-spacing', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing},  
26 - {name: 'layout-expand', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand},  
27 - {name: 'layout-timeaxes-legend-lowerone', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend} 23 + fields : [
  24 + {name: 'layout-panel-height', type: 'float'},
  25 + {name: 'layout-panel-spacing', type: 'float'},
  26 + {name: 'layout-expand', type: 'boolean'},
  27 + {name: 'layout-timeaxes-legend-lowerone', type: 'boolean'}
28 ], 28 ],
  29 +
  30 + constructor: function()
  31 + {
  32 + var me = this;
  33 + me.callParent(arguments);
  34 + if ((arguments.length > 0) && arguments[0])
  35 + {
  36 + }
  37 + else
  38 + {
  39 + //new object, set default fields values
  40 + me.setDefaultValues();
  41 + }
  42 + this.dirty = false;
  43 + },
  44 +
  45 + setDefaultValues: function()
  46 + {
  47 + this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight);
  48 + this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing);
  49 + this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand);
  50 + this.set('layout-timeaxes-legend-lowerone', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend);
  51 + },
29 52
30 getJsonValues : function() 53 getJsonValues : function()
31 { 54 {
js/app/models/PlotObjects/PlotLayoutVerticalObject.js
@@ -14,23 +14,45 @@ @@ -14,23 +14,45 @@
14 14
15 15
16 Ext.define('amdaPlotObj.PlotLayoutVerticalObject', { 16 Ext.define('amdaPlotObj.PlotLayoutVerticalObject', {
17 - extend: 'Ext.data.Model', 17 + extend: 'Ext.data.Model',
18 18
19 - requires: [  
20 - 'amdaPlotObj.PlotObjectConfig'  
21 - ], 19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
22 22
23 - fields : [  
24 - {name: 'layout-panel-height', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight},  
25 - {name: 'layout-panel-spacing', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing},  
26 - {name: 'layout-expand', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand},  
27 - {name: 'layout-timeaxes-legend-lowerone', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend},  
28 - //{name: 'layout-timeplot-width', type: 'float', useNull:true},  
29 - {name: 'layout-timeplot-height', type: 'float', useNull:true},  
30 - {name: 'layout-xyplot-width', type: 'float', useNull:true},  
31 - {name: 'layout-xyplot-height', type: 'float', useNull:true} 23 + fields : [
  24 + {name: 'layout-panel-height', type: 'float'},
  25 + {name: 'layout-panel-spacing', type: 'float'},
  26 + {name: 'layout-expand', type: 'boolean'},
  27 + {name: 'layout-timeaxes-legend-lowerone', type: 'boolean'},
  28 + //{name: 'layout-timeplot-width', type: 'float', useNull:true},
  29 + {name: 'layout-timeplot-height', type: 'float', useNull:true},
  30 + {name: 'layout-xyplot-width', type: 'float', useNull:true},
  31 + {name: 'layout-xyplot-height', type: 'float', useNull:true}
32 ], 32 ],
33 - 33 +
  34 + constructor: function()
  35 + {
  36 + var me = this;
  37 + me.callParent(arguments);
  38 + if ((arguments.length > 0) && arguments[0])
  39 + {
  40 + }
  41 + else {
  42 + //new object, set default fields values
  43 + me.setDefaultValues();
  44 + }
  45 + this.dirty = false;
  46 + },
  47 +
  48 + setDefaultValues: function()
  49 + {
  50 + this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight);
  51 + this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing);
  52 + this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand);
  53 + this.set('layout-timeaxes-legend-lowerone', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend);
  54 + },
  55 +
34 getJsonValues : function() 56 getJsonValues : function()
35 { 57 {
36 var layoutValues = new Object(); 58 var layoutValues = new Object();
js/app/models/PlotObjects/PlotLegendSeriesObject.js
@@ -14,32 +14,46 @@ @@ -14,32 +14,46 @@
14 14
15 15
16 Ext.define('amdaPlotObj.PlotLegendSeriesObject', { 16 Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
17 - extend: 'Ext.data.Model', 17 + extend: 'Ext.data.Model',
18 18
19 - requires: [  
20 - 'amdaPlotObj.PlotObjectConfig'  
21 - ], 19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
22 22
23 - fields : [  
24 - {name: 'legend-series-activated', type: 'boolean', defaultValue: false},  
25 - {name: 'legend-series-type', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type},  
26 - {name: 'legend-series-position', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position},  
27 - {name: 'legend-series-showparaminfo', type: 'boolean', defaultValue: true},  
28 - {name: 'legend-series-defaulttextcolor', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.text.color},  
29 - {name: 'legend-series-border-activated', type: 'boolean', defaultValue: false},  
30 - {name: 'legend-series-border-color', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.border.color},  
31 - {name: 'legend-series-intervalinfo-activated', type: 'boolean', defaultValue: false},  
32 - {name: 'legend-series-intervalinfo-type', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.intervalinfo.type},  
33 - {name: 'legend-series-font-activated', type: 'boolean', defaultValue: false},  
34 - {name: 'legend-series-font-name', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name},  
35 - {name: 'legend-series-font-size', type: 'int', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size},  
36 - {name: 'legend-series-font-bold', type: 'boolean', defaultValue: false},  
37 - {name: 'legend-series-font-italic', type: 'boolean', defaultValue: false} 23 + fields : [
  24 + {name: 'legend-series-activated', type: 'boolean'},
  25 + {name: 'legend-series-type', type: 'string'},
  26 + {name: 'legend-series-position', type: 'string'},
  27 + {name: 'legend-series-showparaminfo', type: 'boolean'},
  28 + {name: 'legend-series-defaulttextcolor', type: 'string'},
  29 + {name: 'legend-series-border-activated', type: 'boolean'},
  30 + {name: 'legend-series-border-color', type: 'string'},
  31 + {name: 'legend-series-intervalinfo-activated', type: 'boolean'},
  32 + {name: 'legend-series-intervalinfo-type', type: 'string'},
  33 + {name: 'legend-series-font-activated', type: 'boolean'},
  34 + {name: 'legend-series-font-name', type: 'string'},
  35 + {name: 'legend-series-font-size', type: 'int'},
  36 + {name: 'legend-series-font-bold', type: 'boolean'},
  37 + {name: 'legend-series-font-italic', type: 'boolean'}
38 ], 38 ],
  39 +
  40 + constructor: function()
  41 + {
  42 + var me = this;
  43 + me.callParent(arguments);
  44 + if ((arguments.length > 0) && arguments[0])
  45 + {
  46 + }
  47 + else {
  48 + //new object, set default fields values
  49 + me.setDefaultValues();
  50 + }
  51 + this.dirty = false;
  52 + },
39 53
40 setDefaultValues: function() 54 setDefaultValues: function()
41 { 55 {
42 - /*this.set('legend-series-activated', false); 56 + this.set('legend-series-activated', false);
43 this.set('legend-series-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type); 57 this.set('legend-series-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type);
44 this.set('legend-series-position', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position); 58 this.set('legend-series-position', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position);
45 this.set('legend-series-showparaminfo', true); 59 this.set('legend-series-showparaminfo', true);
@@ -52,7 +66,7 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', { @@ -52,7 +66,7 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
52 this.set('legend-series-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name); 66 this.set('legend-series-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name);
53 this.set('legend-series-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size); 67 this.set('legend-series-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size);
54 this.set('legend-series-font-bold', false); 68 this.set('legend-series-font-bold', false);
55 - this.set('legend-series-font-italic', false);*/ 69 + this.set('legend-series-font-italic', false);
56 }, 70 },
57 71
58 getShortInfo : function() 72 getShortInfo : function()
@@ -86,4 +100,4 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', { @@ -86,4 +100,4 @@ Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
86 100
87 return legendValues; 101 return legendValues;
88 } 102 }
89 -});  
90 \ No newline at end of file 103 \ No newline at end of file
  104 +});