/** * 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.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) { var outputField = this.getForm().findField('file-output'); if (format == 'PNG') { outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForPng); outputField.setValue('INTERACTIVE'); } else { outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForOtherFormats); if (outputField.getValue() == 'INTERACTIVE') outputField.setValue('TGZ'); else outputField.setValue('TGZ'); } }, getFormItems: function() { var me = this; return [ this.addStandardCombo('file-format', 'File format', amdaPlotObj.PlotObjectConfig.availableFileFormats, function(name, value, oldValue) { if (me.object.get('file-format') != value) { me.updateOutputOption(value); me.updateOneFilePerIntOption(value); } }), this.addStandardCombo('file-output', 'File output', amdaPlotObj.PlotObjectConfig.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') ]; } });