implemented functionality to drawLines
This commit is contained in:
		
							parent
							
								
									7f723fd763
								
							
						
					
					
						commit
						db51f2f3cd
					
				| 
						 | 
					@ -3,10 +3,12 @@ package ch.zhaw.projekt2.turnierverwaltung;
 | 
				
			||||||
import ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController;
 | 
					import ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController;
 | 
				
			||||||
import ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameDecorator;
 | 
					import ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameDecorator;
 | 
				
			||||||
import javafx.geometry.Pos;
 | 
					import javafx.geometry.Pos;
 | 
				
			||||||
 | 
					import javafx.scene.Node;
 | 
				
			||||||
import javafx.scene.layout.BorderPane;
 | 
					import javafx.scene.layout.BorderPane;
 | 
				
			||||||
import javafx.scene.layout.HBox;
 | 
					import javafx.scene.layout.HBox;
 | 
				
			||||||
import javafx.scene.layout.Pane;
 | 
					import javafx.scene.layout.Pane;
 | 
				
			||||||
import javafx.scene.layout.VBox;
 | 
					import javafx.scene.layout.VBox;
 | 
				
			||||||
 | 
					import javafx.scene.shape.Line;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
| 
						 | 
					@ -114,10 +116,44 @@ public class FactoryDecorator implements IsObservable{
 | 
				
			||||||
                controller.loadContent();
 | 
					                controller.loadContent();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            hBoxCenter.getChildren().add(vBox);
 | 
					            hBoxCenter.getChildren().add(vBox);
 | 
				
			||||||
 | 
					            if(treeView){
 | 
				
			||||||
 | 
					                if(i+1 < gameList.size())
 | 
				
			||||||
 | 
					                hBoxCenter.getChildren().add(drawLines(vBox, gameBoxHeight, 30));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            gameDecorators = newGameDecorators;
 | 
					            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) {
 | 
					    public GameController openGameView(VBox vBox, GameDecorator gameDecorator) {
 | 
				
			||||||
        return factory.loadGameView(vBox ,gameDecorator, this);
 | 
					        return factory.loadGameView(vBox ,gameDecorator, this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@
 | 
				
			||||||
   <center>
 | 
					   <center>
 | 
				
			||||||
      <ScrollPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
 | 
					      <ScrollPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
 | 
				
			||||||
         <content>
 | 
					         <content>
 | 
				
			||||||
            <HBox fx:id="hBoxCenter" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="324.0" prefWidth="600.0" spacing="100.0" />
 | 
					            <HBox fx:id="hBoxCenter" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="324.0" prefWidth="600.0" />
 | 
				
			||||||
         </content>
 | 
					         </content>
 | 
				
			||||||
      </ScrollPane>
 | 
					      </ScrollPane>
 | 
				
			||||||
   </center>
 | 
					   </center>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue