Blame view

js/app/views/PlotComponents/PlotPanelForm.js 6.71 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
		//Instant time visibility
		var instantTimeField = this.getForm().findField('panel-instant-time');
6a801541   Benjamin Renard   Add possibility t...
52
		instantTimeField.setVisible(plotType == 'instantPlot');
abdf73a5   Erdogan Furkan   Bug fixed
53
54
		var startDate = this.up().up().up().timeSelector.intervalSel.items.items[0].getValue();
		var stopDate = this.up().up().up().timeSelector.intervalSel.items.items[1].getValue();
f6d2d8a3   Erdogan Furkan   #5165 - Done
55
56
57
58
		if(startDate <= stopDate ){
			var interval =  (stopDate-startDate)/2
			instantTimeField.setValue(new Date(stopDate-interval));
		}
003ba315   Benjamin Renard   Add Epoch Plot an...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
		//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...
80
81
	},
	
abe09878   Benjamin Renard   Add panels and ax...
82
	getFormItems: function() {
003ba315   Benjamin Renard   Add Epoch Plot an...
83
84
85
86
87
88
89
		
		
		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...
90
91
92
		];
		
		var marginItems = [
003ba315   Benjamin Renard   Add Epoch Plot an...
93
94
95
96
97
		        this.addStandardFloat('panel-margin-left', 'Left Margin', 0, 100, true),
		        this.addStandardFloat('panel-margin-right', 'Right Margin', 0, 100, true)
		];
		
		var preferedDimItems = [
6586e8e0   Elena.Budnik   Prefered => Prefe...
98
99
                this.addStandardFloat('panel-prefered-width', 'Preferred Width', 0, 1, true),
                this.addStandardFloat('panel-prefered-height', 'Preferred Height', 0, 1, true)
003ba315   Benjamin Renard   Add Epoch Plot an...
100
101
102
103
		];
		
		var titleItems = [
		  		this.addStandardText('panel-title-text', 'Text'),
4f728fd9   Erdogan Furkan   For now 2
104
105
106
				this.addColorsPicker('panel-title-color', 'Color', amdaDefaultConfigs.availableColorsNew),
		  		this.addStandardCombo('panel-title-position', 'Position', amdaDefaultConfigs.availableTitlePositions),
		  		this.addStandardCombo('panel-title-alignment', 'Alignment', amdaDefaultConfigs.availableTitleAlignments),
003ba315   Benjamin Renard   Add Epoch Plot an...
107
		  		this.addStandardFont('panel-title-font')
a0bf9157   Benjamin Renard   Add tick plot and...
108
109
110
		];
		
		var statusItems = [
4f728fd9   Erdogan Furkan   For now 2
111
112
		   		this.addStandardCombo('panel-status-position', 'Position', amdaDefaultConfigs.availableStatusBarPositions),
				this.addStandardCombo('panel-status-colormap', 'Color Map', amdaDefaultConfigs.availableStatusBarColorMaps)
a0bf9157   Benjamin Renard   Add tick plot and...
113
114
115
116
        ];
		
		var tickItems = [
                this.addStandardText('panel-tick-format', 'Format')
abe09878   Benjamin Renard   Add panels and ax...
117
118
		];
		
003ba315   Benjamin Renard   Add Epoch Plot an...
119
120
		
		
17433635   Benjamin Renard   Add series and sp...
121
		var me = this;
abe09878   Benjamin Renard   Add panels and ax...
122
		return [
4f728fd9   Erdogan Furkan   For now 2
123
		        this.addStandardCombo('panel-plot-type', 'Plot type', amdaDefaultConfigs.availablePlotTypes, function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
124
		        	if (value != me.object.get('panel-plot-type'))
a0bf9157   Benjamin Renard   Add tick plot and...
125
		        	{
a971060f   Benjamin Renard   Fix some bugs
126
		        		me.object.changePlotType(value);
8816e270   Elena.Budnik   simplified vies c...
127
		        		if (me.crtTree.tabObject.get('tree-full-view'))
dbb7bcbe   Benjamin Renard   Add curves defint...
128
		        		{
003ba315   Benjamin Renard   Add Epoch Plot an...
129
		        			me.crtTree.buildPanelAxesNode(me.object);
dbb7bcbe   Benjamin Renard   Add curves defint...
130
131
		        			me.crtTree.buildPanelAdditionalObjectsNode(me.object);
		        		}
e84ed2cf   Benjamin Renard   Add Interval Tick...
132
133
		        		me.object.set('panel-plot-type', value);
		        		me.crtTree.refresh();
003ba315   Benjamin Renard   Add Epoch Plot an...
134
		        		me.updateOptions(value);
a0bf9157   Benjamin Renard   Add tick plot and...
135
		        	}
abe09878   Benjamin Renard   Add panels and ax...
136
		        }),
d1bed2e2   Benjamin Renard   Change Isotropic ...
137
		        this.addStandardCheck('panel-scatter-isotropic', 'Orthonormal scale', function(name, value, oldValue) {
e84ed2cf   Benjamin Renard   Add Interval Tick...
138
139
		        	me.object.set('panel-scatter-isotropic', value);
	        		me.crtTree.refresh();
b8eab7da   Benjamin Renard   New tooltip for o...
140
		        }, 'When this option is selected, X-axis and Y-axis appear with the same scale in the panel'), 
dbb7bcbe   Benjamin Renard   Add curves defint...
141
		        this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id', function(name, value, oldValue) {
e84ed2cf   Benjamin Renard   Add Interval Tick...
142
143
		        	me.object.set('panel-epoch-centertimeid', value);
	        		me.crtTree.refresh();
dbb7bcbe   Benjamin Renard   Add curves defint...
144
145
		        }),
		        this.addStandardDate('panel-instant-time', 'Instant time', function(name, value, oldValue) {
e84ed2cf   Benjamin Renard   Add Interval Tick...
146
147
		        	me.object.set('panel-instant-time', value);
	        		me.crtTree.refresh();
dbb7bcbe   Benjamin Renard   Add curves defint...
148
		        }),
4f728fd9   Erdogan Furkan   For now 2
149
150
		        this.addColorsPicker('panel-background-color', 'Background Color', amdaDefaultConfigs.availableColorsNew, 'none'),
				this.addColorsPicker('panel-plotareabackground-color', 'Plot Area Background Color', amdaDefaultConfigs.availableColorsNew, 'none'),
003ba315   Benjamin Renard   Add Epoch Plot an...
151
152
		        this.addStandardFieldSet('Manual Bounds', '', boundsItems),
		        this.addStandardFieldSet('Manual Margins', '', marginItems),
6586e8e0   Elena.Budnik   Prefered => Prefe...
153
		        this.addStandardFieldSet('Preferred Dimensions', '', preferedDimItems),
abe09878   Benjamin Renard   Add panels and ax...
154
    	        this.addStandardFieldSet('Title', '', titleItems),
a0bf9157   Benjamin Renard   Add tick plot and...
155
156
157
		        this.addStandardFont('panel-font'),
		        this.addStandardFieldSet('Status Bars', '', statusItems),
		        this.addStandardFieldSet('Ticks Bars', '', tickItems)
abe09878   Benjamin Renard   Add panels and ax...
158
159
		];
	}
2b60247d   Benjamin Renard   Set drawing optio...
160
});