3 * (C) 2007 by Derrell Lipman
7 * LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/
11 * Swat authentication window class
13 qx.OO.defineClass("swat.main.Authenticate", qx.ui.window.Window,
19 qx.ui.window.Window.call(this);
21 var addCaptionedWidget = function(caption, dest, addWidget)
23 // Add a row to the destination grid
25 var row = dest.getRowCount() - 1;
26 dest.setRowHeight(row, 24);
29 var o = new qx.ui.basic.Label(caption);
37 // Give 'em the varying data label
42 // Set characteristics of this window
51 showStatusbar : false,
53 allowMaximize : false,
54 allowMinimize : false,
61 // Create a grid layout
62 var grid = new qx.ui.layout.GridLayout();
63 grid.setLocation(14, 14);
64 grid.setDimension("90%", "90%");
65 grid.setVerticalSpacing(14);
66 grid.setPadding(14, 14);
68 grid.setColumnCount(2);
69 grid.setColumnWidth(0, 100);
70 grid.setColumnWidth(1, 200);
73 // Add an input box for the user name
74 this.userName = addCaptionedWidget("User Name", grid,
77 return new qx.ui.form.TextField();
80 // Add an input box for the password
81 this.password = addCaptionedWidget("Password", grid,
84 return new qx.ui.form.PasswordField();
87 // Add an input box for the password
88 this.domain = addCaptionedWidget("Domain", grid,
91 // Create a combo box for for the domain
92 var combo = new qx.ui.form.ComboBox();
93 combo.setEditable(false);
98 this.login = addCaptionedWidget("", grid,
101 return new qx.ui.form.Button("Login");
104 // Save this login button since we receive events on it
105 fsm.addObject("login_button", this.login);
107 // We want to receive "execute" events on this button
108 this.login.addEventListener("execute", fsm.eventListener, fsm);
110 // Add the grid to the window
113 // Add this window to the document
114 this.addToDocument();
116 // Save this window object
117 fsm.addObject("login_window", this);
119 // We want to receive "complete" events on this button (which we generate)
120 this.addEventListener("complete", fsm.eventListener, fsm);
125 qx.Proto.setInfo = function(info)
129 // Remove everythingn from the domain list
130 this.domain.removeAll();
132 // Add the available domains
133 for (var i = 0; i < info.length; i++)
135 var item = new qx.ui.form.ListItem(info[i]);
136 this.domain.add(item);
142 * Singleton Instance Getter
144 qx.Class.getInstance = function(module)
146 if (! this._instance)
148 this._instance = new this(module);
151 return this._instance;