Blame view

js/app/views/PlotComponents/PlotParamForm.js 3.22 KB
17433635   Benjamin Renard   Add series and sp...
1
2
3
4
/**
 * Project   : AMDA-NG
 * Name      : PlotParamForm.js
 * @class   amdaPlotComp.PlotParamForm
a0bf9157   Benjamin Renard   Add tick plot and...
5
 * @extends amdaPlotComp.amdaPlotComp.PlotStandardForm
17433635   Benjamin Renard   Add series and sp...
6
7
8
9
10
11
12
13
14
15
 * @brief   Form to define specifics param options
 * @author  Benjamin Renard
 * @version $Id: PlotParamForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotParamForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
	requires: [
	    'amdaPlotComp.PlotSerieForm',
a0bf9157   Benjamin Renard   Add tick plot and...
16
17
	    'amdaPlotComp.PlotSpectroForm',
	    'amdaPlotComp.PlotStatusBarForm',
6a801541   Benjamin Renard   Add possibility t...
18
19
20
	    'amdaPlotComp.PlotTickBarForm',
	    'amdaPlotComp.PlotInstantSerieForm',
	    'amdaPlotComp.PlotInstantSpectroForm'
17433635   Benjamin Renard   Add series and sp...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	],
	
	drawingOptionsContainer: null,
	
	drawingOptionsFormsManager : new Ext.AbstractManager(),
	
	setObject : function(object) {
		this.object = object;
		this.loadRecord(this.object);
		this.updateDrawingOptions();
	},
	
	getDrawingOptionsForm: function(type) {
		var formId = '';
		if (!type || (type == ''))
			formId = 'none';
		else
			formId = type;
		
		formId += '-drawing-options-form';
		
		if (!this.drawingOptionsFormsManager.get(formId))
		{
			switch(type)
			{
				//Create drawing options form
				case 'serie' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSerieForm({id : formId}));
					break;
				case 'spectro' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSpectroForm({id : formId}));
					break;
a0bf9157   Benjamin Renard   Add tick plot and...
53
54
55
56
57
58
				case 'status-bar' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotStatusBarForm({id : formId}));
					break;
				case 'tick-bar' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotTickBarForm({id : formId}));
					break;
6a801541   Benjamin Renard   Add possibility t...
59
60
61
62
63
64
				case 'iserie' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSerieForm({id : formId}));
					break;
				case 'ispectro' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSpectroForm({id : formId}));
					break;
a0bf9157   Benjamin Renard   Add tick plot and...
65
 				default :
17433635   Benjamin Renard   Add series and sp...
66
67
68
69
70
71
72
73
					this.drawingOptionsFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this drawing type'}));
			}
		}
		
		return this.drawingOptionsFormsManager.get(formId);
	
	},
	
a0bf9157   Benjamin Renard   Add tick plot and...
74
	updateDrawingOptions: function(forceUpdate) {
17433635   Benjamin Renard   Add series and sp...
75
76
		var typeField = this.getForm().findField('param-drawing-type');
		
a0bf9157   Benjamin Renard   Add tick plot and...
77
78
79
80
81
82
		var availableDrawingObjects = this.object.getAvailableDrawingObjectByPlotType(this.crtTree.getSelectedPlotType());
		typeField.getStore().loadData(availableDrawingObjects);
		
		var drawingType = typeField.getValue();
			
		this.object.updateDrawingType(drawingType, forceUpdate);
17433635   Benjamin Renard   Add series and sp...
83
84
85
		
		this.drawingOptionsContainer.removeAll(false);
		
a0bf9157   Benjamin Renard   Add tick plot and...
86
		var drawingOptionsForm = this.getDrawingOptionsForm(drawingType);
17433635   Benjamin Renard   Add series and sp...
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		this.drawingOptionsContainer.add(drawingOptionsForm);
		drawingOptionsForm.crtTree = this.crtTree;
		if (drawingOptionsForm.setObject)
			drawingOptionsForm.setObject(this.object);
	},
	
	getFormItems: function() {
		var me = this;
		
		this.drawingOptionsContainer = Ext.create('Ext.container.Container', {
			layout: 'fit'
		});
		
		return [
a0bf9157   Benjamin Renard   Add tick plot and...
101
102
		    this.addStandardCombo('param-drawing-type', 'Drawing type', [{'key' : '', 'value' : 'None'}], function(name, value, oldValue) {
		    	me.updateDrawingOptions(value != oldValue);
003ba315   Benjamin Renard   Add Epoch Plot an...
103
		    	me.crtTree.getView().refresh();
17433635   Benjamin Renard   Add series and sp...
104
105
106
107
108
	        }),
	        this.drawingOptionsContainer
		];
	}
});