/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package gui_adressverwaltung.Controller; import gui_adressverwaltung.model.AdressverwaltungModel; import gui_adressverwaltung.view.Hauptfenster; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author nobody */ public class UndoController implements ActionListener { private Hauptfenster view; private AdressverwaltungModel model; private CommandInvoker invoker; public UndoController(Hauptfenster view, AdressverwaltungModel model, CommandInvoker invoker) { this.view = view; this.model = model; this.invoker = invoker; } public void registerEvents() { view.getMndUndo().addActionListener(this); view.getBtnUndo().addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { try{ view.getLblStatus().setText("Undo Trigger"); invoker.undoCommand(); } catch(Exception ex){ view.getLblStatus().setText("Fehler"); Logger.getLogger(AdressenSpeichern.class.getName()).log(Level.SEVERE, null, ex); } } }