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.

CommandController.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 controller;
  7. import controller.commands.CommandInvite;
  8. import controller.commands.CommandRegister;
  9. import gui.Hauptfenster;
  10. import java.awt.event.ActionEvent;
  11. import java.awt.event.ActionListener;
  12. import java.util.logging.Logger;
  13. import logger.OhmLogger;
  14. import model.VoIP;
  15. /**
  16. *
  17. * @author Normal
  18. */
  19. public class CommandController implements ActionListener
  20. {
  21. private static final Logger lc = OhmLogger.getLogger();
  22. private VoIP model;
  23. private Hauptfenster view;
  24. private CommandInvoker invoker;
  25. public CommandController(VoIP model, Hauptfenster view)
  26. {
  27. this.model = model;
  28. this.view = view;
  29. invoker = new CommandInvoker();
  30. }
  31. public void registerEvents()
  32. {
  33. view.getBtn1().addActionListener(this);
  34. view.getBtn2().addActionListener(this);
  35. }
  36. public void registerCommands()
  37. {
  38. //invoker.addCommand(view.getMnuioeffnen(), new CommandOpen(view, model));
  39. invoker.addCommand(view.getBtn1(), new CommandRegister(model, view));
  40. invoker.addCommand(view.getBtn2(), new CommandInvite(model, view));
  41. }
  42. @Override
  43. public void actionPerformed(ActionEvent e)
  44. {
  45. Object key = e.getSource();
  46. invoker.executeCommand(key);
  47. }
  48. }