PlotTree.js
1.99 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
/**
* Project : AMDA-NG
* Name : PlotTree.js
* @class amdaPlotComp.PlotTree
* @extends Ext.tree.Panel
* @brief Tree to define all elements of a plot
* @author Benjamin Renard
* @version $Id: PlotTree.js benjamin $
*/
Ext.define('amdaPlotComp.PlotTree', {
extend: 'Ext.tree.Panel',
requires: [
'amdaPlotObj.PlotTreeNode'
],
//Link to the Plot Element Panel
plotElementPanel: null,
//Tab object
object: null,
constructor: function(config) {
this.init(config);
this.callParent(arguments);
},
buildTree: function(tabObject) {
this.object = tabObject;
//Page Node
var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject}));
//Layout node
pageNode.appendChild(new amdaPlotObj.PlotLayoutTreeNode());
//Panels node
var panelsNode = pageNode.appendChild(new amdaPlotObj.PlotPanelsTreeNode());
//Panel for test
var panelNode = panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode());
var axisNode = panelNode.appendChild(new amdaPlotObj.PlotAxisTreeNode());
axisNode.appendChild(new amdaPlotObj.PlotTimeAxisTreeNode());
panelNode.appendChild(new amdaPlotObj.PlotLegendsTreeNode());
},
onNodeSelect: function(tree,record, index, eOpts) {
if (this.plotElementPanel != null)
this.plotElementPanel.setElement(record.type, record.object);
},
getSelectedNode: function() {
var selection = this.getSelectionModel().getSelection();
if ((selection == null) || (selection.length == 0))
return null;
return selection[0];
},
init : function(config) {
var me = this;
this.plotElementPanel = config.plotElementPanel;
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true
}
});
this.plotElementPanel = config.plotElementPanel;
var myConf = {
store: store,
rootVisible: false,
listeners: {
select: me.onNodeSelect,
scope: me
}
};
Ext.apply (this , Ext.apply (arguments, myConf));
}
});