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 @@ - + + + + + +