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 @FXML
private Button openBtn; private Button openBtn;
@FXML
private Button deleteBtn;
@FXML @FXML
private Label tournamentListTitle; private Label tournamentListTitle;
@ -82,6 +85,17 @@ public class TournamentListController extends FXController {
} //TODO handle and logging } //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 @Override
public void loadContent() { public void loadContent() {
tournamentListView.setItems(getFileIO().getList()); tournamentListView.setItems(getFileIO().getList());

View File

@ -22,11 +22,15 @@
<Insets /> <Insets />
</VBox.margin> </VBox.margin>
</ListView> </ListView>
<Button fx:id="openBtn" mnemonicParsing="false" onAction="#openTournament" text="Öffnen"> <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0">
<VBox.margin> <VBox.margin>
<Insets bottom="20.0" top="40.0" /> <Insets bottom="20.0" top="40.0" />
</VBox.margin> </VBox.margin>
</Button> <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> </children>
<HBox.margin> <HBox.margin>
<Insets left="40.0" /> <Insets left="40.0" />