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.

CommandRegister.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.commands;
  7. import controller.CommandInterface;
  8. import gui.Hauptfenster;
  9. import java.text.ParseException;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12. import javax.sip.InvalidArgumentException;
  13. import javax.sip.SipException;
  14. import logger.OhmLogger;
  15. import model.VoIP;
  16. /**
  17. *
  18. * @author Normal
  19. */
  20. public class CommandRegister implements CommandInterface
  21. {
  22. private static final Logger lgregister = OhmLogger.getLogger();
  23. private VoIP model;
  24. private Hauptfenster view;
  25. public CommandRegister(VoIP model, Hauptfenster view)
  26. {
  27. this.model = model;
  28. this.view = view;
  29. }
  30. @Override
  31. public void execute()
  32. {
  33. try
  34. {
  35. view.getTxtArea().append("Registrierung an " + view.getTxtServerIP().getText() + " gesendet\n");
  36. System.out.println("Test: "+ view.getTxtServerIP().getText());
  37. model.sendRegister(view.getTxtServerIP().getText(), 5078);
  38. }
  39. catch (ParseException|InvalidArgumentException|SipException ex)
  40. {
  41. view.getTxtArea().append("Registrierung fehlgeschlagen\n");
  42. lgregister.getLogger(CommandRegister.class.getName()).log(Level.SEVERE, null, ex);
  43. }
  44. }
  45. @Override
  46. public void undo()
  47. {
  48. }
  49. @Override
  50. public Boolean isundoable()
  51. {
  52. return false;
  53. }
  54. }