Tournament list #11
|
@ -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) {
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue