extracted Method delete Tournament in TournamentDecorator.java

This commit is contained in:
schrom01 2022-05-01 13:46:20 +02:00
parent 61b943b091
commit 678060ecc0
2 changed files with 11 additions and 7 deletions

View File

@ -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() { public void informListener() {
for(IsObserver observer : listener) { for(IsObserver observer : listener) {

View File

@ -67,15 +67,10 @@ public class TournamentListController extends FXController {
@FXML @FXML
void deleteTournament(ActionEvent event) { 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()); AlertDelete alert = new AlertDelete(tournamentFile.toString());
if(alert.showAndGetResult()){ if(alert.showAndGetResult()){
try { getTournamentDecorator().deleteTournament(tournamentFile);
getFileIO().deleteTournament(tournamentFile);
loadContent();
} catch (IOException e) {
e.printStackTrace(); //TODO handle and logging
}
} }
} }