Commit 17fa9b99f00a049e40a48de1c80c9adac0af28c4
1 parent
4e276d1b
Exists in
9014
change to new componenet
Showing
1 changed file
with
92 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,92 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +var windowIndex = 0; | |
8 | + | |
9 | +Ext.define('amdaUI.openedWindows',{ | |
10 | + extend:'Ext.ux.desktop.Module', | |
11 | + init : function() { | |
12 | + | |
13 | + this.launcher = { | |
14 | + text: 'My Windows', | |
15 | + iconCls: 'bogus', | |
16 | + listeners: { | |
17 | + scope : this, | |
18 | + 'beforeshow': function(obj, e) { | |
19 | + this.beforeshow(obj); | |
20 | + }, | |
21 | + 'beforerender': function(obj, e) { | |
22 | + // this.loadOpenedWindows(obj); | |
23 | + }, | |
24 | + 'mouseover': function(obj, e) { | |
25 | + console.log('In mouseover', obj); | |
26 | + } | |
27 | + }, | |
28 | + handler: function() { | |
29 | + return false; | |
30 | + }, | |
31 | + menu: { | |
32 | + items: [] | |
33 | + } | |
34 | + }; | |
35 | + | |
36 | + for (var i = 0; i < 5; ++i) { | |
37 | + this.launcher.menu.items.push({ | |
38 | + text: 'Window '+(++windowIndex), | |
39 | + iconCls:'bogus', | |
40 | + handler : this.createWindow, | |
41 | + scope: this, | |
42 | + windowId: windowIndex | |
43 | + }); | |
44 | + } | |
45 | + }, | |
46 | + | |
47 | + createWindow : function(src){ | |
48 | + var desktop = this.app.getDesktop(); | |
49 | + var win = desktop.getWindow('bogus'+src.windowId); | |
50 | + if(!win){ | |
51 | + win = desktop.createWindow({ | |
52 | + id: 'bogus'+src.windowId, | |
53 | + title:src.text, | |
54 | + width:640, | |
55 | + height:480, | |
56 | + html : '<p>Something useful would be in here.</p>', | |
57 | + iconCls: 'bogus', | |
58 | + animCollapse:false, | |
59 | + constrainHeader:true | |
60 | + }); | |
61 | + } | |
62 | + win.show(); | |
63 | + return win; | |
64 | + }, | |
65 | + | |
66 | + | |
67 | + beforeshow: function(obj){ | |
68 | + var opendedIems = myDesktopApp.getDesktop().taskbar.windowBar.items.items; | |
69 | + var menuItems = []; | |
70 | + opendedIems.forEach(function(record){ | |
71 | + if(record.iconCls && record.iconCls != "icon-elements"){ | |
72 | + | |
73 | + menuItems.push({ | |
74 | + text: record.text, | |
75 | + iconCls:record.iconCls, | |
76 | + windowId: record.id, | |
77 | + handler : function(obj, e){ | |
78 | + var win = myDesktopApp.getDesktop().getWindow(obj.windowId); | |
79 | + if(win) | |
80 | + win.show(); | |
81 | + }, | |
82 | + scope: this | |
83 | + }); | |
84 | + } | |
85 | + }); | |
86 | + while(obj.menu.items.length){ | |
87 | + obj.menu.items.pope(); | |
88 | + } | |
89 | + obj.menu.items.add(menuItems); | |
90 | + }, | |
91 | +}); | |
92 | + | ... | ... |