PlotPanelForm.js
6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* Project : AMDA-NG
* Name : PlotPanelForm.js
* @class amdaPlotComp.PlotPanelForm
* @extends amdaPlotComp.PlotStandardForm
* @brief Form to define panel options
* @author Benjamin Renard
* @version $Id: PlotPanelForm.js benjamin $
*/
Ext.define('amdaPlotComp.PlotPanelForm', {
extend: 'amdaPlotComp.PlotStandardForm',
idProperty: 'id',
setObject : function(object) {
this.object = object;
this.loadRecord(this.object);
this.updateOptions(this.object.get('panel-plot-type'));
},
updateOptions: function(plotType) {
var plotTypeField = this.getForm().findField('panel-plot-type');
//Scatter field set visibility
var isotropicField = this.getForm().findField('panel-scatter-isotropic');
isotropicField.setVisible(plotType == 'xyPlot');
//Status field set visibility
var statusBarAvailable = ((plotType == 'timePlot') || (plotType == 'statusPlot'));
var statusPositionField = this.getForm().findField('panel-status-position');
var statusFieldSet = statusPositionField.findParentByType('fieldset');
statusFieldSet.setVisible(statusBarAvailable);
//Tick field set visibility
var tickBarAvailable = ((plotType == 'timePlot') || (plotType == 'tickPlot'));
var tickFormatField = this.getForm().findField('panel-tick-format');
var tickFieldSet = tickFormatField.findParentByType('fieldset');
tickFieldSet.setVisible(tickBarAvailable);
//Epoch center time id visibility
var centerTimeIdField = this.getForm().findField('panel-epoch-centertimeid');
centerTimeIdField.setVisible(plotType == 'epochPlot');
//Instant time visibility
var instantTimeField = this.getForm().findField('panel-instant-time');
instantTimeField.setVisible(plotType == 'instantPlot');
//Options in relation with the layout
this.updateLayoutOptions(plotType);
},
updateLayoutOptions: function(plotType) {
//Margins and Bounds visibility in relation with the layout type
var isManualLayout = this.crtTree.tabObject && (this.crtTree.tabObject.get('page-layout-type') == 'manual');
var isVerticalLayout = this.crtTree.tabObject && (this.crtTree.tabObject.get('page-layout-type') == 'vertical');
var xBoundsField = this.getForm().findField('panel-bounds-x');
var boundFieldSet = xBoundsField.findParentByType('fieldset');
boundFieldSet.setVisible(isManualLayout);
var marginLeftField = this.getForm().findField('panel-margin-left');
var marginsFieldSet = marginLeftField.findParentByType('fieldset');
marginsFieldSet.setVisible(isManualLayout);
var preferedWidthField = this.getForm().findField('panel-prefered-width');
var preferedDimFieldSet = preferedWidthField.findParentByType('fieldset');
preferedDimFieldSet.setVisible(isVerticalLayout);
preferedWidthField.setVisible((plotType == 'xyPlot') || (plotType == 'instantPlot'));
},
getFormItems: function() {
var boundsItems = [
this.addStandardFloat('panel-bounds-x', 'X Position', 0, 1),
this.addStandardFloat('panel-bounds-y', 'Y Position', 0, 1),
this.addStandardFloat('panel-bounds-width', 'Width', 0, 1),
this.addStandardFloat('panel-bounds-height', 'Height', 0, 1)
];
var marginItems = [
this.addStandardFloat('panel-margin-left', 'Left Margin', 0, 100, true),
this.addStandardFloat('panel-margin-right', 'Right Margin', 0, 100, true)
];
var preferedDimItems = [
this.addStandardFloat('panel-prefered-width', 'Prefered Width', 0, 1, true),
this.addStandardFloat('panel-prefered-height', 'Prefered Height', 0, 1, true)
];
var titleItems = [
this.addStandardText('panel-title-text', 'Text'),
this.addStandardColor('panel-title-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors),
this.addStandardCombo('panel-title-position', 'Position', amdaPlotObj.PlotObjectConfig.availableTitlePositions),
this.addStandardCombo('panel-title-alignment', 'Alignment', amdaPlotObj.PlotObjectConfig.availableTitleAlignments),
this.addStandardFont('panel-title-font')
];
var statusItems = [
this.addStandardCombo('panel-status-position', 'Position', amdaPlotObj.PlotObjectConfig.availableStatusBarPositions),
this.addStandardCombo('panel-status-colormap', 'Color Map', amdaPlotObj.PlotObjectConfig.availableStatusBarColorMaps)
];
var tickItems = [
this.addStandardText('panel-tick-format', 'Format')
];
var me = this;
return [
this.addStandardCombo('panel-plot-type', 'Plot type', amdaPlotObj.PlotObjectConfig.availablePlotTypes, function(name, value, oldValue) {
if (value != me.object.get('panel-plot-type'))
{
me.object.changePlotType(value);
if (!me.crtTree.tabObject.get('tree-simplified-view'))
{
me.crtTree.buildPanelAxesNode(me.object);
me.crtTree.buildPanelAdditionalObjectsNode(me.object);
}
me.crtTree.getView().refresh();
me.updateOptions(value);
}
}),
this.addStandardCheck('panel-scatter-isotropic', 'Isotropic', function(name, value, oldValue) {
me.crtTree.getView().refresh();
}),
this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id', function(name, value, oldValue) {
me.crtTree.getView().refresh();
}),
this.addStandardDate('panel-instant-time', 'Instant time', function(name, value, oldValue) {
me.crtTree.getView().refresh();
}),
this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors),
this.addStandardFieldSet('Manual Bounds', '', boundsItems),
this.addStandardFieldSet('Manual Margins', '', marginItems),
this.addStandardFieldSet('Prefered Dimensions', '', preferedDimItems),
this.addStandardFieldSet('Title', '', titleItems),
this.addStandardFont('panel-font'),
this.addStandardFieldSet('Status Bars', '', statusItems),
this.addStandardFieldSet('Ticks Bars', '', tickItems)
];
}
});