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.

CommandNewKontaktOk.java 926B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 kontakte.controller;
  7. import kontakte.model.Kontakt;
  8. import kontakte.model.Model;
  9. import kontakte.view.View;
  10. /**
  11. *
  12. * @author nobody
  13. */
  14. public class CommandNewKontaktOk implements CommandInterface
  15. {
  16. private View view;
  17. private Model model;
  18. public CommandNewKontaktOk(View view, Model model)
  19. {
  20. this.view = view;
  21. this.model = model;
  22. }
  23. @Override
  24. public void execute()
  25. {
  26. String name = view.getTextName().getText();
  27. String wohnort = view.getTextCity().getText();
  28. String strasse = view.getTextStreet().getText();
  29. Kontakt neuKon = new Kontakt(name, wohnort, strasse);
  30. model.addKontakt(neuKon);
  31. view.getAddEntryFrame().setVisible(false);
  32. }
  33. @Override
  34. public void undo()
  35. {
  36. }
  37. }