01: package jtaDiscRack.actions;
02:
03: import jtaDiscRack.*;
04: import jtaDiscRack.presentation.*;
05: import jtaDiscRack.business.person.PersonFactory;
06:
07: import java.awt.event.ActionEvent;
08:
09: /**
10: * Class that realizes <B>login</B> action.
11: *
12: * @author Sasa Bojanic
13: * @version 1.0
14: */
15: public class Login extends ActionBase {
16:
17: public Login(JtaDiscRack jtaDiscRack) {
18: super (jtaDiscRack);
19: }
20:
21: public void actionPerformed(ActionEvent e) {
22: jtaDiscRack.presentation.Login l = new jtaDiscRack.presentation.Login();
23: DElementDialog loginD = new DElementDialog(jtaDiscRack
24: .getFrame(), "JtaDiscRack - Login");
25: loginD.editDElement(l.getPanel(), true);
26: if (!loginD.isCanceled()) {
27: jtaDiscRack.business.person.Person p = null;
28: try {
29: p = PersonFactory.findPerson(l.get("Login").toString());
30: } catch (Exception ex) {
31: }
32: Discs dscs = new Discs(p);
33: jtaDiscRack.setCentralPanel(dscs.getPanel());
34: jtaDiscRack.getAction("Login").setEnabled(false);
35: jtaDiscRack.getAction("Logout").setEnabled(true);
36: jtaDiscRack.getAction("Register").setEnabled(false);
37: try {
38: jtaDiscRack.setTitleUser(p.getFirstname() + " "
39: + p.getLastname());
40: } catch (Exception ex) {
41: }
42: }
43: }
44: }
|