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.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. model.sendRegister(view.getTxtServerIP().getText(), 5078);
  37. }
  38. catch (ParseException|InvalidArgumentException|SipException ex)
  39. {
  40. view.getTxtArea().append("Registrierung fehlgeschlagen");
  41. lgregister.getLogger(CommandRegister.class.getName()).log(Level.SEVERE, null, ex);
  42. }
  43. }
  44. @Override
  45. public void undo()
  46. {
  47. }
  48. @Override
  49. public Boolean isundoable()
  50. {
  51. return false;
  52. }
  53. }