KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > discRack > actions > Login


1 package discRack.actions;
2
3 import discRack.*;
4 import discRack.presentation.*;
5 import discRack.business.person.PersonFactory;
6
7 import javax.swing.*;
8 import java.awt.event.ActionEvent JavaDoc;
9
10 /**
11  * Class that realizes <B>login</B> action.
12  *
13  * @author Sasa Bojanic
14  * @version 1.0
15  */

16 public class Login extends ActionBase {
17
18    public Login (DiscRack discRack) {
19       super(discRack);
20    }
21
22    public void actionPerformed(ActionEvent JavaDoc e) {
23       discRack.presentation.Login l=new discRack.presentation.Login();
24       DElementDialog loginD=new DElementDialog(discRack.getFrame(),"DiscRack - Login");
25       loginD.editDElement(l.getPanel(),true);
26       if (!loginD.isCanceled()) {
27          discRack.business.person.Person p=null;
28          try {
29             p=PersonFactory.findPerson(l.get("Login").toString());
30          } catch (Exception JavaDoc ex) {}
31          Discs dscs=new Discs(p);
32          discRack.setCentralPanel(dscs.getPanel());
33          discRack.getAction("Login").setEnabled(false);
34          discRack.getAction("Logout").setEnabled(true);
35          discRack.getAction("Register").setEnabled(false);
36          try {
37             discRack.setTitleUser(p.getFirstname()+" "+p.getLastname());
38          } catch (Exception JavaDoc ex) {}
39       }
40    }
41 }
42
Popular Tags