Blame view

js/app/views/PlotComponents/PlotElementPanel.js 3 KB
437c4dbc   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * 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: [
abe09878   Benjamin Renard   Add panels and ax...
15
16
17
18
19
	           'amdaPlotComp.PlotPageForm',
	           'amdaPlotComp.PlotPanelForm',
	           'amdaPlotComp.PlotBaseAxisForm',
	           'amdaPlotComp.PlotTimeAxisForm',
	           'amdaPlotComp.PlotEpochAxisForm',
17433635   Benjamin Renard   Add series and sp...
20
	           'amdaPlotComp.PlotColorAxisForm',
003ba315   Benjamin Renard   Add Epoch Plot an...
21
22
	           'amdaPlotComp.PlotParamForm',
	           'amdaPlotComp.PlotLayoutForm'
437c4dbc   Benjamin Renard   First implementat...
23
24
	],
	
abe09878   Benjamin Renard   Add panels and ax...
25
26
	elementFormsManager : new Ext.AbstractManager(),
	
abe09878   Benjamin Renard   Add panels and ax...
27
28
	crtTree   : null,
	
437c4dbc   Benjamin Renard   First implementat...
29
30
31
32
33
	constructor: function(config) {
		this.init(config);	    
		this.callParent(arguments);
	},
	
abe09878   Benjamin Renard   Add panels and ax...
34
35
	setElement: function(type, object, tree) {
		this.removeAll(false);
437c4dbc   Benjamin Renard   First implementat...
36
		
17433635   Benjamin Renard   Add series and sp...
37
		this.crtTree   = tree;
437c4dbc   Benjamin Renard   First implementat...
38
		
abe09878   Benjamin Renard   Add panels and ax...
39
		var elementForm = this.getElementForm(type);
a0bf9157   Benjamin Renard   Add tick plot and...
40
		
abe09878   Benjamin Renard   Add panels and ax...
41
		this.add(elementForm);
17433635   Benjamin Renard   Add series and sp...
42
		elementForm.crtTree = tree;
abe09878   Benjamin Renard   Add panels and ax...
43
44
		if (elementForm.setObject)
			elementForm.setObject(object);
437c4dbc   Benjamin Renard   First implementat...
45
46
47
	},
	
	resetElement: function() {
17433635   Benjamin Renard   Add series and sp...
48
		this.setElement('',null,null);
abe09878   Benjamin Renard   Add panels and ax...
49
50
51
52
53
54
	},
	
	getElementForm: function(type) {
		var formId = type;
		if (type == '')
			formId = 'none';
17433635   Benjamin Renard   Add series and sp...
55

abe09878   Benjamin Renard   Add panels and ax...
56
		formId += '-element-form';
17433635   Benjamin Renard   Add series and sp...
57
			
abe09878   Benjamin Renard   Add panels and ax...
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
		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;
17433635   Benjamin Renard   Add series and sp...
83
84
85
			case 'param' :
				this.elementFormsManager.register(new amdaPlotComp.PlotParamForm({id : formId}));
				break;
003ba315   Benjamin Renard   Add Epoch Plot an...
86
87
88
			case 'layout' :
				this.elementFormsManager.register(new amdaPlotComp.PlotLayoutForm({id : formId}));
				break;
abe09878   Benjamin Renard   Add panels and ax...
89
90
91
92
93
94
95
96
97
			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);
437c4dbc   Benjamin Renard   First implementat...
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
	},
	
	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));
	}
});