Blame view

js/app/models/SpecialParamNode.js 3.12 KB
b0f72ee0   Erdogan Furkan   #10557 For now
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
/** 
 * Project  : AMDA-NG4
 * Name     : SpecialParamNode.js
 * @class   amdaModel.SpecialParamNode
 * @extends amdaModel.InteractiveNode
 * @brief    
 * @author  
 * @version $Id: MyDataNode.js 2267 2014-04-03 10:13:16Z elena $
 * @todo
 *******************************************************************************
 *    FT Id     :   Date   : Name - Description
 *******************************************************************************
 * 
 */

Ext.define('amdaModel.SpecialParamNode', {
  
    extend: 'amdaModel.InteractiveNode',
    
    statics:{
        nodeType: 'specialParam'
    },
    
    fields: 
    [
    ],
    
    dependentRootNodeId :  'specialParam-treeRootNode',
    
    constructor : function(config){
        this.callParent(arguments);
98c92bbf   Erdogan Furkan   #10557 - Done (Ma...
32
33
34

        this.set('moduleId',myDesktopApp.dynamicModules.param.id);
        this.set('objectDataModel',amdaModel.Parameter.$className);
b0f72ee0   Erdogan Furkan   #10557 For now
35
36
37
38
    },
       
    localMenuItems : function() {
        var menuItems =
98c92bbf   Erdogan Furkan   #10557 - Done (Ma...
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
        [{
            fnId: 'leaf-plotParam',
            text: 'Plot Parameter',
            hidden: true
        }, {
            fnId: 'leaf-downParam',
            text: 'Download Parameter',
            hidden: true
        }, {
            fnId: 'para-plotParam',
            text: 'Plot Parameter',
            hidden: true
        }, {
            fnId: 'para-downParam',
            text: 'Download Parameter',
            hidden: true
        },{
			fnId : 'leaf-createDerivedParam',
			text : 'Create Derived Parameter',
			hidden : true
		},];
b0f72ee0   Erdogan Furkan   #10557 For now
60
61
62
63
        return menuItems;
    },

    getAllContextMenuItems: function(){
b0f72ee0   Erdogan Furkan   #10557 For now
64
        var locMenuItems = this.localMenuItems();
98c92bbf   Erdogan Furkan   #10557 - Done (Ma...
65
        return  locMenuItems;
b0f72ee0   Erdogan Furkan   #10557 For now
66
67
68
    },

    onMenuItemClick : function(menu,item,event) {
98c92bbf   Erdogan Furkan   #10557 - Done (Ma...
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
        var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
        if(item){
            switch (item.fnId)
        {
            case 'root-collapseAll':
				case 'dire-collapseAll':
				case 'miss-collapseAll':
						if(this && !this.isLeaf()) {
							this.collapse(true);
						}
						break;
            case 'leaf-createDerivedParam':
                this.createLeaf(this);
                break;
            case 'leaf-plotParam':
            case 'para-plotParam':
                this.createPlot(this);
                break;
            case 'leaf-downParam':
            case 'para-downParam':
                this.createDownload(this);
                break;
            default:
                break;
        } // switch end 
        }
        
b0f72ee0   Erdogan Furkan   #10557 For now
96
97
    },

98c92bbf   Erdogan Furkan   #10557 - Done (Ma...
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
    createLeaf: function(node)
	{
		myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id, true, function(module) {
			if (!myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.param.id)) {               
				var param =  Ext.create(node.get('objectDataModel')); 
				var newNode = Ext.create(amdaModel.DerivedParamNode.$className, {leaf : true, object : param});              
				// edit newNode into Parameter Module with node as contextNode
				newNode.editInModule();
			}  
			var paramName = node.get('id');
			var components = null;
			module.addParam(paramName,node.get('leaf'),node.get('needsArgs'),components);
		});
	},

b0f72ee0   Erdogan Furkan   #10557 For now
113
});