Blame view

js/app/views/PlotComponents/PlotOutputForm.js 2.24 KB
437c4dbc   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * Project   : AMDA-NG
 * Name      : PlotOutputForm.js
 * @class   amdaPlotComp.PlotOutputForm
 * @extends amdaPlotComp.PlotStandardForm
 * @brief   Form to define output options
 * @author  Benjamin Renard
 * @version $Id: PlotOutputForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotOutputForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
abe09878   Benjamin Renard   Add panels and ax...
14
	title: 'Output options',
437c4dbc   Benjamin Renard   First implementat...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	
	updateOneFilePerIntOption : function() {
		var formatField = this.getForm().findField('file-format');
		var oneFilePerIntField = this.getForm().findField('one-file-per-interval');
    	
    	oneFilePerIntField.setDisabled((formatField.getValue() == 'PNG') || (formatField.getValue() == 'SVG'));
	},
	
	updateFilePrefixOption : function() {
		var prefixField = this.getForm().findField('file-prefix');
		var outputField = this.getForm().findField('file-output');
		
		if (outputField.getValue() == 'INTERACTIVE')
			prefixField.setValue("");
		prefixField.setDisabled(outputField.getValue() == 'INTERACTIVE');
	},
	
	updateOutputOption : function() {
		var formatField = this.getForm().findField('file-format');
		var outputField = this.getForm().findField('file-output');
		
    	if (formatField.getValue() == 'PNG')
    	{
    		outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForPng);
    		outputField.setValue('INTERACTIVE');
    	}
    	else
    	{
    		outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForOtherFormats);
    		if (outputField.getValue() == 'INTERACTIVE')
    			outputField.setValue('TGZ');
    	}
	},
	
	getFormItems: function() {
		var me = this;
		
		return [
a8c54fb9   Benjamin Renard   Add text object p...
53
		        this.addStandardCombo('file-format', 'File format', amdaPlotObj.PlotObjectConfig.availableFileFormats, function(name, value, oldValue) {
437c4dbc   Benjamin Renard   First implementat...
54
55
56
		        	me.updateOutputOption();
		        	me.updateOneFilePerIntOption();
		        }),
a8c54fb9   Benjamin Renard   Add text object p...
57
		        this.addStandardCombo('file-output', 'File output', amdaPlotObj.PlotObjectConfig.availableFileOutputs, function(name, value, oldValue) {
437c4dbc   Benjamin Renard   First implementat...
58
59
60
61
		        	me.updateFilePrefixOption();
		        }),
		        this.addStandardText('file-prefix', 'File prefix'),
		        this.addStandardCheck('one-file-per-interval', 'One file per interval'),
18d4a11e   Benjamin Renard   Save and load plo...
62
		        this.addStandardText('name', 'Request name')     
437c4dbc   Benjamin Renard   First implementat...
63
64
65
		];
	}
});