PlotBaseSerieForm.js 4.62 KB
/**
 * Project   : AMDA-NG
 * Name      : PlotBaseSerieForm.js
 * @class   amdaPlotComp.PlotBaseSerieForm
 * @extends amdaPlotComp.PlotStandardForm
 * @brief   Form to define specifics base serie options
 * @author  Benjamin Renard
 * @version $Id: PlotBaseSerieForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotBaseSerieForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
	setObject : function(object) {
		this.object = object.get('param-drawing-object');
		this.loadRecord(this.object);
		this.updateOptions(this.crtTree.getSelectedPlotType());
	},

	updateOptions: function(plotType) {
		var isScatter = (plotType == 'xyPlot');
		
		var timeTickTypeField = this.getForm().findField('serie-timetick-type');
		if (timeTickTypeField != null){
			var timeTickFieldSet = timeTickTypeField.findParentByType('fieldset');
		
			timeTickFieldSet.setVisible(isScatter);
			
			if (isScatter)
			{
				//Update Time Tick field
				var timeTickStepField = this.getForm().findField('serie-timetick-step');
				var timeTickNbMajorField = this.getForm().findField('serie-timetick-nbmajor');
				switch (timeTickTypeField.getValue())
				{
				case 'time-step' :
					timeTickStepField.setVisible(true);
					timeTickNbMajorField.setVisible(false);
					break;
				case 'nb-major' :
					timeTickStepField.setVisible(false);
					timeTickNbMajorField.setVisible(true);
					break;
				case 'auto' :
				default :
					timeTickStepField.setVisible(false);
					timeTickNbMajorField.setVisible(false);
				}
			}
		}
	},
	
	getTimeTickItems: function() {
		var me = this;
		return [
			this.addStandardCombo('serie-timetick-type', 'Type', amdaDefaultConfigs.availableTimeTickTypes, function(name, value, oldValue) {
				me.updateOptions(me.crtTree.getSelectedPlotType());
			}),
		    this.addStandardFloat('serie-timetick-step', 'Time step (sec.)'),
			this.addStandardFloat('serie-timetick-nbmajor', 'Number of major ticks'),
			this.addStandardFloat('serie-timetick-nbminor', 'Number of minor ticks'),
			this.addColorsPicker('serie-timetick-color', 'Color', amdaDefaultConfigs.availableColorsNew),
			this.addStandardFieldSet('Symbols', '', this.addStandardSymbolsItems('serie-timetick-symbols')),
			this.addStandardFieldSet('First symbol', 'serie-timetick-firstsymbols-activated', this.addStandardSymbolsItems('serie-timetick-firstsymbols')),
			this.addStandardFont('serie-timetick-font')
		];
	},
	
	getIntervalTickItems: function() {
		var me = this;
		
		return [
			this.addStandardCombo('serie-intervaltick-mode', 'Mode', amdaDefaultConfigs.availableIntervalTickModes),
			this.addColorsPicker('serie-intervaltick-color', 'Color', amdaDefaultConfigs.availableColorsNew),
			this.addStandardFieldSet('Symbols', '', this.addStandardSymbolsItems('serie-intervaltick-symbols')),
			this.addStandardFont('serie-intervaltick-font')
		];
	},
	
	getValuesRangeItems: function() {
		return [
		        this.addStandardFloat2('serie-value-min', 'Min value', -Number.MAX_VALUE, Number.MAX_VALUE, true),
		        this.addStandardFloat2('serie-value-max', 'Max value', -Number.MAX_VALUE, Number.MAX_VALUE, true)
		];
	},
                    getFilteringItems: function(){
                               return[
                                 this.addStandardCombo('filtering-level', 'Level', amdaDefaultConfigs.availableFilteringLevel)
                               ];
                    },
	
	getFormItems: function() {
		var me = this;
		
		return [
                    this.addStandardCombo('serie-resolution', 'Points per plot', amdaDefaultConfigs.availableResolutions, function(name, value, oldValue) {
			me.object.set('serie-resolution', value);
                    }),
		    this.addStandardCombo('serie-yaxis', 'Y axis', amdaDefaultConfigs.availableYAxes, function(name, value, oldValue) {
		    	me.object.set('serie-yaxis', value);
		    	me.crtTree.refresh();
		    }),
	                       myDesktopApp.addAmdaInfo('MinMaxThreshold','vertical-align:bottom'),
		    this.addStandardFieldSet('Min/Max thresholds', '', this.getValuesRangeItems()),
		    this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'),
		    this.addStandardFieldSet('Lines', 'serie-lines-activated', this.addStandardLineItems('serie-lines')),
		    this.addStandardFieldSet('Symbols', 'serie-symbols-activated', this.addStandardSymbolsItems('serie-symbols')),
		    this.addStandardFieldSet('Time ticks', 'serie-timetick-activated', this.getTimeTickItems()),
	            this.addStandardFieldSet('Interval ticks', 'serie-intervaltick-activated', this.getIntervalTickItems()),
                    this.addStandardFieldSet('Spike Filtering ( ! Experimental ! )', 'filtering-activated', this.getFilteringItems())
		];
	}
});