Blame view

js/app/views/PlotComponents/PlotOutputForm.js 2.7 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
	setObject : function(object) {
		this.object = object;
		this.loadRecord(this.object);
7510dd4a   Erdogan Furkan   #10285 - Done
19
		this.updateOutputOption(this.object.get('file-format'),this.object.get('file-output'));
a971060f   Benjamin Renard   Fix some bugs
20
21
22
23
24
		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
	},
	
7510dd4a   Erdogan Furkan   #10285 - Done
38
	updateOutputOption : function(format,output) {
437c4dbc   Benjamin Renard   First implementat...
39
		var outputField = this.getForm().findField('file-output');
7510dd4a   Erdogan Furkan   #10285 - Done
40
41
42
43
		var outputValue = outputField.getValue();

		if(format == 'PNG')
		{
4f728fd9   Erdogan Furkan   For now 2
44
			outputField.getStore().loadData(amdaDefaultConfigs.availableFileOutputsForPng);
7510dd4a   Erdogan Furkan   #10285 - Done
45
46
47
48
49
50
51
52
53
54
55
56
57
58
			if(!output)
			{
				if(!outputValue)
					outputField.setValue('INTERACTIVE');
				else
					outputField.setValue(outputValue);
			}
			else
			{
				outputField.setValue(output);
			}
		}
		else
		{
4f728fd9   Erdogan Furkan   For now 2
59
			outputField.getStore().loadData(amdaDefaultConfigs.availableFileOutputsForOtherFormats);
7510dd4a   Erdogan Furkan   #10285 - Done
60
61
62
63
64
65
66
67
68
69
70
71
			if(!output)
			{
				if(outputValue =='INTERACTIVE' || !outputValue)
					outputField.setValue('TGZ');
				else
					outputField.setValue(outputValue);
			}
			else
			{
				outputField.setValue(output);
			}
		}
437c4dbc   Benjamin Renard   First implementat...
72
73
74
75
76
77
	},
	
	getFormItems: function() {
		var me = this;
		
		return [
4f728fd9   Erdogan Furkan   For now 2
78
		        this.addStandardCombo('file-format', 'File format', amdaDefaultConfigs.availableFileFormats, function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
79
80
81
82
83
		        	if (me.object.get('file-format') != value)
		        	{
		        		me.updateOutputOption(value);
		        		me.updateOneFilePerIntOption(value);
		        	}
437c4dbc   Benjamin Renard   First implementat...
84
		        }),
4f728fd9   Erdogan Furkan   For now 2
85
		        this.addStandardCombo('file-output', 'File output', amdaDefaultConfigs.availableFileOutputs, function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
86
87
		        	if (me.object.get('file-output') != value)
		        		me.updateFilePrefixOption(value);
437c4dbc   Benjamin Renard   First implementat...
88
89
90
		        }),
		        this.addStandardText('file-prefix', 'File prefix'),
		        this.addStandardCheck('one-file-per-interval', 'One file per interval'),
18d4a11e   Benjamin Renard   Save and load plo...
91
		        this.addStandardText('name', 'Request name')     
437c4dbc   Benjamin Renard   First implementat...
92
93
94
		];
	}
});