KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > workflowadmin > user > actions > ChangeUserAccountPassword


1 package org.enhydra.shark.swingclient.workflowadmin.user.actions;
2
3 import java.awt.event.*;
4 import java.util.*;
5
6
7
8 import org.enhydra.shark.api.client.wfservice.*;
9 import org.enhydra.shark.swingclient.*;
10 import org.enhydra.shark.swingclient.workflowadmin.*;
11 import org.enhydra.shark.swingclient.workflowadmin.user.*;
12
13 import javax.swing.JOptionPane JavaDoc;
14
15 /**
16  * Changes the user account password.
17  *
18  * @author Sasa Bojanic
19  * @version 1.0
20  */

21 public class ChangeUserAccountPassword extends ActionBase {
22
23    public ChangeUserAccountPassword (UserAccountManagement uam) {
24       super(uam);
25    }
26
27    public void actionPerformed(ActionEvent e) {
28       UserGroupAdministration uga=SharkAdmin.getUserGroupAmin();
29       UserAccountManagement uam=(UserAccountManagement)actionPanel;
30       SharkAdmin workflowAdmin=uam.getWorkflowAdmin();
31       TablePanel eup=uam.getExistingUsersPanel();
32
33       String JavaDoc selectedUsername=(String JavaDoc)eup.getColumnValueOfSelectedRow(0);
34
35       UserAccountSettings uas=new UserAccountSettings();
36       uas.username=selectedUsername;
37       uas.firstname=(String JavaDoc)eup.getColumnValueOfSelectedRow(1);
38       uas.lastname=(String JavaDoc)eup.getColumnValueOfSelectedRow(2);
39       uas.email=(String JavaDoc)eup.getColumnValueOfSelectedRow(3);
40
41       UserAccount uad=null;
42       try {
43          uad=new UserAccount(workflowAdmin.getFrame(),
44                              uas,UserAccount.CHANGE_PASSWORD);
45          uad.showDialog();
46       } catch (Exception JavaDoc ex) {
47          System.out.println("Cannot create dialog of given type");
48          return;
49       }
50       if (uas.username==null) return;
51       try {
52          uga.setPassword(uas.username,uas.password);
53       } catch (Exception JavaDoc ex) {
54          JOptionPane.showMessageDialog(workflowAdmin,
55                                        ResourceManager.getLanguageDependentString("MessageCannotChangeUserSettings"),
56                                        ResourceManager.getLanguageDependentString("WorkflowAdminTitle"),
57                                        JOptionPane.ERROR_MESSAGE);
58
59       }
60    }
61 }
62
Popular Tags