/** * 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') ]; } });