From 89e72a15927d09786893fa6be8a4313dc82ea234 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Sat, 7 May 2022 15:45:43 +0200 Subject: [PATCH] solved Problem "points and places of games are not saved in file." --- .../zhaw/projekt2/turnierverwaltung/FactoryDecorator.java | 6 ++++++ .../main/gameScheduleView/GameController.java | 2 ++ .../main/gameScheduleView/GameDecorator.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java index 739f7ff..81672e7 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java @@ -93,6 +93,12 @@ public class FactoryDecorator implements IsObservable{ controller.addListener(gameDecorators.get(j*2)); controller.addListener(gameDecorators.get(j*2+1)); } + gameDecorator.addListener(new IsObserver() { + @Override + public void update() { + tournamentDecorator.saveTournament(); + } + }); controller.loadContent(); } hBoxCenter.getChildren().add(vBox); diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameController.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameController.java index e1fe378..671458c 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameController.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameController.java @@ -39,6 +39,8 @@ public class GameController extends FXController{ participantNameTwo.setText(gameDecorator.getParticipantTwo()); pointsTeamOne.setText(String.valueOf(gameDecorator.getPoints1())); pointsTeamTwo.setText(String.valueOf(gameDecorator.getPoints2())); + placesChoiceBox.setItems(getTournamentDecorator().getTournament().getPlaces()); + placesChoiceBox.setValue(gameDecorator.getPlace()); } public void refreshParticipants(){ diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameDecorator.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameDecorator.java index 0b339b4..31322e4 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameDecorator.java @@ -57,7 +57,7 @@ public class GameDecorator implements IsObservable{ game.refreshParticipants(); } - public Place getLocation() { + public Place getPlace() { return game.getPlace(); }