Blame view

js/app/views/PlotComponents/PlotConstantForm.js 1.63 KB
829160b3   Benjamin Renard   Add constants def...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Project   : AMDA-NG
 * Name      : PlotConstantForm.js
 * @class   amdaPlotComp.PlotConstantForm
 * @extends amdaPlotComp.PlotStandardForm
 * @brief   Form to define specifics Text legend options
 * @author  Benjamin Renard
 * @version $Id: PlotConstantForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotConstantForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
	setObject : function(object) {
		this.object = object;
		if (this.object != null)
			this.loadRecord(this.object);
a971060f   Benjamin Renard   Fix some bugs
18
		this.updateOptions(this.object.get('constant-axis-id'), this.crtTree.getSelectedPlotType());
829160b3   Benjamin Renard   Add constants def...
19
20
21
22
23
24
25
26
27
28
29
30
31
32
	},
	
	updateOptions: function(axisId, plotType) {
		var timeValueField = this.getForm().findField('constant-time-value');
		var floatValueField = this.getForm().findField('constant-float-value');
		var isTimePlot = (plotType == 'timePlot');
		timeValueField.setVisible(isTimePlot && (axisId == "x"));
		floatValueField.setVisible(!(isTimePlot && (axisId == "x")));
	},
	
	getFormItems: function() {
		var me = this;
		return [
		        this.addStandardCombo('constant-axis-id', 'Axis attachment', amdaPlotObj.PlotObjectConfig.availableConstantAxes, function (name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
33
34
35
		        	if (me.object.get('constant-axis-id') != value)
		        	{
		        		me.updateOptions(value, me.crtTree.getSelectedPlotType());
e84ed2cf   Benjamin Renard   Add Interval Tick...
36
37
		        		me.object.set('constant-axis-id', value);
		        		me.crtTree.refresh();
a971060f   Benjamin Renard   Fix some bugs
38
		        	}
829160b3   Benjamin Renard   Add constants def...
39
40
41
42
43
44
45
		        }),
		        this.addStandardDate('constant-time-value', 'Value'),
		        this.addStandardText('constant-float-value', 'Value'),
		        this.addStandardFieldSet('Line', '', this.addStandardLineItems('constant-line'))
        ];
	}
});