PlotConstantForm.js 1.41 KB
/**
 * 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);
	},
	
	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) {
		        	me.updateOptions(value, me.crtTree.getSelectedPlotType());
		        	me.crtTree.getView().refresh();
		        }),
		        this.addStandardDate('constant-time-value', 'Value'),
		        this.addStandardText('constant-float-value', 'Value'),
		        this.addStandardFieldSet('Line', '', this.addStandardLineItems('constant-line'))
        ];
	}
});