PlotParamForm.js
6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/**
* Project : AMDA-NG
* Name : PlotParamForm.js
* @class amdaPlotComp.PlotParamForm
* @extends amdaPlotComp.amdaPlotComp.PlotStandardForm
* @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',
'amdaPlotComp.PlotOrbitSerieForm',
'amdaPlotComp.PlotHistogram2DSerieForm',
'amdaPlotComp.PlotHistogram1DSerieForm',
'amdaPlotComp.PlotSpectroForm',
'amdaPlotComp.PlotSauvaudForm',
'amdaPlotComp.PlotStatusBarForm',
'amdaPlotComp.PlotTickBarForm',
'amdaPlotComp.PlotInstantSerieForm',
'amdaPlotComp.PlotInstantSpectroForm',
'amdaPlotComp.PlotIntervalsForm',
'amdaUI.ParamArgumentsUI'
],
drawingOptionsContainer: null,
drawingOptionsFormsManager: new Ext.AbstractManager(),
paramArgs: null,
isFirstMsg: true,
destroy: function () {
this.drawingOptionsFormsManager.each(function (key, value, length) {
this.drawingOptionsFormsManager.unregister(value);
value.destroy();
}, this);
this.callParent();
},
setObject: function (object) {
this.object = object;
this.loadRecord(this.object);
this.updateDrawingOptions(this.object.get('param-drawing-type'), this.object.get('paramid'));
},
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 'orbit-serie':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotOrbitSerieForm({ id: formId }));
break;
case 'histogram2d':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotHistogram2DSerieForm({ id: formId }));
break;
case 'histogram1d':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotHistogram1DSerieForm({ id: formId }));
break;
case 'sauvaud':
if(this.object.get('type') !=2){
myDesktopApp.warningMsg('Sauvaud Plot requires <b>2D Parameter</b> ');
}else if(this.object.get('dim1-index') != '*' || this.object.get('dim2-index') != '*' ){
myDesktopApp.warningMsg('Sauvaud Plot requires the selection of <b>All Arguments</b> in both directions');
}
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSauvaudForm({ id: formId }));
break;
case 'spectro':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSpectroForm({ id: formId }));
break;
case 'status-bar':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotStatusBarForm({ id: formId }));
break;
case 'tick-bar':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotTickBarForm({ id: formId }));
break;
case 'iserie':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSerieForm({ id: formId }));
break;
case 'ispectro':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSpectroForm({ id: formId }));
break;
case 'intervals':
this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotIntervalsForm({ id: formId }));
break;
default:
this.drawingOptionsFormsManager.register(new Ext.form.Label({ id: formId, text: 'No available options for this drawing type' }));
}
}
return this.drawingOptionsFormsManager.get(formId);
},
updateDrawingOptions: function (drawingType, paramId) {
var typeField = this.getForm().findField('param-drawing-type');
var availableDrawingObjects = this.object.getAvailableDrawingObjectByPlotType(this.crtTree.getSelectedPlotType());
typeField.getStore().loadData(availableDrawingObjects);
typeField.suspendEvents();
typeField.setValue(drawingType);
typeField.resumeEvents(false);
this.drawingOptionsContainer.removeAll(false);
var drawingOptionsForm = this.getDrawingOptionsForm(drawingType);
this.drawingOptionsContainer.add(drawingOptionsForm);
drawingOptionsForm.crtTree = this.crtTree;
if (drawingOptionsForm.setObject)
drawingOptionsForm.setObject(this.object);
if (drawingOptionsForm.setParentObject)
drawingOptionsForm.setParentObject(this.parentObject);
if (this.paramArgs && paramId)
this.paramArgs.editParameter(this.object, this, function (uiScope) {
uiScope.crtTree.refresh();
});
},
onChangeParamArgs: function (uiScope, args_key, newValue, oldValue, isTemplateArg) {
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.object.get('param-drawing-type') != 'sauvaud')) {
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>');
}
uiScope.crtTree.refresh();
},
getFormItems: function () {
var me = this;
this.drawingOptionsContainer = Ext.create('Ext.container.Container', {
layout: 'fit'
});
this.paramArgs = Ext.create('amdaUI.ParamArgumentsUI', {
onChange: me.onChangeParamArgs,
scope: me
});
//ToDoparamArgsPlug
var paramInfoFieldSet = this.addStandardFieldSet('Arguments', '', [this.paramArgs]);
paramInfoFieldSet.collapsed = false;
return [
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
];
}
});