Commit abe09878693cffdf107b69e6b5bcd408c2f631d4
1 parent
dca17cf3
Exists in
master
and in
111 other branches
Add panels and axes options definitions
Showing
27 changed files
with
889 additions
and
61 deletions
Show diff stats
js/app/controllers/NewPlotModule.js
... | ... | @@ -73,7 +73,7 @@ Ext.define('amdaDesktop.NewPlotModule', { |
73 | 73 | |
74 | 74 | startInteractiveSession : function(session) { |
75 | 75 | var me = this; |
76 | - Ext.each(session.result, function (tabResult) { | |
76 | + Ext.each(session.result, function (tabResult, index) { | |
77 | 77 | var winResultId = tabResult.id+"-win"; |
78 | 78 | |
79 | 79 | var winResult = me.getWindowResult(winResultId); |
... | ... | @@ -92,7 +92,7 @@ Ext.define('amdaDesktop.NewPlotModule', { |
92 | 92 | |
93 | 93 | var win = myDesktopApp.getDesktop().createWindow({ |
94 | 94 | id : tabResult.id+"-win", |
95 | - title : tabResult.id, | |
95 | + title : 'Plot '+(index+1), | |
96 | 96 | width : size.width, |
97 | 97 | height: size.height, |
98 | 98 | layout: 'fit', |
... | ... |
... | ... | @@ -0,0 +1,125 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotAxisObject.js | |
4 | + * @class amdaPlotObj.PlotAxisObject | |
5 | + * @extends Ext.data.Model | |
6 | + * @brief Plot Axis Business Object Definition | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotAxisObject.js benjamin $ | |
9 | + ****************************************************************************** | |
10 | + * FT Id : Date : Name - Description | |
11 | + ****************************************************************************** | |
12 | + * : :14/08/2015: BRE - file creation | |
13 | + */ | |
14 | + | |
15 | + | |
16 | +Ext.define('amdaPlotObj.PlotAxisObject', { | |
17 | + extend: 'Ext.data.Model', | |
18 | + | |
19 | + requires: [ | |
20 | + 'amdaPlotObj.PlotObjectConfig' | |
21 | + ], | |
22 | + | |
23 | + fields : [ | |
24 | + {name: 'id', type: 'string'}, | |
25 | + //axis-type can be : time, y-left, y-right, x, color, epoch | |
26 | + {name: 'axis-type', type: 'string'}, | |
27 | + {name: 'axis-reverse', type: 'boolean'}, | |
28 | + {name: 'axis-scale', type: 'string'}, | |
29 | + {name: 'axis-range-min', type: 'float'}, | |
30 | + {name: 'axis-range-max', type: 'float'}, | |
31 | + {name: 'axis-range-extend', type: 'bool'}, | |
32 | + {name: 'axis-color', type: 'string'}, | |
33 | + {name: 'axis-thickness', type: 'int'}, | |
34 | + {name: 'axis-tick-position', type: 'string'}, | |
35 | + {name: 'axis-grid-minor', type: 'bool'}, | |
36 | + {name: 'axis-grid-major', type: 'bool'}, | |
37 | + {name: 'axis-legend-text', type: 'string'}, | |
38 | + {name: 'axis-legend-color', type: 'string'}, | |
39 | + {name: 'axis-legend-font-activated', type: 'boolean'}, | |
40 | + {name: 'axis-legend-font-name', type: 'string'}, | |
41 | + {name: 'axis-legend-font-size', type: 'int'}, | |
42 | + {name: 'axis-legend-font-bold', type: 'boolean'}, | |
43 | + {name: 'axis-legend-font-italic', type: 'boolean'}, | |
44 | + //only used for time axis | |
45 | + {name: 'axis-time-format', type: 'string'}, | |
46 | + //only used for epoch axis | |
47 | + {name: 'axis-epoch-normalized', type: 'boolean'}, | |
48 | + //only used for color axis | |
49 | + {name: 'axis-color-map', type: 'string'}, | |
50 | + {name: 'axis-color-minval', type: 'string'}, | |
51 | + {name: 'axis-color-maxval', type: 'string'} | |
52 | + ], | |
53 | + | |
54 | + associations : [ | |
55 | + { | |
56 | + type : 'belongsTo', | |
57 | + model : 'amdaPlotObj.PlotPanelObject', | |
58 | + ownerName : 'panel' | |
59 | + } | |
60 | + ], | |
61 | + | |
62 | + setDefaultValues: function(type) | |
63 | + { | |
64 | + this.set('axis-type', type); | |
65 | + this.set('axis-reverse', false); | |
66 | + this.set('axis-scale', amdaPlotObj.PlotObjectConfig.defaultValues.axis.scale); | |
67 | + this.set('axis-range-min', 0); | |
68 | + this.set('axis-range-max', 0); | |
69 | + this.set('axis-range-extend', true); | |
70 | + this.set('axis-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.color); | |
71 | + this.set('axis-thickness', amdaPlotObj.PlotObjectConfig.defaultValues.axis.thickness); | |
72 | + this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition); | |
73 | + this.set('axis-grid-minor', false); | |
74 | + this.set('axis-grid-major', false); | |
75 | + this.set('axis-legend-text', ''); | |
76 | + this.set('axis-legend-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.color); | |
77 | + this.set('axis-legend-font-activated', false); | |
78 | + this.set('axis-legend-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.font.name); | |
79 | + this.set('axis-legend-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.font.size); | |
80 | + this.set('axis-legend-font-bold', false); | |
81 | + this.set('axis-legend-font-italic', false); | |
82 | + this.set('axis-time-format', amdaPlotObj.PlotObjectConfig.defaultValues.axis.timeFormat); | |
83 | + this.set('axis-epoch-normalized', false); | |
84 | + this.set('axis-color-map', amdaPlotObj.PlotObjectConfig.defaultValues.axis.colorMap); | |
85 | + this.set('axis-color-minval', 'none'); | |
86 | + this.set('axis-color-maxval', 'none'); | |
87 | + }, | |
88 | + | |
89 | + getJsonValues : function(hasId) | |
90 | + { | |
91 | + var axisValues = new Object(); | |
92 | + | |
93 | + axisValues['axis-type'] = this.get('axis-type'); | |
94 | + axisValues['axis-reverse'] = this.get('axis-reverse'); | |
95 | + axisValues['axis-scale'] = this.get('axis-scale'); | |
96 | + axisValues['axis-range-min'] = this.get('axis-range-min'); | |
97 | + axisValues['axis-range-max'] = this.get('axis-range-max'); | |
98 | + axisValues['axis-range-extend'] = this.get('axis-range-extend'); | |
99 | + axisValues['axis-color'] = this.get('axis-color'); | |
100 | + axisValues['axis-thickness'] = this.get('axis-thickness'); | |
101 | + axisValues['axis-tick-position'] = this.get('axis-tick-position'); | |
102 | + axisValues['axis-grid-minor'] = this.get('axis-grid-minor'); | |
103 | + axisValues['axis-grid-major'] = this.get('axis-grid-major'); | |
104 | + axisValues['axis-legend-text'] = this.get('axis-legend-text'); | |
105 | + axisValues['axis-legend-color'] = this.get('axis-legend-color'); | |
106 | + axisValues['axis-legend-font-activated'] = this.get('axis-legend-font-activated'); | |
107 | + axisValues['axis-legend-font-name'] = this.get('axis-legend-font-name'); | |
108 | + axisValues['axis-legend-font-size'] = this.get('axis-legend-font-size'); | |
109 | + axisValues['axis-legend-font-bold'] = this.get('axis-legend-font-bold'); | |
110 | + axisValues['axis-legend-font-italic'] = this.get('axis-legend-font-italic'); | |
111 | + | |
112 | + if (axisValues['axis-type'] == 'time') | |
113 | + axisValues['axis-time-format'] = this.get('axis-time-format'); | |
114 | + if (axisValues['axis-type'] == 'epoch') | |
115 | + axisValues['axis-epoch-normalized'] = this.get('axis-epoch-normalized'); | |
116 | + if (axisValues['axis-type'] == 'color') | |
117 | + { | |
118 | + axisValues['axis-color-map'] = this.get('axis-color-map'); | |
119 | + axisValues['axis-color-minval'] = this.get('axis-color-minval'); | |
120 | + axisValues['axis-color-maxval'] = this.get('axis-color-maxval'); | |
121 | + } | |
122 | + | |
123 | + return axisValues; | |
124 | + } | |
125 | +}); | |
0 | 126 | \ No newline at end of file |
... | ... |
js/app/models/PlotObjects/PlotObjectConfig.js
... | ... | @@ -37,6 +37,34 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { |
37 | 37 | name : 'sans-serif', |
38 | 38 | size: '12' |
39 | 39 | } |
40 | + }, | |
41 | + panel : { | |
42 | + plotType : 'timePlot', | |
43 | + title : { | |
44 | + position: 'bottom', | |
45 | + alignment: ' center', | |
46 | + color: '#000000' | |
47 | + }, | |
48 | + font : { | |
49 | + name : 'sans-serif', | |
50 | + size: '12' | |
51 | + }, | |
52 | + backgroundColor : 'none' | |
53 | + }, | |
54 | + axis : { | |
55 | + scale : 'linear', | |
56 | + tickPosition : 'outwards', | |
57 | + color : '#000000', | |
58 | + thickness : '1', | |
59 | + legend : { | |
60 | + color: '#000000', | |
61 | + font : { | |
62 | + name : 'sans-serif', | |
63 | + size: '12' | |
64 | + } | |
65 | + }, | |
66 | + timeFormat : 'dd/mm/yy', | |
67 | + colorMap : '1' | |
40 | 68 | } |
41 | 69 | }, |
42 | 70 | |
... | ... | @@ -73,6 +101,15 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { |
73 | 101 | {'key' : 'US letter', 'value' : 'US letter'} |
74 | 102 | ], |
75 | 103 | |
104 | + availablePlotTypes : [ | |
105 | + {'key' : 'timePlot', value : 'Time Plot'}, | |
106 | + {'key' : 'xyPlot', value : 'Scatter Plot'}, | |
107 | + {'key' : 'epochPlot', value : 'Epoch Plot'}, | |
108 | + {'key' : 'instantPlot', value : 'Instant Plot'}, | |
109 | + {'key' : 'statusPlot', value : 'Status Plot'}, | |
110 | + {'key' : 'tickPlot', value : 'Tick Plot'} | |
111 | + ], | |
112 | + | |
76 | 113 | availableFontNames : [ |
77 | 114 | {'key' : 'sans-serif', 'value' : 'sans-serif'}, |
78 | 115 | {'key' : 'serif', 'value' : 'serif'}, |
... | ... | @@ -91,9 +128,38 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { |
91 | 128 | {'key' : 'right', 'value' : 'Right'} |
92 | 129 | ], |
93 | 130 | |
131 | + availableAxisScales : [ | |
132 | + {'key' : 'linear', 'value' : 'Linear'}, | |
133 | + {'key' : 'logarithmic', 'value' : 'Logarithmic'} | |
134 | + ], | |
135 | + | |
136 | + availableTicksPositions : [ | |
137 | + {'key' : 'inwards', 'value' : 'Inwards'}, | |
138 | + {'key' : 'outwards', 'value' : 'Outwards'} | |
139 | + ], | |
140 | + | |
141 | + availableTimeAxisFormats : [ | |
142 | + {'key' : 'dd/mm/yy', 'value' : 'dd/mm/yy'}, | |
143 | + {'key' : 'ddd/yy', 'value' : 'ddd/yy'}, | |
144 | + {'key' : 'DD/MM/YYYY', 'value' : 'DD/MM/YYYY'} | |
145 | + ], | |
146 | + | |
147 | + availableColorMaps : [ | |
148 | + {'key' : '0', 'value' : 'Default'}, | |
149 | + {'key' : '1', 'value' : 'Blue Red'}, | |
150 | + {'key' : '2', 'value' : 'Blue Yellow'}, | |
151 | + {'key' : '3', 'value' : 'Grayscale'} | |
152 | + ], | |
153 | + | |
94 | 154 | availableColors : [ |
95 | 155 | {'color' : '#000000', 'value' : 'Black'}, |
96 | 156 | {'color' : '#0000FF', 'value' : 'Blue'}, |
97 | 157 | {'color' : '#FF0000', 'value' : 'Red'} |
158 | + ], | |
159 | + | |
160 | + availableBackgroundColors : [ | |
161 | + {'color' : 'none', 'value' : 'None'}, | |
162 | + {'color' : '#0000FF', 'value' : 'Blue'}, | |
163 | + {'color' : '#FF0000', 'value' : 'Red'} | |
98 | 164 | ] |
99 | 165 | }); |
100 | 166 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,175 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotPanelObject.js | |
4 | + * @class amdaPlotObj.PlotPanelObject | |
5 | + * @extends Ext.data.Model | |
6 | + * @brief Plot Panel Business Object Definition | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotPanelObject.js benjamin $ | |
9 | + ****************************************************************************** | |
10 | + * FT Id : Date : Name - Description | |
11 | + ****************************************************************************** | |
12 | + * : :13/08/2015: BRE - file creation | |
13 | + */ | |
14 | + | |
15 | + | |
16 | +Ext.define('amdaPlotObj.PlotPanelObject', { | |
17 | + extend: 'Ext.data.Model', | |
18 | + | |
19 | + requires: [ | |
20 | + 'amdaPlotObj.PlotObjectConfig', | |
21 | + 'amdaPlotObj.PlotAxisObject' | |
22 | + ], | |
23 | + | |
24 | + fields : [ | |
25 | + {name: 'id', type: 'string'}, | |
26 | + {name: 'panel-background-color', type: 'string'}, | |
27 | + {name: 'panel-title-text', type: 'string'}, | |
28 | + {name: 'panel-title-color', type: 'string'}, | |
29 | + {name: 'panel-title-position', type: 'string'}, | |
30 | + {name: 'panel-title-alignment', type: 'string'}, | |
31 | + {name: 'panel-title-font-activated', type: 'boolean'}, | |
32 | + {name: 'panel-title-font-name', type: 'string'}, | |
33 | + {name: 'panel-title-font-size', type: 'int'}, | |
34 | + {name: 'panel-title-font-bold', type: 'boolean'}, | |
35 | + {name: 'panel-title-font-italic', type: 'boolean'}, | |
36 | + {name: 'panel-margin-x', type: 'float'}, | |
37 | + {name: 'panel-margin-y', type: 'float'}, | |
38 | + {name: 'panel-plot-type', type: 'string'}, | |
39 | + {name: 'panel-font-activated', type: 'boolean'}, | |
40 | + {name: 'panel-font-name', type: 'string'}, | |
41 | + {name: 'panel-font-size', type: 'int'}, | |
42 | + {name: 'panel-font-bold', type: 'boolean'}, | |
43 | + {name: 'panel-font-italic', type: 'boolean'} | |
44 | + ], | |
45 | + | |
46 | + associations : [ | |
47 | + { | |
48 | + type : 'hasMany', | |
49 | + model : 'amdaPlotObj.PlotAxisObject', | |
50 | + name : 'axes' | |
51 | + }, | |
52 | + { | |
53 | + type : 'belongsTo', | |
54 | + model : 'amdaPlotObj.PlotTabObject', | |
55 | + ownerName : 'tab' | |
56 | + } | |
57 | + ], | |
58 | + | |
59 | + initAxes : function() | |
60 | + { | |
61 | + this.axes().removeAll(); | |
62 | + switch (this.get('panel-plot-type')) | |
63 | + { | |
64 | + case 'timePlot' : | |
65 | + //Time axis | |
66 | + var recs = this.axes().add({id : 'time'}); | |
67 | + recs[0].setDefaultValues('time'); | |
68 | + //Y Left Axis | |
69 | + recs = this.axes().add({id : 'y-left'}); | |
70 | + recs[0].setDefaultValues('y-left'); | |
71 | + //Y Right Axis | |
72 | + recs = this.axes().add({id : 'y-right'}); | |
73 | + recs[0].setDefaultValues('y-right'); | |
74 | + //Color Axis | |
75 | + recs = this.axes().add({id : 'color'}); | |
76 | + recs[0].setDefaultValues('color'); | |
77 | + break; | |
78 | + case 'xyPlot' : | |
79 | + case 'instantPlot' : | |
80 | + //X Axis | |
81 | + var recs = this.axes().add({id : 'x'}); | |
82 | + recs[0].setDefaultValues('x'); | |
83 | + //Y Left Axis | |
84 | + recs = this.axes().add({id : 'y-left'}); | |
85 | + recs[0].setDefaultValues('y-left'); | |
86 | + //Y Right Axis | |
87 | + recs = this.axes().add({id : 'y-right'}); | |
88 | + recs[0].setDefaultValues('y-right'); | |
89 | + //Color Axis | |
90 | + recs = this.axes().add({id : 'color'}); | |
91 | + recs[0].setDefaultValues('color'); | |
92 | + break; | |
93 | + case 'epochPlot' : | |
94 | + //Epoch Axis | |
95 | + var recs = this.axes().add({id : 'epoch'}); | |
96 | + recs[0].setDefaultValues('epoch'); | |
97 | + //Y Left Axis | |
98 | + recs = this.axes().add({id : 'y-left'}); | |
99 | + recs[0].setDefaultValues('y-left'); | |
100 | + //Y Right Axis | |
101 | + recs = this.axes().add({id : 'y-right'}); | |
102 | + recs[0].setDefaultValues('y-right'); | |
103 | + //Color Axis | |
104 | + recs = this.axes().add({id : 'color'}); | |
105 | + recs[0].setDefaultValues('color'); | |
106 | + break; | |
107 | + case 'statusPlot' : | |
108 | + case 'tickPlot' : | |
109 | + //Time axis | |
110 | + var recs = this.axes().add({id : 'time'}); | |
111 | + recs[0].setDefaultValues('time'); | |
112 | + break; | |
113 | + } | |
114 | + }, | |
115 | + | |
116 | + setDefaultValues: function() | |
117 | + { | |
118 | + this.set('panel-background-color', amdaPlotObj.PlotObjectConfig.defaultValues.panel.backgroundColor); | |
119 | + this.set('panel-title-text', ''); | |
120 | + this.set('panel-title-color', amdaPlotObj.PlotObjectConfig.defaultValues.panel.title.color); | |
121 | + this.set('panel-title-position', amdaPlotObj.PlotObjectConfig.defaultValues.panel.title.position); | |
122 | + this.set('panel-title-alignment', amdaPlotObj.PlotObjectConfig.defaultValues.panel.title.alignment); | |
123 | + | |
124 | + this.set('panel-title-font-activated', false); | |
125 | + this.set('panel-title-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.panel.font.name); | |
126 | + this.set('panel-title-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.panel.font.size); | |
127 | + this.set('panel-title-font-bold', false); | |
128 | + this.set('panel-title-font-italic', false); | |
129 | + | |
130 | + this.set('panel-margin-x', 0); | |
131 | + this.set('panel-margin-y', 0); | |
132 | + | |
133 | + this.set('panel-plot-type', amdaPlotObj.PlotObjectConfig.defaultValues.panel.plotType); | |
134 | + | |
135 | + this.set('panel-font-activated', false); | |
136 | + this.set('panel-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.panel.font.name); | |
137 | + this.set('panel-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.panel.font.size); | |
138 | + this.set('panel-font-bold', false); | |
139 | + this.set('panel-font-italic', false); | |
140 | + | |
141 | + this.initAxes(); | |
142 | + }, | |
143 | + | |
144 | + getJsonValues : function(hasId) | |
145 | + { | |
146 | + var panelValues = new Object(); | |
147 | + | |
148 | + panelValues['panel-background-color'] = this.get('panel-background-color'); | |
149 | + panelValues['panel-title-text'] = this.get('panel-title-text'); | |
150 | + panelValues['panel-title-color'] = this.get('panel-title-color'); | |
151 | + panelValues['panel-title-position'] = this.get('panel-title-position'); | |
152 | + panelValues['panel-title-alignment'] = this.get('panel-title-alignment'); | |
153 | + panelValues['panel-title-font-activated'] = this.get('panel-title-font-activated'); | |
154 | + panelValues['panel-title-font-name'] = this.get('panel-title-font-name'); | |
155 | + panelValues['panel-title-font-size'] = this.get('panel-title-font-size'); | |
156 | + panelValues['panel-title-font-bold'] = this.get('panel-title-font-bold'); | |
157 | + panelValues['panel-title-font-italic'] = this.get('panel-title-font-italic'); | |
158 | + panelValues['panel-margin-x'] = this.get('panel-margin-x'); | |
159 | + panelValues['panel-margin-y'] = this.get('panel-margin-y'); | |
160 | + panelValues['panel-plot-type'] = this.get('panel-plot-type'); | |
161 | + panelValues['panel-font-activated'] = this.get('panel-font-activated'); | |
162 | + panelValues['panel-font-name'] = this.get('panel-font-name'); | |
163 | + panelValues['panel-font-size'] = this.get('panel-font-size'); | |
164 | + panelValues['panel-font-bold'] = this.get('panel-font-bold'); | |
165 | + panelValues['panel-font-italic'] = this.get('panel-font-italic'); | |
166 | + | |
167 | + panelValues['axes'] = []; | |
168 | + | |
169 | + this.axes().each(function (axe, index) { | |
170 | + panelValues['axes'][index] = axe.getJsonValues(); | |
171 | + }); | |
172 | + | |
173 | + return panelValues; | |
174 | + } | |
175 | +}); | |
0 | 176 | \ No newline at end of file |
... | ... |
js/app/models/PlotObjects/PlotRequestObject.js
... | ... | @@ -17,6 +17,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', { |
17 | 17 | extend: 'amdaModel.AmdaTimeObject', |
18 | 18 | idProperty: 'id', |
19 | 19 | |
20 | + lastTabId : 0, | |
21 | + | |
20 | 22 | requires: [ |
21 | 23 | 'amdaPlotObj.PlotObjectConfig', |
22 | 24 | 'amdaPlotObj.PlotTabObject' |
... | ... | @@ -45,6 +47,18 @@ Ext.define('amdaPlotObj.PlotRequestObject', { |
45 | 47 | this.set('request-name', ''); |
46 | 48 | }, |
47 | 49 | |
50 | + createNewTab: function() { | |
51 | + var recs = this.tabs().add({id : this.lastTabId}); | |
52 | + ++this.lastTabId; | |
53 | + recs[0].setDefaultValues(); | |
54 | + return recs[0]; | |
55 | + }, | |
56 | + | |
57 | + removeTab: function(tabId) { | |
58 | + var tabToRemove = this.tabs().get(tabId); | |
59 | + console.log(tabId); | |
60 | + }, | |
61 | + | |
48 | 62 | getJsonValues : function(hasId) |
49 | 63 | { |
50 | 64 | var requestValues = new Object(); |
... | ... |
js/app/models/PlotObjects/PlotTabObject.js
... | ... | @@ -15,9 +15,13 @@ |
15 | 15 | |
16 | 16 | Ext.define('amdaPlotObj.PlotTabObject', { |
17 | 17 | extend: 'Ext.data.Model', |
18 | + idProperty: 'id', | |
19 | + | |
20 | + lastPanelId : 0, | |
18 | 21 | |
19 | 22 | requires: [ |
20 | - 'amdaPlotObj.PlotObjectConfig' | |
23 | + 'amdaPlotObj.PlotObjectConfig', | |
24 | + 'amdaPlotObj.PlotPanelObject' | |
21 | 25 | ], |
22 | 26 | |
23 | 27 | fields : [ |
... | ... | @@ -47,12 +51,24 @@ Ext.define('amdaPlotObj.PlotTabObject', { |
47 | 51 | |
48 | 52 | associations : [ |
49 | 53 | { |
54 | + type : 'hasMany', | |
55 | + model : 'amdaPlotObj.PlotPanelObject', | |
56 | + name : 'panels' | |
57 | + }, | |
58 | + { | |
50 | 59 | type : 'belongsTo', |
51 | 60 | model : 'amdaPlotObj.PlotRequestObject', |
52 | 61 | ownerName : 'request' |
53 | 62 | } |
54 | 63 | ], |
55 | 64 | |
65 | + createNewPanel: function() { | |
66 | + var recs = this.panels().add({id : this.lastPanelId}); | |
67 | + ++this.lastPanelId; | |
68 | + recs[0].setDefaultValues(); | |
69 | + return recs[0]; | |
70 | + }, | |
71 | + | |
56 | 72 | setDefaultValues: function() |
57 | 73 | { |
58 | 74 | this.set('page-title-text', ''); |
... | ... | @@ -106,6 +122,12 @@ Ext.define('amdaPlotObj.PlotTabObject', { |
106 | 122 | tabValues['page-font-bold'] = this.get('page-font-bold'); |
107 | 123 | tabValues['page-font-italic'] = this.get('page-font-italic'); |
108 | 124 | |
125 | + tabValues['panels'] = []; | |
126 | + | |
127 | + this.panels().each(function (panel, index) { | |
128 | + tabValues['panels'][index] = panel.getJsonValues(); | |
129 | + }); | |
130 | + | |
109 | 131 | return tabValues; |
110 | 132 | } |
111 | 133 | }); |
112 | 134 | \ No newline at end of file |
... | ... |
js/app/models/PlotObjects/PlotTreeNode.js
... | ... | @@ -27,16 +27,23 @@ Ext.define('amdaPlotObj.PlotTreeNode', { |
27 | 27 | //Node leaf |
28 | 28 | leaf: false, |
29 | 29 | |
30 | + //Node expanded | |
31 | + expanded : true, | |
32 | + | |
30 | 33 | //Link to the object associated to this node |
31 | 34 | object: null, |
32 | 35 | |
36 | + //Additional information about a node to show in the tree view | |
37 | + getAdditionalText : null, | |
38 | + | |
33 | 39 | constructor : function(config) |
34 | 40 | { |
35 | 41 | this.callParent(arguments); |
36 | 42 | this.set('text',this.text); |
37 | 43 | this.set('iconCls',this.iconCls); |
38 | 44 | this.set('leaf',this.leaf); |
39 | - this.set('expanded',true); | |
45 | + this.set('expanded',this.expanded); | |
46 | + this.set('type',this.type); | |
40 | 47 | if (config && config.object) |
41 | 48 | this.object = config.object; |
42 | 49 | } |
... | ... | @@ -51,7 +58,12 @@ Ext.define('amdaPlotObj.PlotPageTreeNode', { |
51 | 58 | |
52 | 59 | text: 'Page', |
53 | 60 | |
54 | - type: 'page' | |
61 | + type: 'page', | |
62 | + | |
63 | + getAdditionalText: function() | |
64 | + { | |
65 | + return ' ('+this.object.get('page-dimension')+', '+this.object.get('page-orientation')+')'; | |
66 | + } | |
55 | 67 | }); |
56 | 68 | |
57 | 69 | Ext.define('amdaPlotObj.PlotLayoutTreeNode', { |
... | ... | @@ -83,22 +95,31 @@ Ext.define('amdaPlotObj.PlotPanelTreeNode', { |
83 | 95 | |
84 | 96 | text: 'Panel', |
85 | 97 | |
86 | - type: 'panel' | |
98 | + type: 'panel', | |
99 | + | |
100 | + getAdditionalText: function() | |
101 | + { | |
102 | + return ' ('+this.object.get('panel-plot-type')+')'; | |
103 | + } | |
87 | 104 | }); |
88 | 105 | |
89 | -Ext.define('amdaPlotObj.PlotAxisTreeNode', { | |
106 | +Ext.define('amdaPlotObj.PlotAxesTreeNode', { | |
90 | 107 | extend: 'amdaPlotObj.PlotTreeNode', |
91 | 108 | |
92 | - iconCls: 'icon-plot-axis', | |
109 | + expanded: false, | |
93 | 110 | |
94 | - text: 'Axis', | |
111 | + iconCls: 'icon-plot-axes', | |
95 | 112 | |
96 | - type: 'axis' | |
113 | + text: 'Axes', | |
114 | + | |
115 | + type: 'axes' | |
97 | 116 | }); |
98 | 117 | |
99 | 118 | Ext.define('amdaPlotObj.PlotTimeAxisTreeNode', { |
100 | 119 | extend: 'amdaPlotObj.PlotTreeNode', |
101 | 120 | |
121 | + leaf: true, | |
122 | + | |
102 | 123 | iconCls: 'icon-plot-axis-t', |
103 | 124 | |
104 | 125 | text: 'Time Axis', |
... | ... | @@ -106,6 +127,68 @@ Ext.define('amdaPlotObj.PlotTimeAxisTreeNode', { |
106 | 127 | type: 'time-axis' |
107 | 128 | }); |
108 | 129 | |
130 | +Ext.define('amdaPlotObj.PlotEpochAxisTreeNode', { | |
131 | + extend: 'amdaPlotObj.PlotTreeNode', | |
132 | + | |
133 | + leaf: true, | |
134 | + | |
135 | + iconCls: 'icon-plot-axis-e', | |
136 | + | |
137 | + text: 'Epoch Axis', | |
138 | + | |
139 | + type: 'epoch-axis' | |
140 | +}); | |
141 | + | |
142 | +Ext.define('amdaPlotObj.PlotXAxisTreeNode', { | |
143 | + extend: 'amdaPlotObj.PlotTreeNode', | |
144 | + | |
145 | + leaf: true, | |
146 | + | |
147 | + iconCls: 'icon-plot-axis-x', | |
148 | + | |
149 | + text: 'X Axis', | |
150 | + | |
151 | + type: 'x-axis' | |
152 | +}); | |
153 | + | |
154 | +Ext.define('amdaPlotObj.PlotYLeftAxisTreeNode', { | |
155 | + extend: 'amdaPlotObj.PlotTreeNode', | |
156 | + | |
157 | + leaf: true, | |
158 | + | |
159 | + iconCls: 'icon-plot-axis-y-left', | |
160 | + | |
161 | + text: 'Y Left Axis', | |
162 | + | |
163 | + type: 'y-left-axis' | |
164 | +}); | |
165 | + | |
166 | +Ext.define('amdaPlotObj.PlotYRightAxisTreeNode', { | |
167 | + extend: 'amdaPlotObj.PlotTreeNode', | |
168 | + | |
169 | + leaf: true, | |
170 | + | |
171 | + iconCls: 'icon-plot-axis-y-right', | |
172 | + | |
173 | + text: 'Y Right Axis', | |
174 | + | |
175 | + type: 'y-right-axis' | |
176 | +}); | |
177 | + | |
178 | +Ext.define('amdaPlotObj.PlotColorAxisTreeNode', { | |
179 | + extend: 'amdaPlotObj.PlotTreeNode', | |
180 | + | |
181 | + leaf: true, | |
182 | + | |
183 | + iconCls: 'icon-plot-axis-color', | |
184 | + | |
185 | + text: 'Color Axis', | |
186 | + | |
187 | + type: 'color-axis' | |
188 | +}); | |
189 | + | |
190 | + | |
191 | + | |
109 | 192 | Ext.define('amdaPlotObj.PlotLegendsTreeNode', { |
110 | 193 | extend: 'amdaPlotObj.PlotTreeNode', |
111 | 194 | |
... | ... |
js/app/views/NewPlotUI.js
... | ... | @@ -33,10 +33,9 @@ Ext.define('amdaUI.NewPlotUI', { |
33 | 33 | this.callParent(arguments); |
34 | 34 | if (this.object) |
35 | 35 | { |
36 | - this.object.setDefaultValues(); | |
37 | 36 | //Force first tab creation |
38 | - var tabs = this.object.tabs().add({id : 1}); | |
39 | - tabs[0].setDefaultValues(); | |
37 | + this.object.setDefaultValues(); | |
38 | + this.object.createNewTab(); | |
40 | 39 | this.setObject(this.object); |
41 | 40 | } |
42 | 41 | }, |
... | ... |
... | ... | @@ -0,0 +1,53 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotBaseAxisForm.js | |
4 | + * @class amdaPlotComp.PlotBaseAxisForm | |
5 | + * @extends amdaPlotComp.PlotStandardForm | |
6 | + * @brief Form to define common options of all axes | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotBaseAxisForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotBaseAxisForm', { | |
12 | + extend: 'amdaPlotComp.PlotStandardForm', | |
13 | + | |
14 | + showScaleOption : true, | |
15 | + showColorOption : true, | |
16 | + showRangeOptions : true, | |
17 | + showTickGridOptions : true, | |
18 | + | |
19 | + getFormItems: function() { | |
20 | + var rangeItems = [ | |
21 | + this.addStandardFloat('axis-range-min', 'Min', Number.MIN_VALUE, Number.MAX_VALUE), | |
22 | + this.addStandardFloat('axis-range-min', 'Max', Number.MIN_VALUE, Number.MAX_VALUE), | |
23 | + this.addStandardCheck('axis-range-extend', 'Extend Axis Range') | |
24 | + ]; | |
25 | + | |
26 | + var legendItems = [ | |
27 | + this.addStandardText('axis-legend-text', 'Text'), | |
28 | + this.addStandardColor('axis-legend-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors), | |
29 | + this.addStandardFont('axis-legend-font') | |
30 | + ]; | |
31 | + | |
32 | + var tickGridItems = [ | |
33 | + this.addStandardCombo('axis-tick-position', 'Ticks position', amdaPlotObj.PlotObjectConfig.availableTicksPositions), | |
34 | + this.addStandardCheck('axis-grid-major', 'Major grid'), | |
35 | + this.addStandardCheck('axis-grid-minor', 'Minor grid') | |
36 | + ]; | |
37 | + | |
38 | + var axisItems = []; | |
39 | + if (this.showScaleOption) | |
40 | + axisItems.push(this.addStandardCombo('axis-scale', 'Scale', amdaPlotObj.PlotObjectConfig.availableAxisScales)); | |
41 | + if (this.showColorOption) | |
42 | + axisItems.push(this.addStandardColor('axis-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)); | |
43 | + axisItems.push(this.addStandardFloat('axis-thickness', 'Thickness', 1, 10)); | |
44 | + axisItems.push(this.addStandardCheck('axis-reverse', 'Reverse direction')); | |
45 | + if (this.showRangeOptions) | |
46 | + axisItems.push(this.addStandardFieldSet('Range', '', rangeItems)); | |
47 | + axisItems.push(this.addStandardFieldSet('Legend', '', legendItems)); | |
48 | + if (this.showTickGridOptions) | |
49 | + axisItems.push(this.addStandardFieldSet('Ticks and Grid', '', tickGridItems)); | |
50 | + | |
51 | + return axisItems; | |
52 | + } | |
53 | +}); | |
0 | 54 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotColorAxisForm.js | |
4 | + * @class amdaPlotComp.PlotColorAxisForm | |
5 | + * @extends amdaPlotComp.PlotBaseAxisForm | |
6 | + * @brief Form to define specifics color axis options | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotColorAxisForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotColorAxisForm', { | |
12 | + extend: 'amdaPlotComp.PlotBaseAxisForm', | |
13 | + | |
14 | + showColorOption : false, | |
15 | + showTickGridOptions : false, | |
16 | + | |
17 | + getFormItems: function() { | |
18 | + var timeItems = [ | |
19 | + this.addStandardCombo('axis-color-map', 'Color Map', amdaPlotObj.PlotObjectConfig.availableColorMaps), | |
20 | + this.addStandardColor('axis-color-minval', 'Min. Val. Color', amdaPlotObj.PlotObjectConfig.availableColors), | |
21 | + this.addStandardColor('axis-color-maxval', 'Max. Val. Color', amdaPlotObj.PlotObjectConfig.availableColors) | |
22 | + ]; | |
23 | + | |
24 | + return Ext.Array.merge(timeItems, this.callParent()); | |
25 | + } | |
26 | +}); | |
0 | 27 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotElementPanel.js
... | ... | @@ -12,37 +12,80 @@ Ext.define('amdaPlotComp.PlotElementPanel', { |
12 | 12 | extend: 'Ext.form.Panel', |
13 | 13 | |
14 | 14 | requires: [ |
15 | - 'amdaPlotComp.PlotPageForm' | |
15 | + 'amdaPlotComp.PlotPageForm', | |
16 | + 'amdaPlotComp.PlotPanelForm', | |
17 | + 'amdaPlotComp.PlotBaseAxisForm', | |
18 | + 'amdaPlotComp.PlotTimeAxisForm', | |
19 | + 'amdaPlotComp.PlotEpochAxisForm', | |
20 | + 'amdaPlotComp.PlotColorAxisForm' | |
16 | 21 | ], |
17 | 22 | |
23 | + elementFormsManager : new Ext.AbstractManager(), | |
24 | + | |
25 | + crtObject : null, | |
26 | + crtTree : null, | |
27 | + | |
18 | 28 | constructor: function(config) { |
19 | 29 | this.init(config); |
20 | 30 | this.callParent(arguments); |
21 | 31 | }, |
22 | 32 | |
23 | - setElement: function(type, object) { | |
24 | - this.removeAll(); | |
33 | + setElement: function(type, object, tree) { | |
34 | + this.removeAll(false); | |
25 | 35 | |
26 | - if (type == null || type == '') | |
27 | - { | |
28 | - this.add(new Ext.form.Label({text: 'Select an element to the tree to show options'})); | |
29 | - return; | |
30 | - } | |
36 | + crtObject = object; | |
37 | + crtTree = tree; | |
31 | 38 | |
32 | - switch (type) | |
33 | - { | |
34 | - case 'page' : | |
35 | - var pageForm = new amdaPlotComp.PlotPageForm(); | |
36 | - this.add(pageForm); | |
37 | - pageForm.setObject(object); | |
38 | - break; | |
39 | - default : | |
40 | - this.add(new Ext.form.Label({text: 'No available options for this element'})); | |
41 | - } | |
39 | + var elementForm = this.getElementForm(type); | |
40 | + this.add(elementForm); | |
41 | + if (elementForm.setObject) | |
42 | + elementForm.setObject(object); | |
42 | 43 | }, |
43 | 44 | |
44 | 45 | resetElement: function() { |
45 | - this.setElement(null,null); | |
46 | + this.setElement('',null); | |
47 | + }, | |
48 | + | |
49 | + getElementForm: function(type) { | |
50 | + var formId = type; | |
51 | + if (type == '') | |
52 | + formId = 'none'; | |
53 | + formId += '-element-form'; | |
54 | + | |
55 | + if (!this.elementFormsManager.get(formId)) | |
56 | + { | |
57 | + //Create element form | |
58 | + switch (type) | |
59 | + { | |
60 | + case 'page' : | |
61 | + this.elementFormsManager.register(new amdaPlotComp.PlotPageForm({id : formId})); | |
62 | + break; | |
63 | + case 'panel' : | |
64 | + this.elementFormsManager.register(new amdaPlotComp.PlotPanelForm({id : formId})); | |
65 | + break; | |
66 | + case 'time-axis' : | |
67 | + this.elementFormsManager.register(new amdaPlotComp.PlotTimeAxisForm({id : formId})); | |
68 | + break; | |
69 | + case 'epoch-axis' : | |
70 | + this.elementFormsManager.register(new amdaPlotComp.PlotEpochAxisForm({id : formId})); | |
71 | + break; | |
72 | + case 'color-axis' : | |
73 | + this.elementFormsManager.register(new amdaPlotComp.PlotColorAxisForm({id : formId})); | |
74 | + break; | |
75 | + case 'x-axis' : | |
76 | + case 'y-left-axis' : | |
77 | + case 'y-right-axis' : | |
78 | + this.elementFormsManager.register(new amdaPlotComp.PlotBaseAxisForm({id : formId})); | |
79 | + break; | |
80 | + case '' : | |
81 | + this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'})); | |
82 | + break; | |
83 | + default : | |
84 | + this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this element'})); | |
85 | + } | |
86 | + | |
87 | + } | |
88 | + return this.elementFormsManager.get(formId); | |
46 | 89 | }, |
47 | 90 | |
48 | 91 | init : function(config) { |
... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotEpochAxisForm.js | |
4 | + * @class amdaPlotComp.PlotEpochAxisForm | |
5 | + * @extends amdaPlotComp.PlotBaseAxisForm | |
6 | + * @brief Form to define specifics epoch axis options | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotEpochAxisForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotEpochAxisForm', { | |
12 | + extend: 'amdaPlotComp.PlotBaseAxisForm', | |
13 | + | |
14 | + showScaleOption : false, | |
15 | + showRangeOptions : false, | |
16 | + | |
17 | + getFormItems: function() { | |
18 | + var epochItems = [ | |
19 | + this.addStandardCheck('axis-epoch-normalized', 'Normalized') | |
20 | + ]; | |
21 | + | |
22 | + return Ext.Array.merge(timeItems, this.callParent()); | |
23 | + } | |
24 | +}); | |
0 | 25 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotOutputForm.js
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | Ext.define('amdaPlotComp.PlotOutputForm', { |
12 | 12 | extend: 'amdaPlotComp.PlotStandardForm', |
13 | 13 | |
14 | - title: 'output options', | |
14 | + title: 'Output options', | |
15 | 15 | |
16 | 16 | updateOneFilePerIntOption : function() { |
17 | 17 | var formatField = this.getForm().findField('file-format'); |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotPanelForm.js | |
4 | + * @class amdaPlotComp.PlotPanelForm | |
5 | + * @extends amdaPlotComp.PlotStandardForm | |
6 | + * @brief Form to define panel options | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotPanelForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotPanelForm', { | |
12 | + extend: 'amdaPlotComp.PlotStandardForm', | |
13 | + | |
14 | + getFormItems: function() { | |
15 | + var titleItems = [ | |
16 | + this.addStandardText('panel-title-text', 'Text'), | |
17 | + this.addStandardColor('panel-title-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors), | |
18 | + this.addStandardCombo('panel-title-position', 'Position', amdaPlotObj.PlotObjectConfig.availableTitlePositions), | |
19 | + this.addStandardCombo('panel-title-alignment', 'Alignment', amdaPlotObj.PlotObjectConfig.availableTitleAlignments), | |
20 | + this.addStandardFont('panel-title-font') | |
21 | + ]; | |
22 | + | |
23 | + var marginItems = [ | |
24 | + this.addStandardFloat('panel-margin-x', 'Horizontal', 0, 100), | |
25 | + this.addStandardFloat('panel-margin-y', 'Vertical', 0, 100) | |
26 | + ]; | |
27 | + | |
28 | + return [ | |
29 | + this.addStandardCombo('panel-plot-type', 'Plot type', amdaPlotObj.PlotObjectConfig.availablePlotTypes, function(name, value) { | |
30 | + this.crtObject.initAxes(); | |
31 | + this.crtTree.buildPanelAxesNode(this.crtObject); | |
32 | + }), | |
33 | + this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors), | |
34 | + this.addStandardFieldSet('Title', '', titleItems), | |
35 | + this.addStandardFieldSet('Margins', '', marginItems), | |
36 | + this.addStandardFont('panel-font') | |
37 | + ]; | |
38 | + } | |
39 | +}); | |
0 | 40 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotStandardForm.js
... | ... | @@ -78,6 +78,7 @@ Ext.define('amdaPlotComp.PlotStandardForm', { |
78 | 78 | queryMode: 'local', |
79 | 79 | displayField: 'value', |
80 | 80 | valueField: 'key', |
81 | + editable: false, | |
81 | 82 | listeners: { |
82 | 83 | change: function(combo, newValue, oldValue, eOpts) { |
83 | 84 | this.object.set(name, newValue); |
... | ... | @@ -201,6 +202,7 @@ Ext.define('amdaPlotComp.PlotStandardForm', { |
201 | 202 | queryMode: 'local', |
202 | 203 | displayField: 'value', |
203 | 204 | valueField: 'color', |
205 | + editable: false, | |
204 | 206 | tpl: Ext.create('Ext.XTemplate', |
205 | 207 | '<ul class="x-list-plain"><tpl for=".">', |
206 | 208 | '<li role="option" class="x-boundlist-item" style="color: {color};">{value}</li>', |
... | ... |
js/app/views/PlotComponents/PlotTabContent.js
... | ... | @@ -39,7 +39,7 @@ Ext.define('amdaPlotComp.PlotTabContent', { |
39 | 39 | |
40 | 40 | this.plotElementPanel = config.plotElementPanel; |
41 | 41 | |
42 | - var timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.tabNumber, flex: 2} ); | |
42 | + var timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.tabObjectId, flex: 2} ); | |
43 | 43 | this.treePlot = new amdaPlotComp.PlotTree({flex: 3, plotElementPanel: this.plotElementPanel}); |
44 | 44 | |
45 | 45 | var myConf = { |
... | ... |
js/app/views/PlotComponents/PlotTabPanel.js
... | ... | @@ -29,18 +29,20 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
29 | 29 | setRequestObject: function(object) |
30 | 30 | { |
31 | 31 | this.object = object; |
32 | + this.removeAll(); | |
32 | 33 | this.object.tabs().each(function (rec) { |
33 | - var tabContent = this.addPlotTab(); | |
34 | - tabContent.setTabObject(rec); | |
34 | + this.addPlotTab(rec); | |
35 | 35 | }, this); |
36 | 36 | }, |
37 | 37 | |
38 | - addPlotTab: function() | |
38 | + addPlotTab: function(tabObject) | |
39 | 39 | { |
40 | - var addIndex = this.items.length; | |
41 | - var tabContent = new amdaPlotComp.PlotTabContent({tabNumber: addIndex+1, plotElementPanel: this.plotElementPanel}); | |
40 | + var tabNumber = this.getTabBar().items.getCount(); | |
41 | + var tabContent = new amdaPlotComp.PlotTabContent({tabObjectId: tabObject.getId(), plotElementPanel: this.plotElementPanel}); | |
42 | + tabContent.setTabObject(tabObject); | |
42 | 43 | this.add({ |
43 | - title: 'Plot '+(addIndex+1), | |
44 | + title: 'Plot '+tabNumber, | |
45 | + tabObjectId: tabObject.getId(), | |
44 | 46 | closable: true, |
45 | 47 | layout: 'fit', |
46 | 48 | bodyStyle: 'background: none', |
... | ... | @@ -49,12 +51,44 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
49 | 51 | }, |
50 | 52 | items: [ |
51 | 53 | tabContent |
52 | - ] | |
54 | + ], | |
55 | + listeners : { | |
56 | + scope : this, | |
57 | + beforeclose: function( tab, eOpts ) { | |
58 | + if (this.items.getCount() == 1) | |
59 | + { | |
60 | + myDesktopApp.warningMsg('You need to keep at least one plot definition'); | |
61 | + return false; | |
62 | + } | |
63 | + return true; | |
64 | + }, | |
65 | + 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); | |
70 | + }, | |
71 | + destroy: function(tab, eOpts) { | |
72 | + this.updatePlotTabs(); | |
73 | + } | |
74 | + } | |
53 | 75 | }).show(); |
54 | 76 | |
55 | 77 | return tabContent; |
56 | 78 | }, |
57 | 79 | |
80 | + updatePlotTabs: function() | |
81 | + { | |
82 | + | |
83 | + var i = 0; | |
84 | + for (i = 0; i < this.items.getCount(); ++i) | |
85 | + { | |
86 | + var tabNumber = i+1; | |
87 | + 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)); | |
89 | + } | |
90 | + }, | |
91 | + | |
58 | 92 | getTreeFromPlotTab: function(plotTab) |
59 | 93 | { |
60 | 94 | return plotTab.child().treePlot; |
... | ... | @@ -78,23 +112,19 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
78 | 112 | text:'+', |
79 | 113 | closable: false, |
80 | 114 | handler:function(btn,e){ |
81 | - var tabContent = me.addPlotTab(); | |
82 | - console.log(me.object.tabs()); | |
83 | - var recs = me.object.tabs().add({id : me.object.tabs().length+1}); | |
84 | - | |
85 | - recs[0].setDefaultValues(); | |
86 | - tabContent.setTabObject(recs[0]); | |
115 | + var tabContent = me.addPlotTab(me.object.createNewTab()); | |
87 | 116 | } |
88 | 117 | }] |
89 | 118 | }, |
90 | 119 | |
91 | 120 | listeners: { |
92 | 121 | tabchange: function(tabPanel, newCard, oldCard, eOpts ) { |
93 | - var selectedNode = this.getTreeFromPlotTab(newCard).getSelectedNode(); | |
122 | + var newCardTree = this.getTreeFromPlotTab(newCard); | |
123 | + var selectedNode = newCardTree.getSelectedNode(); | |
94 | 124 | if (selectedNode == null) |
95 | 125 | me.plotElementPanel.resetElement(); |
96 | 126 | else |
97 | - me.plotElementPanel.setElement(selectedNode.type,selectedNode.object); | |
127 | + me.plotElementPanel.setElement(selectedNode.type,selectedNode.object, newCardTree); | |
98 | 128 | }, |
99 | 129 | scope: me |
100 | 130 | } |
... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotTimeAxisForm.js | |
4 | + * @class amdaPlotComp.PlotTimeAxisForm | |
5 | + * @extends amdaPlotComp.PlotBaseAxisForm | |
6 | + * @brief Form to define specifics time axis options | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotTimeAxisForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotTimeAxisForm', { | |
12 | + extend: 'amdaPlotComp.PlotBaseAxisForm', | |
13 | + | |
14 | + showScaleOption : false, | |
15 | + showRangeOptions : false, | |
16 | + | |
17 | + getFormItems: function() { | |
18 | + var timeItems = [ | |
19 | + this.addStandardCombo('axis-time-format', 'Time Format', amdaPlotObj.PlotObjectConfig.availableTimeAxisFormats) | |
20 | + ]; | |
21 | + | |
22 | + return Ext.Array.merge(timeItems, this.callParent()); | |
23 | + } | |
24 | +}); | |
0 | 25 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotTree.js
... | ... | @@ -19,7 +19,10 @@ Ext.define('amdaPlotComp.PlotTree', { |
19 | 19 | plotElementPanel: null, |
20 | 20 | |
21 | 21 | //Tab object |
22 | - object: null, | |
22 | + tabObject: null, | |
23 | + | |
24 | + //Panels list node | |
25 | + panelsNode: null, | |
23 | 26 | |
24 | 27 | constructor: function(config) { |
25 | 28 | this.init(config); |
... | ... | @@ -27,7 +30,10 @@ Ext.define('amdaPlotComp.PlotTree', { |
27 | 30 | }, |
28 | 31 | |
29 | 32 | buildTree: function(tabObject) { |
30 | - this.object = tabObject; | |
33 | + if (this.store.getRootNode().hasChildNodes()) | |
34 | + this.store.getRootNode().removeAll(); | |
35 | + | |
36 | + this.tabObject = tabObject; | |
31 | 37 | |
32 | 38 | //Page Node |
33 | 39 | var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject})); |
... | ... | @@ -36,18 +42,71 @@ Ext.define('amdaPlotComp.PlotTree', { |
36 | 42 | pageNode.appendChild(new amdaPlotObj.PlotLayoutTreeNode()); |
37 | 43 | |
38 | 44 | //Panels node |
39 | - var panelsNode = pageNode.appendChild(new amdaPlotObj.PlotPanelsTreeNode()); | |
45 | + this.panelsNode = pageNode.appendChild(new amdaPlotObj.PlotPanelsTreeNode()); | |
46 | + | |
47 | + var me = this; | |
48 | + this.tabObject.panels().each(function (panelObject) { | |
49 | + me.addPanel(panelObject); | |
50 | + }); | |
51 | + }, | |
52 | + | |
53 | + addPanel: function(panelObject) { | |
54 | + var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject})); | |
55 | + this.buildPanelAxesNode(panelObject); | |
56 | + }, | |
57 | + | |
58 | + buildPanelAxesNode: function(panelObject) { | |
59 | + var axesNode = null; | |
60 | + | |
61 | + this.panelsNode.eachChild(function (panelNode) { | |
62 | + //Retrieve corresponding panel node | |
63 | + if (panelNode.object == panelObject) | |
64 | + { | |
65 | + //Retrieve axes node | |
66 | + axesNode = panelNode.findChild('type', 'axes'); | |
67 | + if (!axesNode) | |
68 | + //create axes node | |
69 | + axesNode = panelNode.appendChild(new amdaPlotObj.PlotAxesTreeNode()); | |
70 | + return; | |
71 | + } | |
72 | + }); | |
40 | 73 | |
41 | - //Panel for test | |
42 | - var panelNode = panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode()); | |
43 | - var axisNode = panelNode.appendChild(new amdaPlotObj.PlotAxisTreeNode()); | |
44 | - axisNode.appendChild(new amdaPlotObj.PlotTimeAxisTreeNode()); | |
45 | - panelNode.appendChild(new amdaPlotObj.PlotLegendsTreeNode()); | |
74 | + if (axesNode == null) | |
75 | + return; | |
76 | + | |
77 | + //Remove old axis nodes | |
78 | + axesNode.removeAll(); | |
79 | + | |
80 | + //Add axis nodes | |
81 | + panelObject.axes().each(function (axisObject) { | |
82 | + switch (axisObject.get('axis-type')) | |
83 | + { | |
84 | + case 'time' : | |
85 | + axesNode.appendChild(new amdaPlotObj.PlotTimeAxisTreeNode({object : axisObject})); | |
86 | + break; | |
87 | + case 'epoch' : | |
88 | + axesNode.appendChild(new amdaPlotObj.PlotEpochAxisTreeNode({object : axisObject})); | |
89 | + break; | |
90 | + case 'x' : | |
91 | + axesNode.appendChild(new amdaPlotObj.PlotXAxisTreeNode({object : axisObject})); | |
92 | + break; | |
93 | + case 'y-left' : | |
94 | + axesNode.appendChild(new amdaPlotObj.PlotYLeftAxisTreeNode({object : axisObject})); | |
95 | + break; | |
96 | + case 'y-right' : | |
97 | + axesNode.appendChild(new amdaPlotObj.PlotYRightAxisTreeNode({object : axisObject})); | |
98 | + break; | |
99 | + case 'color' : | |
100 | + axesNode.appendChild(new amdaPlotObj.PlotColorAxisTreeNode({object : axisObject})); | |
101 | + break; | |
102 | + } | |
103 | + }); | |
104 | + this.getView().refresh(); | |
46 | 105 | }, |
47 | 106 | |
48 | 107 | onNodeSelect: function(tree,record, index, eOpts) { |
49 | 108 | if (this.plotElementPanel != null) |
50 | - this.plotElementPanel.setElement(record.type, record.object); | |
109 | + this.plotElementPanel.setElement(record.type, record.object, this); | |
51 | 110 | }, |
52 | 111 | |
53 | 112 | getSelectedNode: function() { |
... | ... | @@ -76,7 +135,31 @@ Ext.define('amdaPlotComp.PlotTree', { |
76 | 135 | listeners: { |
77 | 136 | select: me.onNodeSelect, |
78 | 137 | scope: me |
79 | - } | |
138 | + }, | |
139 | + columns: [ | |
140 | + { | |
141 | + xtype: 'treecolumn', | |
142 | + text: 'Plot Element', | |
143 | + flex: 1, | |
144 | + dataIndex: 'text', | |
145 | + renderer: function (val, meta, rec) { | |
146 | + var fullVal = val; | |
147 | + if (rec.getAdditionalText) | |
148 | + fullVal += rec.getAdditionalText(); | |
149 | + return fullVal; | |
150 | + } | |
151 | + } | |
152 | + ], | |
153 | + tbar: [ | |
154 | + { | |
155 | + xtype: 'button', | |
156 | + text: 'Add panel', | |
157 | + handler: function() { | |
158 | + this.addPanel(this.tabObject.createNewPanel()); | |
159 | + }, | |
160 | + scope: this | |
161 | + } | |
162 | + ] | |
80 | 163 | }; |
81 | 164 | |
82 | 165 | Ext.apply (this , Ext.apply (arguments, myConf)); |
... | ... |
js/resources/css/amda.css
... | ... | @@ -406,8 +406,8 @@ p + p { |
406 | 406 | background-image:url( ../images/16x16/plot_panel.png ) !important; |
407 | 407 | } |
408 | 408 | |
409 | -.icon-plot-axis { | |
410 | - background-image:url( ../images/16x16/plot_axis.png ) !important; | |
409 | +.icon-plot-axes { | |
410 | + background-image:url( ../images/16x16/plot_axes.png ) !important; | |
411 | 411 | } |
412 | 412 | |
413 | 413 | .icon-plot-legends { |
... | ... | @@ -418,6 +418,26 @@ p + p { |
418 | 418 | background-image:url( ../images/16x16/plot_axis_t.png ) !important; |
419 | 419 | } |
420 | 420 | |
421 | +.icon-plot-axis-e { | |
422 | + background-image:url( ../images/16x16/plot_axis_e.png ) !important; | |
423 | +} | |
424 | + | |
425 | +.icon-plot-axis-x { | |
426 | + background-image:url( ../images/16x16/plot_axis_x.png ) !important; | |
427 | +} | |
428 | + | |
429 | +.icon-plot-axis-y-left { | |
430 | + background-image:url( ../images/16x16/plot_axis_y_left.png ) !important; | |
431 | +} | |
432 | + | |
433 | +.icon-plot-axis-y-right { | |
434 | + background-image:url( ../images/16x16/plot_axis_y_right.png ) !important; | |
435 | +} | |
436 | + | |
437 | +.icon-plot-axis-color { | |
438 | + background-image:url( ../images/16x16/plot_axis_color.png ) !important; | |
439 | +} | |
440 | + | |
421 | 441 | .x-item-disabled .x-form-item-label { |
422 | 442 | filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100) !important; |
423 | 443 | opacity: 1.0 !important; |
... | ... |
js/resources/images/16x16/plot_axis.png renamed to js/resources/images/16x16/plot_axes.png
149 Bytes
190 Bytes
166 Bytes
js/resources/images/16x16/plot_axis_t.png
161 Bytes
179 Bytes
175 Bytes