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 ; 9 10 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(),"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 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 ex) {} 39 } 40 } 41 } 42 | Popular Tags |