Blame view

js/app/views/PlotComponents/PlotParamForm.js 5.03 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',
e84ed2cf   Benjamin Renard   Add Interval Tick...
16
	    'amdaPlotComp.PlotOrbitSerieForm',
a0bf9157   Benjamin Renard   Add tick plot and...
17
18
	    'amdaPlotComp.PlotSpectroForm',
	    'amdaPlotComp.PlotStatusBarForm',
6a801541   Benjamin Renard   Add possibility t...
19
20
	    'amdaPlotComp.PlotTickBarForm',
	    'amdaPlotComp.PlotInstantSerieForm',
7ac3ce50   Benjamin Renard   First implementat...
21
	    'amdaPlotComp.PlotInstantSpectroForm',
ebebd92d   Benjamin Renard   Add intervals dra...
22
	    'amdaPlotComp.PlotIntervalsForm',
7ac3ce50   Benjamin Renard   First implementat...
23
	    'amdaUI.ParamArgumentsUI'
17433635   Benjamin Renard   Add series and sp...
24
25
26
27
28
29
	],
	
	drawingOptionsContainer: null,
	
	drawingOptionsFormsManager : new Ext.AbstractManager(),
	
7ac3ce50   Benjamin Renard   First implementat...
30
	paramArgs : null,
eac92219   Benjamin Renard   Do not call onCha...
31
32

        isFirstMsg: true,
7ac3ce50   Benjamin Renard   First implementat...
33
	
a971060f   Benjamin Renard   Fix some bugs
34
35
	destroy: function() {
		this.drawingOptionsFormsManager.each(function (key, value, length) {
ecac355e   Benjamin Renard   Destroy plot elem...
36
37
38
    			this.drawingOptionsFormsManager.unregister(value);
			value.destroy();
    		}, this);
a971060f   Benjamin Renard   Fix some bugs
39
40
41
		this.callParent();
	},
	
17433635   Benjamin Renard   Add series and sp...
42
43
44
	setObject : function(object) {
		this.object = object;
		this.loadRecord(this.object);
bb6e93d9   Benjamin Renard   Implement templat...
45
		this.updateDrawingOptions(this.object.get('param-drawing-type'), this.object.get('paramid'));
17433635   Benjamin Renard   Add series and sp...
46
47
48
49
50
51
52
53
54
55
	},
	
	getDrawingOptionsForm: function(type) {
		var formId = '';
		if (!type || (type == ''))
			formId = 'none';
		else
			formId = type;
		
		formId += '-drawing-options-form';
17433635   Benjamin Renard   Add series and sp...
56
57
		if (!this.drawingOptionsFormsManager.get(formId))
		{
ebebd92d   Benjamin Renard   Add intervals dra...
58
console.log(type);
17433635   Benjamin Renard   Add series and sp...
59
60
61
62
63
64
			switch(type)
			{
				//Create drawing options form
				case 'serie' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSerieForm({id : formId}));
					break;
e84ed2cf   Benjamin Renard   Add Interval Tick...
65
66
67
				case 'orbit-serie' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotOrbitSerieForm({id : formId}));
					break;
17433635   Benjamin Renard   Add series and sp...
68
69
70
				case 'spectro' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSpectroForm({id : formId}));
					break;
a0bf9157   Benjamin Renard   Add tick plot and...
71
72
73
74
75
76
				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...
77
78
79
80
81
82
				case 'iserie' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSerieForm({id : formId}));
					break;
				case 'ispectro' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSpectroForm({id : formId}));
					break;
ebebd92d   Benjamin Renard   Add intervals dra...
83
84
85
				case 'intervals' :
					this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotIntervalsForm({id : formId}));
					break;
a0bf9157   Benjamin Renard   Add tick plot and...
86
 				default :
17433635   Benjamin Renard   Add series and sp...
87
88
89
90
91
92
93
94
					this.drawingOptionsFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this drawing type'}));
			}
		}
		
		return this.drawingOptionsFormsManager.get(formId);
	
	},
	
7ac3ce50   Benjamin Renard   First implementat...
95
	updateDrawingOptions: function(drawingType, paramId) {
17433635   Benjamin Renard   Add series and sp...
96
97
		var typeField = this.getForm().findField('param-drawing-type');
		
a0bf9157   Benjamin Renard   Add tick plot and...
98
99
		var availableDrawingObjects = this.object.getAvailableDrawingObjectByPlotType(this.crtTree.getSelectedPlotType());
		typeField.getStore().loadData(availableDrawingObjects);
a971060f   Benjamin Renard   Fix some bugs
100
101
102
		typeField.suspendEvents();
		typeField.setValue(drawingType);
		typeField.resumeEvents(false);
17433635   Benjamin Renard   Add series and sp...
103
104
105
		
		this.drawingOptionsContainer.removeAll(false);
		
a0bf9157   Benjamin Renard   Add tick plot and...
106
		var drawingOptionsForm = this.getDrawingOptionsForm(drawingType);
17433635   Benjamin Renard   Add series and sp...
107
108
109
110
		this.drawingOptionsContainer.add(drawingOptionsForm);
		drawingOptionsForm.crtTree = this.crtTree;
		if (drawingOptionsForm.setObject)
			drawingOptionsForm.setObject(this.object);
7ac3ce50   Benjamin Renard   First implementat...
111
		if (this.paramArgs && paramId)
bb6e93d9   Benjamin Renard   Implement templat...
112
			this.paramArgs.editParameter(this.object, this, function (uiScope) {
7ac3ce50   Benjamin Renard   First implementat...
113
114
115
116
				uiScope.crtTree.refresh();
			});
	},
	
51b7c77c   Benjamin Renard   Add templated par...
117
	onChangeParamArgs: function(uiScope, args_key, newValue, oldValue, isTemplateArg) {
eac92219   Benjamin Renard   Do not call onCha...
118
119
120
121
122
		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...
123
		uiScope.crtTree.refresh();
17433635   Benjamin Renard   Add series and sp...
124
125
126
127
128
129
130
131
132
	},
	
	getFormItems: function() {
		var me = this;
		
		this.drawingOptionsContainer = Ext.create('Ext.container.Container', {
			layout: 'fit'
		});
		
7ac3ce50   Benjamin Renard   First implementat...
133
134
135
136
137
138
		this.paramArgs = Ext.create('amdaUI.ParamArgumentsUI', {
			onChange : me.onChangeParamArgs,
			scope: me
		});
		
		//ToDoparamArgsPlug
7ac3ce50   Benjamin Renard   First implementat...
139
140
141
		var paramInfoFieldSet = this.addStandardFieldSet('Arguments', '', [this.paramArgs]);
		paramInfoFieldSet.collapsed = false;
		
17433635   Benjamin Renard   Add series and sp...
142
		return [
7ac3ce50   Benjamin Renard   First implementat...
143
		    paramInfoFieldSet,
a0bf9157   Benjamin Renard   Add tick plot and...
144
		    this.addStandardCombo('param-drawing-type', 'Drawing type', [{'key' : '', 'value' : 'None'}], function(name, value, oldValue) {
a971060f   Benjamin Renard   Fix some bugs
145
146
147
		    	if (me.object.get('param-drawing-type') != value)
		    	{
		    		me.object.changeDrawingType(value);
e84ed2cf   Benjamin Renard   Add Interval Tick...
148
149
		    		me.object.set('param-drawing-type', value);
	        		me.crtTree.refresh();
a971060f   Benjamin Renard   Fix some bugs
150
151
		    		me.updateDrawingOptions(value);
		    	}
17433635   Benjamin Renard   Add series and sp...
152
153
154
155
	        }),
	        this.drawingOptionsContainer
		];
	}
ecac355e   Benjamin Renard   Destroy plot elem...
156
});