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
|
/*
* Copyright:
* (C) 2007 by Derrell Lipman
* All rights reserved
*
* License:
* LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/
*/
/**
* Swat authentication window class
*/
qx.OO.defineClass("swat.main.Authenticate", qx.ui.window.Window,
function(module)
{
var o;
var fsm = module.fsm;
qx.ui.window.Window.call(this);
var addCaptionedWidget = function(caption, dest, addWidget)
{
// Add a row to the destination grid
dest.addRow();
var row = dest.getRowCount() - 1;
dest.setRowHeight(row, 24);
// Add the caption
var o = new qx.ui.basic.Label(caption);
dest.add(o, 0, row);
// Add the widget
o = addWidget();
o.setHeight(24);
dest.add(o, 1, row);
// Give 'em the varying data label
return o;
};
// Set characteristics of this window
this.set({
width : 380,
height : 200,
modal : true,
centered : true,
showClose : false,
showMaximize : false,
showMinimize : false,
showStatusbar : false,
allowClose : false,
allowMaximize : false,
allowMinimize : false,
resizeable : false,
moveable : false,
zIndex : 10000
});
// Create a grid layout
var grid = new qx.ui.layout.GridLayout();
grid.setLocation(14, 14);
grid.setDimension("90%", "90%");
grid.setVerticalSpacing(14);
grid.setPadding(14, 14);
grid.setRowCount(0);
grid.setColumnCount(2);
grid.setColumnWidth(0, 100);
grid.setColumnWidth(1, 200);
// Add an input box for the user name
this.userName = addCaptionedWidget("User Name", grid,
function()
{
return new qx.ui.form.TextField();
});
// Add an input box for the password
this.password = addCaptionedWidget("Password", grid,
function()
{
return new qx.ui.form.PasswordField();
});
// Add an input box for the password
this.domain = addCaptionedWidget("Domain", grid,
function()
{
// Create a combo box for for the domain
var combo = new qx.ui.form.ComboBox();
combo.setEditable(false);
return combo;
});
// Add a login button
this.login = addCaptionedWidget("", grid,
function()
{
return new qx.ui.form.Button("Login");
});
// Save this login button since we receive events on it
fsm.addObject("login_button", this.login);
// We want to receive "execute" events on this button
this.login.addEventListener("execute", fsm.eventListener, fsm);
// Add the grid to the window
this.add(grid);
// Add this window to the document
this.addToDocument();
// Save this window object
fsm.addObject("login_window", this);
// We want to receive "complete" events on this button (which we generate)
this.addEventListener("complete", fsm.eventListener, fsm);
});
qx.Proto.setInfo = function(info)
{
this.debug(info);
// Remove everythingn from the domain list
this.domain.removeAll();
// Add the available domains
for (var i = 0; i < info.length; i++)
{
var item = new qx.ui.form.ListItem(info[i]);
this.domain.add(item);
}
};
/**
* Singleton Instance Getter
*/
qx.Class.getInstance = function(module)
{
if (! this._instance)
{
this._instance = new this(module);
}
return this._instance;
};
|