Blame view

js/app/views/PlotComponents/PlotConstantForm.js 1.58 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
36
37
		        	if (me.object.get('constant-axis-id') != value)
		        	{
		        		me.updateOptions(value, me.crtTree.getSelectedPlotType());
		        		me.crtTree.getView().refresh();
		        	}
829160b3   Benjamin Renard   Add constants def...
38
39
40
41
42
43
44
		        }),
		        this.addStandardDate('constant-time-value', 'Value'),
		        this.addStandardText('constant-float-value', 'Value'),
		        this.addStandardFieldSet('Line', '', this.addStandardLineItems('constant-line'))
        ];
	}
});