TimeTableNode.js
4.15 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
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
120
121
122
123
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
/**
* 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 $
*/
Ext.define('amdaModel.TimeTableNode', {
extend: 'amdaModel.InteractiveNode',
statics: {
nodeType: 'timeTable',
objectName: 'TimeTable'
},
constructor : function(config)
{
this.callParent(arguments);
this.set('moduleId',myDesktopApp.dynamicModules.tt.id);
this.set('objectDataModel','amdaModel.TimeTable');
if (this.get('leaf')) this.set('iconCls', 'icon-timetable');
},
localMenuItems : function()
{
var menuItems =
[
{
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
},{
fnId : 'leaf-generateCatalog',
text : 'Generate Catalog',
hidden : true
}];
return menuItems;
},
localMultiMenuItems : function() {
var menuItems =
[
{
fnId : 'mult-downloadMulti',
text : 'Download selected '+ this.self.objectName + 's'
},{
fnId : 'mult-operationsMulti',
text : 'Operations'
}];
return menuItems;
},
getAllContextMenuItems: function(){
var menuItems = this.allMenuItems();
var locMenuItems = this.localMenuItems();
return Ext.Array.merge(menuItems,locMenuItems);
},
getMultiContextMenuItems: function(){
var menuItems = this.allMenuMultiItems();
var locMenuItems = this.localMultiMenuItems();
return Ext.Array.merge(menuItems,locMenuItems);
},
onMenuItemClick : function(menu,item,event) {
this.callParent(arguments);
var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
switch (fnId) {
case 'shareLeaf':
this.shareNode(this);
break;
case 'download':
this.ttDownload();
break;
case 'operations':
this.ttOperations();
break;
case 'generateCatalog':
this.generateCatalog(this);
break;
// case 'deleteMulti':
// this.deleteMulti();
// break;
case 'downloadMulti':
this.downloadMulti();
break;
case 'operationsMulti':
this.operationsMulti();
break;
case 'visu':
this.visu();
break;
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'), me.get('nodeType'));
});
},
shareNode: function(node) {
myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt.id, true, function (module) {
module.shareTT({'name' : node.get('text'), 'id' : node.get('id')});
});
},
downloadMulti: function(){
var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
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();
})
}
});