PlotElementPanel.js
3 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
/**
* Project : AMDA-NG
* Name : PlotElementPanel.js
* @class amdaPlotComp.PlotElementPanel
* @extends Ext.form.Panel
* @brief Element of a plot request definition
* @author Benjamin Renard
* @version $Id: PlotElementPanel.js benjamin $
*/
Ext.define('amdaPlotComp.PlotElementPanel', {
extend: 'Ext.form.Panel',
requires: [
'amdaPlotComp.PlotPageForm',
'amdaPlotComp.PlotPanelForm',
'amdaPlotComp.PlotBaseAxisForm',
'amdaPlotComp.PlotTimeAxisForm',
'amdaPlotComp.PlotEpochAxisForm',
'amdaPlotComp.PlotColorAxisForm',
'amdaPlotComp.PlotParamForm',
'amdaPlotComp.PlotLayoutForm'
],
elementFormsManager : new Ext.AbstractManager(),
crtTree : null,
constructor: function(config) {
this.init(config);
this.callParent(arguments);
},
setElement: function(type, object, tree) {
this.removeAll(false);
this.crtTree = tree;
var elementForm = this.getElementForm(type);
this.add(elementForm);
elementForm.crtTree = tree;
if (elementForm.setObject)
elementForm.setObject(object);
},
resetElement: function() {
this.setElement('',null,null);
},
getElementForm: function(type) {
var formId = type;
if (type == '')
formId = 'none';
formId += '-element-form';
if (!this.elementFormsManager.get(formId))
{
//Create element form
switch (type)
{
case 'page' :
this.elementFormsManager.register(new amdaPlotComp.PlotPageForm({id : formId}));
break;
case 'panel' :
this.elementFormsManager.register(new amdaPlotComp.PlotPanelForm({id : formId}));
break;
case 'time-axis' :
this.elementFormsManager.register(new amdaPlotComp.PlotTimeAxisForm({id : formId}));
break;
case 'epoch-axis' :
this.elementFormsManager.register(new amdaPlotComp.PlotEpochAxisForm({id : formId}));
break;
case 'color-axis' :
this.elementFormsManager.register(new amdaPlotComp.PlotColorAxisForm({id : formId}));
break;
case 'x-axis' :
case 'y-left-axis' :
case 'y-right-axis' :
this.elementFormsManager.register(new amdaPlotComp.PlotBaseAxisForm({id : formId}));
break;
case 'param' :
this.elementFormsManager.register(new amdaPlotComp.PlotParamForm({id : formId}));
break;
case 'layout' :
this.elementFormsManager.register(new amdaPlotComp.PlotLayoutForm({id : formId}));
break;
case '' :
this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'}));
break;
default :
this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this element'}));
}
}
return this.elementFormsManager.get(formId);
},
init : function(config) {
var me = this;
var myConf = {
title : 'Selected element options',
bodyStyle: { background : '#dfe8f6' },
autoScroll: true,
defaults: {
border: false
}
};
Ext.apply (this , Ext.apply (arguments, myConf));
}
});