01: package discRack.actions;
02:
03: import discRack.*;
04: import discRack.presentation.*;
05: import discRack.business.person.PersonFactory;
06:
07: import javax.swing.*;
08: import java.awt.event.ActionEvent;
09:
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 e) {
23: discRack.presentation.Login l = new discRack.presentation.Login();
24: DElementDialog loginD = new DElementDialog(discRack.getFrame(),
25: "DiscRack - Login");
26: loginD.editDElement(l.getPanel(), true);
27: if (!loginD.isCanceled()) {
28: discRack.business.person.Person p = null;
29: try {
30: p = PersonFactory.findPerson(l.get("Login").toString());
31: } catch (Exception ex) {
32: }
33: Discs dscs = new Discs(p);
34: discRack.setCentralPanel(dscs.getPanel());
35: discRack.getAction("Login").setEnabled(false);
36: discRack.getAction("Logout").setEnabled(true);
37: discRack.getAction("Register").setEnabled(false);
38: try {
39: discRack.setTitleUser(p.getFirstname() + " "
40: + p.getLastname());
41: } catch (Exception ex) {
42: }
43: }
44: }
45: }
|