Blame view

js/app/views/PlotComponents/PlotDrawingObjectForm.js 2.32 KB
829160b3   Benjamin Renard   Add constants def...
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * 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',
	
fd5552a4   Benjamin Renard   Info for plot ele...
14
15
16
17
	addConstantBtn : null,
	addTextBtn : null,
	addCurveBtn : null,
	
829160b3   Benjamin Renard   Add constants def...
18
19
20
21
	setObject : function(object) {
		this.object = object;
		if (this.object != null)
			this.loadRecord(this.object);
fd5552a4   Benjamin Renard   Info for plot ele...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
		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');
829160b3   Benjamin Renard   Add constants def...
37
38
39
40
	},
	
	getFormItems: function() {
		var me = this;
fd5552a4   Benjamin Renard   Info for plot ele...
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
		
		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);
829160b3   Benjamin Renard   Add constants def...
69
            }
fd5552a4   Benjamin Renard   Info for plot ele...
70
71
72
73
74
75
		});
		
		return [
            this.addConstantBtn,
            this.addTextBtn,
            this.addCurveBtn
829160b3   Benjamin Renard   Add constants def...
76
77
78
		];
	}
});