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 f57df70..0584c3c 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java @@ -77,7 +77,7 @@ public class FactoryDecorator implements IsObservable{ informListener(); } - public void loadGameTree(HBox hBoxCenter, TournamentDecorator tournamentDecorator) { + public void loadGameList(HBox hBoxCenter, TournamentDecorator tournamentDecorator, boolean treeView) { hBoxCenter.getChildren().clear(); List> gameList = tournamentDecorator.getTournament().getGameList(); @@ -88,8 +88,12 @@ public class FactoryDecorator implements IsObservable{ for (int i = 0; i < gameList.size(); i++) { List newGameDecorators = new ArrayList<>(); VBox vBox = new VBox(); - vBox.setAlignment(Pos.CENTER); - vBox.setSpacing(gameBoxHeight * spacingFactor); + if(treeView){ + vBox.setAlignment(Pos.CENTER); + vBox.setSpacing(gameBoxHeight * spacingFactor); + } else { + vBox.setAlignment(Pos.TOP_CENTER); + } spacingFactor = spacingFactor * 2 + 1; for (int j = 0; j < gameList.get(i).size(); j++) { GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j)); diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameScheduleController.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameScheduleController.java index 675806b..4d4410c 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameScheduleController.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/gameScheduleView/GameScheduleController.java @@ -5,6 +5,7 @@ import ch.zhaw.projekt2.turnierverwaltung.Tournament; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; import javafx.scene.layout.HBox; public class GameScheduleController extends FXController { @@ -24,6 +25,9 @@ public class GameScheduleController extends FXController { @FXML private HBox hBoxCenter; + @FXML + private CheckBox treeView; + @FXML void createNewSchedule(ActionEvent event) { try { @@ -52,9 +56,14 @@ public class GameScheduleController extends FXController { getFactoryDecorator().openTournamentList(); } + @FXML + void changeView(ActionEvent event) { + loadContent(); + } + @Override public void loadContent() { - getFactoryDecorator().loadGameTree(hBoxCenter, getTournamentDecorator()); + getFactoryDecorator().loadGameList(hBoxCenter, getTournamentDecorator(), treeView.isSelected()); } } 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 ad1ac25..e335cc5 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 @@ -1,35 +1,43 @@ - - + - + - - - - - @@ -45,11 +53,6 @@ - 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 c9bd568..65e74f4 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 @@ -8,6 +8,7 @@ +