1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /*
- * 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 controller;
-
- import adressverwaltung.model.AdressverwaltungModel;
- import controller.commands.CommandOpen;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import prfourgui.View.AdressbuchView;
-
- /**
- *
- * @author jechowma68968
- */
- public class Controller implements ActionListener
- {
- private AdressbuchView view;
- private AdressverwaltungModel model;
- private Invoker invoker;
- public Controller(AdressbuchView view, AdressverwaltungModel model)
- {
- this.view = view;
- this.model = model;
- this.invoker = new Invoker();
- }
- /**
- * Hinterlegen aller Objekte in View die Interaktion ausüben
- */
- public void registerEvents(){
- view.getMnuOpen().addActionListener(this);
- }
-
- public void registerCommands(){
- invoker.addCommand(view.getMnuOpen(), new CommandOpen(view, model));
- }
-
- @Override
- public void actionPerformed(ActionEvent ae)
- {
- Object key = ae.getSource();
- invoker.executeCommand(key);
- }
- }
|