Blame view

js/app/views/PlotComponents/PlotParamForm.js 5.25 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
 * @brief   Form to define specifics param options
 * @author  Benjamin Renard
 * @version $Id: PlotParamForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotParamForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
4dbd97ec   Menouard AZIB   Goal is reached b...
13

17433635   Benjamin Renard   Add series and sp...
14
	requires: [
4dbd97ec   Menouard AZIB   Goal is reached b...
15
16
17
		'amdaPlotComp.PlotSerieForm',
		'amdaPlotComp.PlotOrbitSerieForm',
		'amdaPlotComp.PlotSpectroForm',
5b3c2c8a   Hacene SI HADJ MOHAND   ihm for sauvaud plot
18
                                        'amdaPlotComp.PlotSauvaudForm',
4dbd97ec   Menouard AZIB   Goal is reached b...
19
20
21
22
23
24
		'amdaPlotComp.PlotStatusBarForm',
		'amdaPlotComp.PlotTickBarForm',
		'amdaPlotComp.PlotInstantSerieForm',
		'amdaPlotComp.PlotInstantSpectroForm',
		'amdaPlotComp.PlotIntervalsForm',
		'amdaUI.ParamArgumentsUI'
17433635   Benjamin Renard   Add series and sp...
25
	],
4dbd97ec   Menouard AZIB   Goal is reached b...
26

17433635   Benjamin Renard   Add series and sp...
27
	drawingOptionsContainer: null,
4dbd97ec   Menouard AZIB   Goal is reached b...
28
29
30
31
32
33
34
35

	drawingOptionsFormsManager: new Ext.AbstractManager(),

	paramArgs: null,

	isFirstMsg: true,

	destroy: function () {
a971060f   Benjamin Renard   Fix some bugs
36
		this.drawingOptionsFormsManager.each(function (key, value, length) {
4dbd97ec   Menouard AZIB   Goal is reached b...
37
			this.drawingOptionsFormsManager.unregister(value);
ecac355e   Benjamin Renard   Destroy plot elem...
38
			value.destroy();
4dbd97ec   Menouard AZIB   Goal is reached b...
39
		}, this);
a971060f   Benjamin Renard   Fix some bugs
40
41
		this.callParent();
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
42
43

	setObject: function (object) {
17433635   Benjamin Renard   Add series and sp...
44
45
		this.object = object;
		this.loadRecord(this.object);
bb6e93d9   Benjamin Renard   Implement templat...
46
		this.updateDrawingOptions(this.object.get('param-drawing-type'), this.object.get('paramid'));
17433635   Benjamin Renard   Add series and sp...
47
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
48
49

	getDrawingOptionsForm: function (type) {
17433635   Benjamin Renard   Add series and sp...
50
51
52
53
54
		var formId = '';
		if (!type || (type == ''))
			formId = 'none';
		else
			formId = type;
4dbd97ec   Menouard AZIB   Goal is reached b...
55

17433635   Benjamin Renard   Add series and sp...
56
		formId += '-drawing-options-form';
4dbd97ec   Menouard AZIB   Goal is reached b...
57
58
		if (!this.drawingOptionsFormsManager.get(formId)) {
			switch (type) {
17433635   Benjamin Renard   Add series and sp...
59
				//Create drawing options form
4dbd97ec   Menouard AZIB   Goal is reached b...
60
61
				case 'serie':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSerieForm({ id: formId }));
17433635   Benjamin Renard   Add series and sp...
62
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
63
64
				case 'orbit-serie':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotOrbitSerieForm({ id: formId }));
e84ed2cf   Benjamin Renard   Add Interval Tick...
65
					break;
5b3c2c8a   Hacene SI HADJ MOHAND   ihm for sauvaud plot
66
67
68
                                                                                case 'sauvaud':
                                                                                                    this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSauvaudForm({ id: formId }));
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
69
70
				case 'spectro':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSpectroForm({ id: formId }));
17433635   Benjamin Renard   Add series and sp...
71
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
72
73
				case 'status-bar':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotStatusBarForm({ id: formId }));
a0bf9157   Benjamin Renard   Add tick plot and...
74
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
75
76
				case 'tick-bar':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotTickBarForm({ id: formId }));
a0bf9157   Benjamin Renard   Add tick plot and...
77
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
78
79
				case 'iserie':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSerieForm({ id: formId }));
6a801541   Benjamin Renard   Add possibility t...
80
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
81
82
				case 'ispectro':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSpectroForm({ id: formId }));
6a801541   Benjamin Renard   Add possibility t...
83
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
84
85
				case 'intervals':
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotIntervalsForm({ id: formId }));
ebebd92d   Benjamin Renard   Add intervals dra...
86
					break;
4dbd97ec   Menouard AZIB   Goal is reached b...
87
88
				default:
					this.drawingOptionsFormsManager.register(new Ext.form.Label({ id: formId, text: 'No available options for this drawing type' }));
17433635   Benjamin Renard   Add series and sp...
89
90
			}
		}
4dbd97ec   Menouard AZIB   Goal is reached b...
91

17433635   Benjamin Renard   Add series and sp...
92
		return this.drawingOptionsFormsManager.get(formId);
4dbd97ec   Menouard AZIB   Goal is reached b...
93

17433635   Benjamin Renard   Add series and sp...
94
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
95
96

	updateDrawingOptions: function (drawingType, paramId) {
17433635   Benjamin Renard   Add series and sp...
97
		var typeField = this.getForm().findField('param-drawing-type');
4dbd97ec   Menouard AZIB   Goal is reached b...
98

a0bf9157   Benjamin Renard   Add tick plot and...
99
100
		var availableDrawingObjects = this.object.getAvailableDrawingObjectByPlotType(this.crtTree.getSelectedPlotType());
		typeField.getStore().loadData(availableDrawingObjects);
a971060f   Benjamin Renard   Fix some bugs
101
102
103
		typeField.suspendEvents();
		typeField.setValue(drawingType);
		typeField.resumeEvents(false);
4dbd97ec   Menouard AZIB   Goal is reached b...
104

17433635   Benjamin Renard   Add series and sp...
105
		this.drawingOptionsContainer.removeAll(false);
4dbd97ec   Menouard AZIB   Goal is reached b...
106

a0bf9157   Benjamin Renard   Add tick plot and...
107
		var drawingOptionsForm = this.getDrawingOptionsForm(drawingType);
17433635   Benjamin Renard   Add series and sp...
108
109
110
111
		this.drawingOptionsContainer.add(drawingOptionsForm);
		drawingOptionsForm.crtTree = this.crtTree;
		if (drawingOptionsForm.setObject)
			drawingOptionsForm.setObject(this.object);
7ac3ce50   Benjamin Renard   First implementat...
112
		if (this.paramArgs && paramId)
bb6e93d9   Benjamin Renard   Implement templat...
113
			this.paramArgs.editParameter(this.object, this, function (uiScope) {
7ac3ce50   Benjamin Renard   First implementat...
114
115
116
				uiScope.crtTree.refresh();
			});
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
117
118

	onChangeParamArgs: function (uiScope, args_key, newValue, oldValue, isTemplateArg) {
eac92219   Benjamin Renard   Do not call onCha...
119
120
121
122
123
		if ((uiScope.isFirstMsg) && (uiScope.object.get('type') == 2) && (uiScope.object.get('dim1-sum-type') == 0) && (uiScope.object.get('dim2-sum-type') == 0) &&
			(uiScope.object.get('dim1-index') == '*') && (uiScope.object.get('dim2-index') == '*')) {
			uiScope.isFirstMsg = false;
			myDesktopApp.warningMsg('If argument <i>All</i> is set for both dimensions output will be the total sum <b>(not spectra!)</b>');
		}
7ac3ce50   Benjamin Renard   First implementat...
124
		uiScope.crtTree.refresh();
17433635   Benjamin Renard   Add series and sp...
125
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
126
127

	getFormItems: function () {
17433635   Benjamin Renard   Add series and sp...
128
		var me = this;
4dbd97ec   Menouard AZIB   Goal is reached b...
129

17433635   Benjamin Renard   Add series and sp...
130
131
132
		this.drawingOptionsContainer = Ext.create('Ext.container.Container', {
			layout: 'fit'
		});
4dbd97ec   Menouard AZIB   Goal is reached b...
133

7ac3ce50   Benjamin Renard   First implementat...
134
		this.paramArgs = Ext.create('amdaUI.ParamArgumentsUI', {
4dbd97ec   Menouard AZIB   Goal is reached b...
135
			onChange: me.onChangeParamArgs,
7ac3ce50   Benjamin Renard   First implementat...
136
137
			scope: me
		});
4dbd97ec   Menouard AZIB   Goal is reached b...
138

7ac3ce50   Benjamin Renard   First implementat...
139
		//ToDoparamArgsPlug
7ac3ce50   Benjamin Renard   First implementat...
140
141
		var paramInfoFieldSet = this.addStandardFieldSet('Arguments', '', [this.paramArgs]);
		paramInfoFieldSet.collapsed = false;
4dbd97ec   Menouard AZIB   Goal is reached b...
142

17433635   Benjamin Renard   Add series and sp...
143
		return [
4dbd97ec   Menouard AZIB   Goal is reached b...
144
145
146
147
148
149
150
151
152
153
			paramInfoFieldSet,
			this.addStandardCombo('param-drawing-type', 'Drawing type', [{ 'key': '', 'value': 'None' }], function (name, value, oldValue) {
				if (me.object.get('param-drawing-type') != value) {
					me.object.changeDrawingType(value);
					me.object.set('param-drawing-type', value);
					me.crtTree.refresh();
					me.updateDrawingOptions(value);
				}
			}),
			this.drawingOptionsContainer
17433635   Benjamin Renard   Add series and sp...
154
155
		];
	}
ecac355e   Benjamin Renard   Destroy plot elem...
156
});