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 1a93f8c..a03d878 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java @@ -84,11 +84,11 @@ public class FactoryDecorator implements IsObservable{ List> gameList = tournamentDecorator.getTournament().getGameList(); - List gameDecorators = new ArrayList<>(); + List gameDecoratorsList = new ArrayList<>(); double gameBoxHeight = 0; double spacingFactor = 0; for (int i = 0; i < gameList.size(); i++) { - List newGameDecorators = new ArrayList<>(); + List newGameDecoratorsList = new ArrayList<>(); VBox vBox = new VBox(); if(treeView){ vBox.setAlignment(Pos.CENTER); @@ -99,13 +99,13 @@ public class FactoryDecorator implements IsObservable{ spacingFactor = spacingFactor * 2 + 1; for (int j = 0; j < gameList.get(i).size(); j++) { GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j)); - newGameDecorators.add(gameDecorator); - GameController controller = openGameView(vBox,gameDecorator); + newGameDecoratorsList.add(gameDecorator); + GameController gameController = openGameView(vBox,gameDecorator); if(i>0){ - controller.addListener(gameDecorators.get(j*2)); - controller.addListener(gameDecorators.get(j*2+1)); + gameController.addListener(gameDecoratorsList.get(j*2)); + gameController.addListener(gameDecoratorsList.get(j*2+1)); } else if(gameBoxHeight == 0) { - gameBoxHeight = controller.getGameBoxHeigth(); + gameBoxHeight = gameController.getGameBoxHeigth(); } gameDecorator.addListener(new IsObserver() { @Override @@ -113,14 +113,14 @@ public class FactoryDecorator implements IsObservable{ tournamentDecorator.saveTournament(); } }); - controller.loadContent(); + gameController.loadContent(); } hBoxCenter.getChildren().add(vBox); if(treeView){ if(i+1 < gameList.size()) hBoxCenter.getChildren().add(drawLines(vBox, gameBoxHeight, 30)); } - gameDecorators = newGameDecorators; + gameDecoratorsList = newGameDecoratorsList; } } 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 6a87104..6be0905 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 @@ -27,9 +27,13 @@ public class GameDecorator implements IsObservable{ public void saveGameResult(String points1, String points2){ if(points1.length() > 0){ game.setPoints1(Integer.parseInt(points1)); + } else { + game.setPoints1(0); } if(points2.length() > 0) { game.setPoints2(Integer.parseInt(points2)); + } else { + game.setPoints2(0); } informListener(); }