Blame view

js/app/views/ResultUI.js 2.26 KB
16035364   Benjamin Renard   First commit
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
/**
 * Project   : AMDA-NG
 * Name      : ResultUI.js
 * @class 	 amdaUI.ResultUI
 * @extends  Ext. 
 * @brief	 Result  Module UI definition (View)
 * @author 	  
 * @version  $Id: ResultUI.js 1052 2012-07-20 14:21:37Z elena $
 ********************************************************************************
 *    FT Id     :   Date   : Name - Description
 *******************************************************************************
 *              
 */

Ext.define('amdaUI.ResultUI', {
    extend: 'Ext.container.Container',
    alias: 'widget.panelResult',
    
    requires: [
        'amdaUI.TabResultUI'
    ],

    constructor: function(config) {
        this.init(config);
        this.callParent(arguments);   
	
    },
    
    getTabResult: function(nodeType) {
      var tabId = 'tab-'+nodeType;      
      return this.tabPanel.getComponent(tabId);
    },
    
    setObject: function(obj){},
    
    setResult: function(linkedNode){
        var configResult = {nodeType: linkedNode.get('jobType')}; 
        var panelResult = this.getTabResult(linkedNode.get('jobType'));
	
	if (!panelResult) {
	    // create the plot Tab Result Panel	    
	     panelResult = Ext.create('widget.tabResult',configResult);
	    	     
	    // add it
	    this.tabPanel.add(panelResult);	  	      
	} 
	   // focus on it
	    this.tabPanel.setActiveTab(panelResult);
	    var format = linkedNode.get('object').get('format');
	    if (!format) format = 'unknown';	  
	    var compression = linkedNode.get('object').get('compression');	     
	    if (!compression) compression = 'unknown';	
16035364   Benjamin Renard   First commit
53
54
55
56
57
58
	  
//TODO args as object ???	
	    panelResult.addResult(
	    		linkedNode.get('text'),
	    		linkedNode.get('object').get('resultId'),
	    		linkedNode.get('object').get('folderId'),
16035364   Benjamin Renard   First commit
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	    		compression.toLowerCase(),
	    		format.toLowerCase(),
	    		linkedNode.get('id'));
    },
    
    init : function(config)	{

        this.tabPanel = Ext.create('Ext.tab.Panel',{	   
	    layout: { type :'vbox' },        
            activeTab: 0
        });
	 
	
        var myConf = {
            layout: 'fit',   
            items: [                 
                     this.tabPanel                        
            ]
        };

        Ext.apply (this , Ext.apply (arguments, myConf));	    	    
    }
    
});