You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UndoController.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package gui_adressverwaltung.Controller;
  7. import gui_adressverwaltung.model.AdressverwaltungModel;
  8. import gui_adressverwaltung.view.Hauptfenster;
  9. import java.awt.event.ActionEvent;
  10. import java.awt.event.ActionListener;
  11. import java.util.logging.Level;
  12. import java.util.logging.Logger;
  13. /**
  14. *
  15. * @author nobody
  16. */
  17. public class UndoController implements ActionListener
  18. {
  19. private Hauptfenster view;
  20. private AdressverwaltungModel model;
  21. private CommandInvoker invoker;
  22. public UndoController(Hauptfenster view, AdressverwaltungModel model, CommandInvoker invoker)
  23. {
  24. this.view = view;
  25. this.model = model;
  26. this.invoker = invoker;
  27. }
  28. public void registerEvents()
  29. {
  30. view.getMndUndo().addActionListener(this);
  31. view.getBtnUndo().addActionListener(this);
  32. }
  33. @Override
  34. public void actionPerformed(ActionEvent e)
  35. {
  36. try{
  37. view.getLblStatus().setText("Undo Trigger");
  38. invoker.undoCommand();
  39. }
  40. catch(Exception ex){
  41. view.getLblStatus().setText("Fehler");
  42. Logger.getLogger(AdressenSpeichern.class.getName()).log(Level.SEVERE, null, ex);
  43. }
  44. }
  45. }