Blame view

js/app/models/TimeTableNode.js 4.53 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
/** 
 * Project  : AMDA-NG4
 * Name     : TimeTableNode.js
 * @class   amdaModel.TimeTableNode
 * @extends amdaModel.InteractiveNode
 * @brief   Basic Model of Node corresponding to a amda Time Table
 * @author  
 * @version $Id: TimeTableNode.js 1904 2013-11-25 12:42:02Z elena $
16035364   Benjamin Renard   First commit
9
10
11
12
13
14
15
16
17
18
19
 */

Ext.define('amdaModel.TimeTableNode', {

    extend: 'amdaModel.InteractiveNode',
    
    statics: {
        nodeType: 'timeTable',
        objectName: 'Time Table'
    },

3a5f60a1   elena   proper use os sta...
20
21
    constructor : function(config)
    {	
16035364   Benjamin Renard   First commit
22
        this.callParent(arguments);
3a5f60a1   elena   proper use os sta...
23
24
        this.set('moduleId',myDesktopApp.dynamicModules.tt.id);
        this.set('objectDataModel','amdaModel.TimeTable');       
16035364   Benjamin Renard   First commit
25
26
27
        if (this.get('leaf')) this.set('iconCls', 'icon-timetable');
    },
  
3a5f60a1   elena   proper use os sta...
28
29
    localMenuItems : function() 
    {
16035364   Benjamin Renard   First commit
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
        var menuItems =
         [/*{
            fnId : 'dire-shareNode',
            text : 'Share content',
            hidden : true
        },{
            fnId : 'leaf-shareLeaf',
            text : 'Share Time Table',
            hidden : true
        },*/{
            fnId : 'leaf-download',
            text : 'Download Time Table',
            hidden : true
        },{
            fnId : 'leaf-operations',
            text : 'Operations',
            hidden : true
        }];
     
        return menuItems;
    },

    localMultiMenuItems : function() {
        var menuItems =
         [/*{
            fnId : 'mult-shareMulti',
d18b535d   elena   catalog draft + c...
56
            text : 'Share selected '+this.self.objectName+'s'
16035364   Benjamin Renard   First commit
57
58
        },*/{
            fnId : 'mult-downloadMulti',
d18b535d   elena   catalog draft + c...
59
            text : 'Download selected '+this.self.objectName+'s'
16035364   Benjamin Renard   First commit
60
61
62
63
64
65
66
67
68
        },{
            fnId : 'mult-operationsMulti',
            text : 'Operations'
        }];
     
        return menuItems;
    },
    
    getAllContextMenuItems: function(){
d18b535d   elena   catalog draft + c...
69
70
        
        var menuItems = this.allMenuItems();
16035364   Benjamin Renard   First commit
71
        var locMenuItems = this.localMenuItems();
d18b535d   elena   catalog draft + c...
72
73
        
        return  Ext.Array.merge(menuItems,locMenuItems);       
16035364   Benjamin Renard   First commit
74
75
    },
    
d18b535d   elena   catalog draft + c...
76
77
78
79
80
81
     getMultiContextMenuItems: function(){
        
        var menuItems = this.allMenuMultiItems();
        var locMenuItems = this.localMultiMenuItems();
        
        return  Ext.Array.merge(menuItems,locMenuItems);       
16035364   Benjamin Renard   First commit
82
    },
d18b535d   elena   catalog draft + c...
83
    
16035364   Benjamin Renard   First commit
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
    onMenuItemClick : function(menu,item,event) {
 
        this.callParent(arguments);
        
	    var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);

	    switch (fnId) {
	    
 	    case 'shareNode':		 
 	    case 'shareLeaf':   
 	        this.shareNode(this); 
 	        break;

	    case 'download':
	    	this.ttDownload();
	    	break;
	    	
	    case 'operations':
	        this.ttOperations();
	        break;

//	    case 'deleteMulti':
//	        this.deleteMulti();
//	        break;

	    case 'shareMulti':
	        this.shareMulti();
	        break;

	    case 'downloadMulti':
	        this.downloadMulti();
	        break;

	    case 'operationsMulti':
	        this.operationsMulti();
	        break;
5cfea1f2   elena   vizu draft
120
121
122
123
	   
	    case 'visu':
	        this.visu();
	        break;
16035364   Benjamin Renard   First commit
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

	    default:
	        break;
	    } // switch end 
	 
     },
 
     ttDownload : function() {
    	 // download Module
    	 var me = this;
    	 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id, true, function (module) {
    		 module.createWindow();
        	 var uidownload = module.getUiContent();
      	     uidownload.addTTdownload(me.get('text'), me.get('id'));
    	 });
     },
     
     ttOperations : function() {
         var me = this;
         myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt_op.id, true, function (module) {
        	 module.createWindow();
        	 module.getUiContent().addTT(me.get('text'), me.get('id'));
         });

     },
 
     shareNode: function(node) {
         alert("NOT IMPLEMENTED YET");
     },
     
     shareMulti: function(){
         var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
         alert(selection.length+' to share!');
         alert("NOT IMPLEMENTED YET");
     },
     
     downloadMulti: function(){
         var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
//         alert(selection.length+' to download!');
         Ext.Array.each(selection,function(item,index,allItems){
             item.ttDownload();
         })
     },
     
     operationsMulti: function(){
         var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
         alert(selection.length+' time tables to send into operationsTT module!');
         Ext.Array.each(selection,function(item,index,allItems){
             item.ttOperations();
         })
     }
});