Blame view

js/app/views/PlotComponents/PlotPanelForm.js 6.25 KB
abe09878   Benjamin Renard   Add panels and ax...
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * 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',
dbb7bcbe   Benjamin Renard   Add curves defint...
13
	idProperty: 'id',
abe09878   Benjamin Renard   Add panels and ax...
14

003ba315   Benjamin Renard   Add Epoch Plot an...
15
16
17
18
19
20
21
	setObject : function(object) {
		this.object = object;
		this.loadRecord(this.object);
		this.updateOptions(this.object.get('panel-plot-type'));
	},
	
	updateOptions: function(plotType) {
a0bf9157   Benjamin Renard   Add tick plot and...
22
		var plotTypeField = this.getForm().findField('panel-plot-type');
003ba315   Benjamin Renard   Add Epoch Plot an...
23
24
25
26
27
28
29
		
		//Scatter field set visibility
		var isotropicField = this.getForm().findField('panel-scatter-isotropic');
		
		isotropicField.setVisible(plotType == 'xyPlot');
		
		//Status field set visibility
a0bf9157   Benjamin Renard   Add tick plot and...
30
31
32
33
		var statusBarAvailable = ((plotType == 'timePlot') || (plotType == 'statusPlot'));
		
		var statusPositionField = this.getForm().findField('panel-status-position');
		var statusFieldSet = statusPositionField.findParentByType('fieldset');
003ba315   Benjamin Renard   Add Epoch Plot an...
34
		
a0bf9157   Benjamin Renard   Add tick plot and...
35
		statusFieldSet.setVisible(statusBarAvailable);
003ba315   Benjamin Renard   Add Epoch Plot an...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		
		//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');
		
6a801541   Benjamin Renard   Add possibility t...
50
51
52
53
54
		//Instant time visibility
		var instantTimeField = this.getForm().findField('panel-instant-time');
		
		instantTimeField.setVisible(plotType == 'instantPlot');
		
003ba315   Benjamin Renard   Add Epoch Plot an...
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
		//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'));
a0bf9157   Benjamin Renard   Add tick plot and...
76
77
	},
	
abe09878   Benjamin Renard   Add panels and ax...
78
	getFormItems: function() {
003ba315   Benjamin Renard   Add Epoch Plot an...
79
80
81
82
83
84
85
		
		
		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)
abe09878   Benjamin Renard   Add panels and ax...
86
87
88
		];
		
		var marginItems = [
003ba315   Benjamin Renard   Add Epoch Plot an...
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
		        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')
a0bf9157   Benjamin Renard   Add tick plot and...
104
105
106
107
108
109
110
111
112
		];
		
		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')
abe09878   Benjamin Renard   Add panels and ax...
113
114
		];
		
003ba315   Benjamin Renard   Add Epoch Plot an...
115
116
		
		
17433635   Benjamin Renard   Add series and sp...
117
		var me = this;
abe09878   Benjamin Renard   Add panels and ax...
118
		return [
a0bf9157   Benjamin Renard   Add tick plot and...
119
		        this.addStandardCombo('panel-plot-type', 'Plot type', amdaPlotObj.PlotObjectConfig.availablePlotTypes, function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
120
		        	if (value != me.object.get('panel-plot-type'))
a0bf9157   Benjamin Renard   Add tick plot and...
121
		        	{
a971060f   Benjamin Renard   Fix some bugs
122
		        		me.object.changePlotType(value);
27b2a53e   Benjamin Renard   Link tab plot to ...
123
		        		if (!me.crtTree.tabObject.get('tree-simplified-view'))
dbb7bcbe   Benjamin Renard   Add curves defint...
124
		        		{
003ba315   Benjamin Renard   Add Epoch Plot an...
125
		        			me.crtTree.buildPanelAxesNode(me.object);
dbb7bcbe   Benjamin Renard   Add curves defint...
126
127
		        			me.crtTree.buildPanelAdditionalObjectsNode(me.object);
		        		}
e84ed2cf   Benjamin Renard   Add Interval Tick...
128
129
		        		me.object.set('panel-plot-type', value);
		        		me.crtTree.refresh();
003ba315   Benjamin Renard   Add Epoch Plot an...
130
		        		me.updateOptions(value);
a0bf9157   Benjamin Renard   Add tick plot and...
131
		        	}
abe09878   Benjamin Renard   Add panels and ax...
132
		        }),
dbb7bcbe   Benjamin Renard   Add curves defint...
133
		        this.addStandardCheck('panel-scatter-isotropic', 'Isotropic', function(name, value, oldValue) {
e84ed2cf   Benjamin Renard   Add Interval Tick...
134
135
		        	me.object.set('panel-scatter-isotropic', value);
	        		me.crtTree.refresh();
dbb7bcbe   Benjamin Renard   Add curves defint...
136
137
		        }), 
		        this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id', function(name, value, oldValue) {
e84ed2cf   Benjamin Renard   Add Interval Tick...
138
139
		        	me.object.set('panel-epoch-centertimeid', value);
	        		me.crtTree.refresh();
dbb7bcbe   Benjamin Renard   Add curves defint...
140
141
		        }),
		        this.addStandardDate('panel-instant-time', 'Instant time', function(name, value, oldValue) {
e84ed2cf   Benjamin Renard   Add Interval Tick...
142
143
		        	me.object.set('panel-instant-time', value);
	        		me.crtTree.refresh();
dbb7bcbe   Benjamin Renard   Add curves defint...
144
		        }),
abe09878   Benjamin Renard   Add panels and ax...
145
		        this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors),
003ba315   Benjamin Renard   Add Epoch Plot an...
146
147
148
		        this.addStandardFieldSet('Manual Bounds', '', boundsItems),
		        this.addStandardFieldSet('Manual Margins', '', marginItems),
		        this.addStandardFieldSet('Prefered Dimensions', '', preferedDimItems),
abe09878   Benjamin Renard   Add panels and ax...
149
    	        this.addStandardFieldSet('Title', '', titleItems),
a0bf9157   Benjamin Renard   Add tick plot and...
150
151
152
		        this.addStandardFont('panel-font'),
		        this.addStandardFieldSet('Status Bars', '', statusItems),
		        this.addStandardFieldSet('Ticks Bars', '', tickItems)
abe09878   Benjamin Renard   Add panels and ax...
153
154
155
		];
	}
});