From db51f2f3cd5930fe5a3df966dc5af3a57603ad3b Mon Sep 17 00:00:00 2001 From: schrom01 Date: Wed, 11 May 2022 17:42:36 +0200 Subject: [PATCH] implemented functionality to drawLines --- .../turnierverwaltung/FactoryDecorator.java | 36 +++++++++++++++++++ .../gameScheduleView/GameSchedule.fxml | 2 +- 2 files changed, 37 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 0584c3c..1a93f8c 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/FactoryDecorator.java @@ -3,10 +3,12 @@ package ch.zhaw.projekt2.turnierverwaltung; import ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController; import ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameDecorator; import javafx.geometry.Pos; +import javafx.scene.Node; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; +import javafx.scene.shape.Line; import java.io.IOException; import java.util.ArrayList; @@ -114,10 +116,44 @@ public class FactoryDecorator implements IsObservable{ controller.loadContent(); } hBoxCenter.getChildren().add(vBox); + if(treeView){ + if(i+1 < gameList.size()) + hBoxCenter.getChildren().add(drawLines(vBox, gameBoxHeight, 30)); + } gameDecorators = newGameDecorators; } } + public VBox drawLines(VBox gameVBox, double gameBoxHeight, double lineLength){ + VBox completeLineVBox = new VBox(); + completeLineVBox.setAlignment(Pos.CENTER_LEFT); + double lineSpacing = gameVBox.getSpacing() + gameBoxHeight - 1; + completeLineVBox.setSpacing(lineSpacing); + for(int i = 0; i < gameVBox.getChildren().size(); i+=2){ + HBox lineBox = new HBox(); + lineBox.setAlignment(Pos.CENTER); + + //add Lines from left Game to center + VBox vBox = new VBox(); + vBox.setSpacing(lineSpacing); + vBox.getChildren().add(new Line(0,0,lineLength,0)); + vBox.getChildren().add(new Line(0,0,lineLength,0)); + lineBox.getChildren().add(vBox); + + + //add vertical line + lineBox.getChildren().add(new Line(0, 0, 0, lineSpacing)); + + //add line to right game + lineBox.getChildren().add(new Line(0, 0, lineLength, 0)); + + completeLineVBox.getChildren().add(lineBox); + + + } + return completeLineVBox; + } + public GameController openGameView(VBox vBox, GameDecorator gameDecorator) { return factory.loadGameView(vBox ,gameDecorator, this); } 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 65e74f4..f3f9207 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 @@ -34,7 +34,7 @@
- +