PlotLegendSeriesForm.js 2.07 KB
/**
 * Project   : AMDA-NG
 * Name      : PlotLegendSeriesForm.js
 * @class   amdaPlotComp.PlotLegendSeriesForm
 * @extends amdaPlotComp.PlotStandardForm
 * @brief   Form to define specifics series legend options
 * @author  Benjamin Renard
 * @version $Id: PlotLegendSeriesForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotLegendSeriesForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
	setObject : function(object) {
		this.object = object.get('panel-legend-series');
		if (this.object != null)
			this.loadRecord(this.object);
		var legendTypeField = this.getForm().findField('legend-series-type');
		var legendFieldSet = legendTypeField.findParentByType('fieldset');
		legendFieldSet.setVisible(this.object != null);
	},
	
	getFormItems: function() {
		var borderItems = [
		this.addColorsPicker('legend-series-border-color', 'Border Color', amdaDefaultConfigs.availableColorsNew, 'none')
	    ];
		
		var intervalInfoItems = [
            this.addStandardCombo('legend-series-intervalinfo-type', 'Type', amdaDefaultConfigs.availableLegendSeriesIntervalInfoTypes)      
	    ];
		
		var legendItems = [
            this.addStandardCombo('legend-series-type', 'Type', amdaDefaultConfigs.availableLegendSeriesTypes),
            this.addStandardCombo('legend-series-position', 'Position', amdaDefaultConfigs.availableLegendSeriesPositions),
            this.addColorsPicker('legend-series-defaulttextcolor', 'Default Text Color', amdaDefaultConfigs.availableColorsNew),
            this.addStandardCheck('legend-series-showparaminfo', 'Show Param Info'),
            this.addStandardFieldSet('Show Interval Info', 'legend-series-intervalinfo-activated', intervalInfoItems),
            this.addStandardFieldSet('Border', 'legend-series-border-activated', borderItems),
            this.addStandardFont('legend-series-font')
		];
		
		var me = this;
		
		return [
            this.addStandardFieldSet('Activate legend', 'legend-series-activated', legendItems, function(name, value, oldValue) {
            	me.object.set('legend-series-activated', value);
        		me.crtTree.refresh();
	        })
		];
	}
});