/** * Project  : AMDA-NG * Name : PlotTextForm.js * @class amdaPlotComp.PlotTextForm * @extends amdaPlotComp.PlotStandardForm * @brief Form to define specifics Text object options * @author Benjamin Renard * @version $Id: PlotTextForm.js benjamin $ */ Ext.define('amdaPlotComp.PlotTextForm', { extend: 'amdaPlotComp.PlotStandardForm', setObject : function(object) { this.object = object; if (this.object != null) { this.loadRecord(this.object); this.updateOptions(this.crtTree.getSelectedPlotType()); } }, updateOptions: function(plotType) { var xRelativeField = this.getForm().findField('text-x-relative'); var xFloatValueField = this.getForm().findField('text-x-floatvalue'); var xTimeValueField = this.getForm().findField('text-x-timevalue'); var yRelativeField = this.getForm().findField('text-y-relative'); var yValueField = this.getForm().findField('text-y-value'); var yAxisField = this.getForm().findField('text-y-axis'); var isTimePlot = (plotType == 'timePlot'); if (xRelativeField.getValue()) { xFloatValueField.setMinValue(0); xFloatValueField.setMaxValue(1); } else { xFloatValueField.setMinValue(-Number.MAX_VALUE); xFloatValueField.setMaxValue(Number.MAX_VALUE); } xFloatValueField.setVisible(!(isTimePlot && !xRelativeField.getValue())); xTimeValueField.setVisible(isTimePlot && !xRelativeField.getValue()); if (yRelativeField.getValue()) { yAxisField.setVisible(false); yValueField.setMinValue(0); yValueField.setMaxValue(1); } else { yAxisField.setVisible(true); yValueField.setMinValue(-Number.MAX_VALUE); yValueField.setMaxValue(Number.MAX_VALUE); } }, getFormItems: function() { var me = this; return [ this.addStandardText('text-value', 'Text'), this.addStandardColor('text-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors), this.addStandardCombo('text-align', 'Alignment', amdaPlotObj.PlotObjectConfig.availableTextAlignments), this.addStandardCheck('text-x-relative', 'Relative X Position', function(name, value, oldValue) { me.updateOptions(me.crtTree.getSelectedPlotType()); }), this.addStandardFloat('text-x-floatvalue', 'X Position', 0, 1), this.addStandardDate('text-x-timevalue', 'X Position'), this.addStandardCheck('text-y-relative', 'Relative Y Position', function(name, value, oldValue) { me.updateOptions(me.crtTree.getSelectedPlotType()); }), this.addStandardCombo('text-y-axis', 'Y Axis attachment', amdaPlotObj.PlotObjectConfig.availableYAxes), this.addStandardFloat('text-y-value', 'Y Position', 0, 1), this.addStandardFloat('text-angle', 'Rotation Angle', 0, 360), this.addStandardFont('text-font') ]; } });