From 58b16921818e1f8ff0b739f0358d95dbf00a1b7b Mon Sep 17 00:00:00 2001 From: schrom01 Date: Sun, 1 May 2022 11:27:54 +0200 Subject: [PATCH] implemented Button and Method deleteTournament in Tournament List --- .../tournamentList/TournamentListController.java | 14 ++++++++++++++ .../tournamentList/tournamentList.fxml | 14 +++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) 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 f06fe19..bf8b2c5 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 @@ -36,6 +36,9 @@ public class TournamentListController extends FXController { @FXML private Button openBtn; + @FXML + private Button deleteBtn; + @FXML private Label tournamentListTitle; @@ -82,6 +85,17 @@ public class TournamentListController extends FXController { } //TODO handle and logging } + @FXML + void deleteTournament(ActionEvent event) { + //TODO Ask first to delete? + File tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0); + try { + getFileIO().deleteTournament(tournamentFile); + } catch (IOException e) { + e.printStackTrace(); //TODO handle and logging + } + } + @Override public void loadContent() { tournamentListView.setItems(getFileIO().getList()); diff --git a/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/tournamentList/tournamentList.fxml b/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/tournamentList/tournamentList.fxml index 3648fdf..24c2e89 100644 --- a/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/tournamentList/tournamentList.fxml +++ b/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/tournamentList/tournamentList.fxml @@ -22,11 +22,15 @@ - + + + + + +