Tournament list #11

Merged
schrom01 merged 13 commits from TournamentList into main 2022-05-01 18:45:02 +02:00
2 changed files with 23 additions and 5 deletions
Showing only changes of commit 58b1692181 - Show all commits

View File

@ -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());

View File

@ -22,11 +22,15 @@
<Insets />
</VBox.margin>
</ListView>
<Button fx:id="openBtn" mnemonicParsing="false" onAction="#openTournament" text="Öffnen">
<VBox.margin>
<Insets bottom="20.0" top="40.0" />
</VBox.margin>
</Button>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0">
<VBox.margin>
<Insets bottom="20.0" top="40.0" />
</VBox.margin>
<children>
<Button fx:id="openBtn" mnemonicParsing="false" onAction="#openTournament" text="Öffnen" />
<Button fx:id="deleteBtn" layoutX="138.0" layoutY="28.0" mnemonicParsing="false" onAction="#deleteTournament" text="Löschen" />
</children>
</HBox>
</children>
<HBox.margin>
<Insets left="40.0" />