PlotOutputForm.js
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* 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',
title: 'Output options',
setObject : function(object) {
this.object = object;
this.loadRecord(this.object);
this.updateOutputOption(this.object.get('file-format'),this.object.get('file-output'));
this.updateOneFilePerIntOption(this.object.get('file-format'));
this.updateFilePrefixOption(this.object.get('file-output'));
},
updateOneFilePerIntOption : function(format) {
var oneFilePerIntField = this.getForm().findField('one-file-per-interval');
oneFilePerIntField.setDisabled((format == 'PNG') || (format == 'SVG'));
},
updateFilePrefixOption : function(output) {
var prefixField = this.getForm().findField('file-prefix');
if (output == 'INTERACTIVE')
prefixField.setValue("");
prefixField.setDisabled(output == 'INTERACTIVE');
},
updateOutputOption : function(format,output) {
var outputField = this.getForm().findField('file-output');
var outputValue = outputField.getValue();
if(format == 'PNG')
{
outputField.getStore().loadData(amdaDefaultConfigs.availableFileOutputsForPng);
if(!output)
{
if(!outputValue)
outputField.setValue('INTERACTIVE');
else
outputField.setValue(outputValue);
}
else
{
outputField.setValue(output);
}
}
else
{
outputField.getStore().loadData(amdaDefaultConfigs.availableFileOutputsForOtherFormats);
if(!output)
{
if(outputValue =='INTERACTIVE' || !outputValue)
outputField.setValue('TGZ');
else
outputField.setValue(outputValue);
}
else
{
outputField.setValue(output);
}
}
},
getFormItems: function() {
var me = this;
return [
this.addStandardCombo('file-format', 'File format', amdaDefaultConfigs.availableFileFormats, function(name, value, oldValue) {
if (me.object.get('file-format') != value)
{
me.updateOutputOption(value);
me.updateOneFilePerIntOption(value);
}
}),
this.addStandardCombo('file-output', 'File output', amdaDefaultConfigs.availableFileOutputs, function(name, value, oldValue) {
if (me.object.get('file-output') != value)
me.updateFilePrefixOption(value);
}),
this.addStandardText('file-prefix', 'File prefix'),
this.addStandardCheck('one-file-per-interval', 'One file per interval'),
this.addStandardText('name', 'Request name')
];
}
});