KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > corbaclient > workflowadmin > user > actions > ChangeUserAccountSettings


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

21 public class ChangeUserAccountSettings extends ActionBase {
22
23    public ChangeUserAccountSettings (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       try {
36          UserAccountSettings uas=new UserAccountSettings();
37          uas.username=selectedUsername;
38          uas.firstname=(String JavaDoc)eup.getColumnValueOfSelectedRow(1);
39          uas.lastname=(String JavaDoc)eup.getColumnValueOfSelectedRow(2);
40          uas.email=(String JavaDoc)eup.getColumnValueOfSelectedRow(3);
41          UserAccount uad=null;
42          try {
43             uad=new UserAccount(workflowAdmin.getFrame(),
44                                 uas,UserAccount.CHANGE_SETTINGS);
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.updateUser(uas.username,uas.firstname,uas.lastname,uas.email);
53             eup.setColumnValueOfSelectedRow(1,uas.firstname);
54             eup.setColumnValueOfSelectedRow(2,uas.lastname);
55             eup.setColumnValueOfSelectedRow(3,uas.email);
56          } catch (Exception JavaDoc ex) {
57             JOptionPane.showMessageDialog(workflowAdmin,
58                                           ResourceManager.getLanguageDependentString("MessageCannotChangeUserSettings"),
59                                           ResourceManager.getLanguageDependentString("WorkflowAdminTitle"),
60                                           JOptionPane.ERROR_MESSAGE);
61          }
62       } catch (Exception JavaDoc ex) {}
63
64    }
65 }
66
Popular Tags