Blame view

js/app/views/PlotComponents/PlotTabContent.js 2.43 KB
437c4dbc   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * Project   : AMDA-NG
 * Name      : PlotTab.js
 * @class   amdaPlotComp.PlotTab
 * @extends Ext.form.Panel
 * @brief   Tab content to define a plot
 * @author  Benjamin Renard
 * @version $Id: PlotTab.js benjamin $
 */

Ext.define('amdaPlotComp.PlotTabContent', {
	extend: 'Ext.form.Panel',
	
	requires: [
	           'amdaUI.TimeSelectorUI',
	           'amdaPlotComp.PlotTree'
    ],
	
    treePlot: null,
    
    //Link to the Plot Element Panel
    plotElementPanel: null,
    
27b2a53e   Benjamin Renard   Link tab plot to ...
24
25
26
27
28
29
    //linkk to the Plot Tab Panel
    plotTabPanel : null,
    
    //Link to the time selctor
    timeSelector : null,
    
437c4dbc   Benjamin Renard   First implementat...
30
31
32
33
34
35
36
37
38
39
40
    //Tab Object
    object: null,
    
    constructor: function(config) {
		this.init(config);	    
		this.callParent(arguments);
	},
	
	setTabObject : function(object) {
		this.object = object;
		this.treePlot.buildTree(this.object);
27b2a53e   Benjamin Renard   Link tab plot to ...
41
		this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate'));
e27eecbd   Benjamin Renard   Save and load TT ...
42
43
44
45
46
47
		this.addTTs(this.object.get('timeTables'));
	},
	
	addTTs : function(TTarray) {
		// set TTTab	    
		this.timeSelector.setTTTab(TTarray);
27b2a53e   Benjamin Renard   Link tab plot to ...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	},
	
	updateLinkedToMultiPlotMode : function (isLinkedToMultiPlotMode) {
		this.timeSelector.setVisible(!isLinkedToMultiPlotMode);
		this.plotTabPanel.updateLinkedToMultiPlotMode(isLinkedToMultiPlotMode);
	},
	
	updateTimeObject : function() {
		var timeSource = this.timeSelector.getActiveTimeSource();
    	var tabForm = this.getForm();
    	tabForm.updateRecord(this.object);
    	this.object.set('timesrc', timeSource);
    	if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
        	this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
437c4dbc   Benjamin Renard   First implementat...
62
63
64
65
66
67
	},
	
	init : function(config) {
		var me = this;
		
		this.plotElementPanel = config.plotElementPanel;
27b2a53e   Benjamin Renard   Link tab plot to ...
68
		this.plotTabPanel = config.plotTabPanel;
437c4dbc   Benjamin Renard   First implementat...
69
		
d341347d   Elena.Budnik   Plot Mgr ameliora...
70
71
		this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelectorTab' + config.tabId, border : false, flex: 2, collapsible: true, collapseDirection : 'bottom',  hidden: true} );
		this.treePlot = new amdaPlotComp.PlotTree({flex: 4, plotElementPanel: this.plotElementPanel, plotTabContent: this});
437c4dbc   Benjamin Renard   First implementat...
72
73
		
		var myConf = {
d341347d   Elena.Budnik   Plot Mgr ameliora...
74
75
				bodyStyle: { background : '#dfe8f6' },
				border : false,
437c4dbc   Benjamin Renard   First implementat...
76
77
78
79
80
81
82
83
84
				defaults: {
					border: false
				},
				layout: {
				    type: 'vbox',
				    pack: 'start',
				    align: 'stretch'
				},
				items: [
27b2a53e   Benjamin Renard   Link tab plot to ...
85
86
				        this.treePlot,
				        this.timeSelector
437c4dbc   Benjamin Renard   First implementat...
87
88
89
90
91
92
93
94
				]
		};
		
		Ext.apply (this , Ext.apply (arguments, myConf));
		
		
	}
});