Blame view

js/app/views/PlotComponents/PlotOutputForm.js 2.47 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
	
a971060f   Benjamin Renard   Fix some bugs
16
17
18
19
20
21
22
23
24
	setObject : function(object) {
		this.object = object;
		this.loadRecord(this.object);
		this.updateOutputOption(this.object.get('file-format'));
		this.updateOneFilePerIntOption(this.object.get('file-format'));
		this.updateFilePrefixOption(this.object.get('file-output'));
	},
	
	updateOneFilePerIntOption : function(format) {
437c4dbc   Benjamin Renard   First implementat...
25
26
		var oneFilePerIntField = this.getForm().findField('one-file-per-interval');
    	
a971060f   Benjamin Renard   Fix some bugs
27
    	oneFilePerIntField.setDisabled((format == 'PNG') || (format == 'SVG'));
437c4dbc   Benjamin Renard   First implementat...
28
29
	},
	
a971060f   Benjamin Renard   Fix some bugs
30
	updateFilePrefixOption : function(output) {
437c4dbc   Benjamin Renard   First implementat...
31
		var prefixField = this.getForm().findField('file-prefix');
437c4dbc   Benjamin Renard   First implementat...
32
		
a971060f   Benjamin Renard   Fix some bugs
33
		if (output == 'INTERACTIVE')
437c4dbc   Benjamin Renard   First implementat...
34
			prefixField.setValue("");
a971060f   Benjamin Renard   Fix some bugs
35
		prefixField.setDisabled(output == 'INTERACTIVE');
437c4dbc   Benjamin Renard   First implementat...
36
37
	},
	
a971060f   Benjamin Renard   Fix some bugs
38
	updateOutputOption : function(format) {
437c4dbc   Benjamin Renard   First implementat...
39
40
		var outputField = this.getForm().findField('file-output');
		
a971060f   Benjamin Renard   Fix some bugs
41
    	if (format == 'PNG')
437c4dbc   Benjamin Renard   First implementat...
42
43
44
45
46
47
48
49
50
    	{
    		outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForPng);
    		outputField.setValue('INTERACTIVE');
    	}
    	else
    	{
    		outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForOtherFormats);
    		if (outputField.getValue() == 'INTERACTIVE')
    			outputField.setValue('TGZ');
a971060f   Benjamin Renard   Fix some bugs
51
52
    		else
    			outputField.setValue('TGZ');
437c4dbc   Benjamin Renard   First implementat...
53
54
55
56
57
58
59
    	}
	},
	
	getFormItems: function() {
		var me = this;
		
		return [
a8c54fb9   Benjamin Renard   Add text object p...
60
		        this.addStandardCombo('file-format', 'File format', amdaPlotObj.PlotObjectConfig.availableFileFormats, function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
61
62
63
64
65
		        	if (me.object.get('file-format') != value)
		        	{
		        		me.updateOutputOption(value);
		        		me.updateOneFilePerIntOption(value);
		        	}
437c4dbc   Benjamin Renard   First implementat...
66
		        }),
a8c54fb9   Benjamin Renard   Add text object p...
67
		        this.addStandardCombo('file-output', 'File output', amdaPlotObj.PlotObjectConfig.availableFileOutputs, function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
68
69
		        	if (me.object.get('file-output') != value)
		        		me.updateFilePrefixOption(value);
437c4dbc   Benjamin Renard   First implementat...
70
71
72
		        }),
		        this.addStandardText('file-prefix', 'File prefix'),
		        this.addStandardCheck('one-file-per-interval', 'One file per interval'),
18d4a11e   Benjamin Renard   Save and load plo...
73
		        this.addStandardText('name', 'Request name')     
437c4dbc   Benjamin Renard   First implementat...
74
75
76
		];
	}
});