private int dof1(KeyEvent evt) { final ClientTask task = new TaskSelectFieldDescription(fieldName, projectId); task.setCallback( new Runnable() { public void run() { try { String description = (String) task.getResult(); String desc = ""; String fieldDescription = ""; StringTokenizer Tok = new StringTokenizer(description); while (Tok.hasMoreTokens()) { desc = desc + " " + Tok.nextToken(); if (desc.length() >= 45) { fieldDescription = fieldDescription + "\n" + desc; desc = ""; } } fieldDescription = fieldDescription + "\n" + desc; String dialogm = "HELP TEXT FOR " + fieldName; Component parent = task.getParent(); JOptionPane.showMessageDialog( parent, fieldDescription, dialogm, JOptionPane.INFORMATION_MESSAGE); } catch (Throwable th) { Log.quit(th); } } }); task.enqueue(); return 0; }
/** * Check password filled if it is true then save the user data * * @return true if the data is saved successfully, false if password is entered and it does not * match. */ private boolean save() { char[] pchars = password.getPassword(); String pword = ""; if (pchars.length > 0) { pword = MD5.computeDigest(pchars); Arrays.fill(pchars, '\u0000'); char[] cchars = confirmPassword.getPassword(); String cword = MD5.computeDigest(cchars); Arrays.fill(cchars, '\u0000'); if (!pword.equals(cword)) { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog( this, "Password must match Confirm Password." + "\nPlease re-enter.", "Password Error", JOptionPane.ERROR_MESSAGE); return false; } } final ClientTask task; int teamsId = teamsModel.getSelectedId(); if (teamsId < 0) { teamsId = 0; } usersData = new UsersData(); usersData.users_id = usersId; usersData.teams_id = teamsId; usersData.user_name = userName.getText(); usersData.first_name = fname.getText(); usersData.last_name = lname.getText(); usersData.unitize = unitizeCheckBox.isSelected() ? "Yes" : "No"; usersData.uqc = uqcCheckBox.isSelected() ? "Yes" : "No"; usersData.coding = codingCheckBox.isSelected() ? "Yes" : "No"; usersData.codingqc = codingqcCheckBox.isSelected() ? "Yes" : "No"; usersData.qa = qaCheckBox.isSelected() ? "Yes" : "No"; usersData.listing = listingCheckBox.isSelected() ? "Yes" : "No"; usersData.tally = tallyCheckBox.isSelected() ? "Yes" : "No"; usersData.teamLeader = tlCheckBox.isSelected() ? "Yes" : "No"; usersData.admin = adminCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminUsers = adminUsersCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminProject = adminProjectCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminBatch = adminBatchCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminEdit = adminEditCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminImport = adminImportCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminExport = adminExportCheckBox.isSelected() ? "Yes" : "No"; usersData.canAdminProfit = adminProfitCheckBox.isSelected() ? "Yes" : "No"; usersData.password = pword; usersData.dateOfJoin = field.getText(); task = new TaskSendUsersData(usersData); task.enqueue(this); return true; }
public void closeSession(java.awt.event.WindowEvent evt) { try { // close the server and image server connections gently // TBD: really should be in a client task try { // client.Global.theServerConnection.shutdown(); final ClientTask task; task = new TaskGoodbye(); task.enqueue(this); } catch (Exception e) { } // try { // client.Global.theImageConnection.shutdown(); // } catch (Exception e) { // } System.exit(0); } catch (Throwable th) { Log.quit(th); } }
/** Get the user record */ private void getUserData() { teamsModel = new QueryComboModel("get teams names"); teamsCombo = new LComboBox(40); teamsCombo.setModel(teamsModel); if (usersId > 0) { final ClientTask task; // Log.print("(AddEditUsers.getUserData) " + usersId); task = new TaskExecuteQuery("users by id select", Integer.toString(usersId)); task.setCallback( new Runnable() { public void run() { getUserByIdDataEntry((ResultSet) task.getResult()); // set OK disabled again // (It was enabled by getUserByDataEntry when combo selection set.) okButton.setEnabled(false); } }); boolean ok = task.enqueue(this); } addControls(); }