-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccordionWindow.js
157 lines (139 loc) · 5.31 KB
/
AccordionWindow.js
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
/*
This file is part of Ext JS 4
Copyright (c) 2011 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
*/
/*!
* Ext JS Library 4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.define('AdminDesktop.AccordionWindow', {
extend: 'Ext.ux.desktop.Module',
requires: [
'Ext.data.TreeStore',
'Ext.layout.container.Accordion',
'Ext.toolbar.Spacer',
'Ext.tree.Panel'
],
id:'acc-win',
init : function(){
/*this.launcher = {
text: 'Accordion Window',
iconCls:'accordion',
handler : this.createWindow,
scope: this
};*/
},
createTree : function(){
var tree = Ext.create('Ext.tree.Panel', {
id:'im-tree',
title: 'Online Users',
rootVisible:false,
lines:false,
autoScroll:true,
tools:[{
type: 'refresh',
handler: function(c, t) {
tree.setLoading(true, tree.body);
var root = tree.getRootNode();
root.collapseChildren(true, false);
Ext.Function.defer(function() { // mimic a server call
tree.setLoading(false);
root.expand(true, true);
}, 1000);
}
}],
store: Ext.create('Ext.data.TreeStore', {
root: {
text:'Online',
expanded: true,
children:[{
text:'Friends',
expanded:true,
children:[
{ text:'Brian', iconCls:'user', leaf:true },
{ text:'Kevin', iconCls:'user', leaf:true },
{ text:'Mark', iconCls:'user', leaf:true },
{ text:'Matt', iconCls:'user', leaf:true },
{ text:'Michael', iconCls:'user', leaf:true },
{ text:'Mike Jr', iconCls:'user', leaf:true },
{ text:'Mike Sr', iconCls:'user', leaf:true },
{ text:'JR', iconCls:'user', leaf:true },
{ text:'Rich', iconCls:'user', leaf:true },
{ text:'Nige', iconCls:'user', leaf:true },
{ text:'Zac', iconCls:'user', leaf:true }
]
},{
text:'Family',
expanded:true,
children:[
{ text:'Kiana', iconCls:'user-girl', leaf:true },
{ text:'Aubrey', iconCls:'user-girl', leaf:true },
{ text:'Cale', iconCls:'user-kid', leaf:true }
]
}]
}
})
});
return tree;
},
createWindow : function(){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('acc-win');
if (!win) {
win = desktop.createWindow({
id: 'acc-win',
title: 'Accordion Window',
width: 250,
height: 400,
iconCls: 'accordion',
animCollapse: false,
constrainHeader: true,
bodyBorder: true,
tbar: {
xtype: 'toolbar',
ui: 'plain',
items: [{
tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},
iconCls:'connect'
},
'-',
{
tooltip:'Add a new user',
iconCls:'user-add'
},
' ',
{
tooltip:'Remove the selected user',
iconCls:'user-delete'
}]
},
layout: 'accordion',
border: false,
items: [
this.createTree(),
{
title: 'Settings',
html:'<p>Something useful would be in here.</p>',
autoScroll:true
},
{
title: 'Even More Stuff',
html : '<p>Something useful would be in here.</p>'
},
{
title: 'My Stuff',
html : '<p>Something useful would be in here.</p>'
}
]
});
}
win.show();
return win;
}
});