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 f6d29cb..f57df70 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java @@ -83,10 +83,14 @@ public class FactoryDecorator implements IsObservable{ List> gameList = tournamentDecorator.getTournament().getGameList(); List gameDecorators = new ArrayList<>(); + double gameBoxHeight = 0; + double spacingFactor = 0; for (int i = 0; i < gameList.size(); i++) { List newGameDecorators = new ArrayList<>(); VBox vBox = new VBox(); vBox.setAlignment(Pos.CENTER); + vBox.setSpacing(gameBoxHeight * spacingFactor); + 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); @@ -94,6 +98,8 @@ public class FactoryDecorator implements IsObservable{ if(i>0){ controller.addListener(gameDecorators.get(j*2)); controller.addListener(gameDecorators.get(j*2+1)); + } else if(gameBoxHeight == 0) { + gameBoxHeight = controller.getGameBoxHeigth(); } gameDecorator.addListener(new IsObserver() { @Override 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 671458c..0618db0 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 @@ -7,11 +7,15 @@ import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; public class GameController extends FXController{ private GameDecorator gameDecorator; + @FXML + private VBox mainVBox; + @FXML private Label participantNameOne; @@ -27,12 +31,15 @@ public class GameController extends FXController{ @FXML private TextField pointsTeamTwo; - @FXML void saveGamerResult(ActionEvent event) { gameDecorator.saveGame(pointsTeamOne.getText(), pointsTeamTwo.getText(), placesChoiceBox.getValue()); } + public double getGameBoxHeigth(){ + return mainVBox.getPrefHeight(); + } + @Override public void loadContent() { participantNameOne.setText(gameDecorator.getParticipantOne()); diff --git a/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/Game.fxml b/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/Game.fxml index be704e2..b740265 100644 --- a/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/Game.fxml +++ b/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/Game.fxml @@ -8,47 +8,51 @@ - + - diff --git a/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/GameSchedule.fxml b/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/GameSchedule.fxml index 8e77213..34f2257 100644 --- a/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/GameSchedule.fxml +++ b/app/src/main/resources/ch/zhaw/projekt2/turnierverwaltung/gameScheduleView/GameSchedule.fxml @@ -4,7 +4,7 @@ - + @@ -28,6 +28,10 @@
- + + + + +