diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/TournamentDecorator.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/TournamentDecorator.java index 0177d05..a848a4a 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/TournamentDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/TournamentDecorator.java @@ -50,6 +50,15 @@ public class TournamentDecorator implements IsObservable{ } } + public void deleteTournament(FileIO.TournamentFile tournamentFile){ + try { + fileIO.deleteTournament(tournamentFile); + informListener(); + } catch (IOException e) { + e.printStackTrace(); //TODO handle and logging + } + } + public void informListener() { for(IsObserver observer : listener) { diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/tournamentList/TournamentListController.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/tournamentList/TournamentListController.java index fcb26c0..bcc1109 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/tournamentList/TournamentListController.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/tournamentList/TournamentListController.java @@ -67,15 +67,10 @@ public class TournamentListController extends FXController { @FXML void deleteTournament(ActionEvent event) { - File tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0); + FileIO.TournamentFile tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0); AlertDelete alert = new AlertDelete(tournamentFile.toString()); if(alert.showAndGetResult()){ - try { - getFileIO().deleteTournament(tournamentFile); - loadContent(); - } catch (IOException e) { - e.printStackTrace(); //TODO handle and logging - } + getTournamentDecorator().deleteTournament(tournamentFile); } }