/* * 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 gui.Hauptfenster; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.ParseException; import java.util.logging.Level; import java.util.logging.Logger; import javax.sdp.SdpException; import javax.sip.InvalidArgumentException; import javax.sip.SipException; import logger.OhmLogger; import model.VoIP; /** * * @author Normal */ public class CommandController implements ActionListener { private static final Logger lc = OhmLogger.getLogger(); private VoIP model; private Hauptfenster view; public CommandController(VoIP model, Hauptfenster view) { this.model = model; this.view = view; } public void registerEvents() { view.getBtn1().addActionListener(this); view.getBtn2().addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { Object key = e.getSource(); if (key.equals(view.getBtn1())) { lc.info("Register Butten geklickt"); try { model.sendRegister("123123", 1); } catch (ParseException|InvalidArgumentException|SipException ex) { lc.getLogger(CommandController.class.getName()).log(Level.SEVERE, null, ex); } } if(key.equals(view.getBtn2())) { try { lc.info("Invite Button geklickt"); model.sendInvitation("23", 2); } catch (ParseException|InvalidArgumentException|SdpException|SipException ex) { lc.getLogger(CommandController.class.getName()).log(Level.SEVERE, null, ex); } } } }