/** * Project  : AMDA-NG * Name : PlotDrawingObjectForm.js * @class amdaPlotComp.PlotDrawingObjectForm * @extends amdaPlotComp.PlotStandardForm * @brief Form to define a list of text legends * @author Benjamin Renard * @version $Id: PlotDrawingObjectForm.js benjamin $ */ Ext.define('amdaPlotComp.PlotDrawingObjectForm', { extend: 'amdaPlotComp.PlotStandardForm', addConstantBtn : null, addTextBtn : null, addCurveBtn : null, setObject : function(object) { this.object = object; if (this.object != null) this.loadRecord(this.object); this.updateOptions(); }, updateOptions: function() { if (this.object == null) { this.addConstantBtn.setDisabled(true); this.addTextBtn.setDisabled(true); this.addCurveBtn.setDisabled(true); return; } this.addConstantBtn.setDisabled((this.object.get('panel-plot-type') == 'tickPlot') || (this.object.get('panel-plot-type') == 'statusPlot')); this.addTextBtn.setDisabled((this.object.get('panel-plot-type') == 'tickPlot') || (this.object.get('panel-plot-type') == 'statusPlot')); this.addCurveBtn.setDisabled(this.object.get('panel-plot-type') != 'xyPlot'); }, getFormItems: function() { var me = this; this.addConstantBtn = Ext.create('Ext.button.Button', { text: 'Add new constant', iconCls: 'icon-add', name: 'add-constant-btn', handler : function() { var constantObject = me.object.createNewConstant(); me.crtTree.buildPanelAdditionalObjectsNode(me.object, constantObject); } }); this.addTextBtn = Ext.create('Ext.button.Button', { text: 'Add new text', iconCls: 'icon-add', name: 'add-text-btn', handler : function() { var textObject = me.object.createNewTextObject(); me.crtTree.buildPanelAdditionalObjectsNode(me.object, textObject); } }); this.addCurveBtn = Ext.create('Ext.button.Button', { text: 'Add new curve', iconCls: 'icon-add', name: 'add-curve-btn', handler : function() { var curveObject = me.object.createNewCurve(); me.crtTree.buildPanelAdditionalObjectsNode(me.object, curveObject); } }); return [ this.addConstantBtn, this.addTextBtn, this.addCurveBtn ]; } });