fixed spacing between games in GameSchedule
This commit is contained in:
parent
38d1708a25
commit
a44227b3f6
|
@ -83,10 +83,14 @@ public class FactoryDecorator implements IsObservable{
|
||||||
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
|
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
|
||||||
|
|
||||||
List<GameDecorator> gameDecorators = new ArrayList<>();
|
List<GameDecorator> gameDecorators = new ArrayList<>();
|
||||||
|
double gameBoxHeight = 0;
|
||||||
|
double spacingFactor = 0;
|
||||||
for (int i = 0; i < gameList.size(); i++) {
|
for (int i = 0; i < gameList.size(); i++) {
|
||||||
List<GameDecorator> newGameDecorators = new ArrayList<>();
|
List<GameDecorator> newGameDecorators = new ArrayList<>();
|
||||||
VBox vBox = new VBox();
|
VBox vBox = new VBox();
|
||||||
vBox.setAlignment(Pos.CENTER);
|
vBox.setAlignment(Pos.CENTER);
|
||||||
|
vBox.setSpacing(gameBoxHeight * spacingFactor);
|
||||||
|
spacingFactor = spacingFactor * 2 + 1;
|
||||||
for (int j = 0; j < gameList.get(i).size(); j++) {
|
for (int j = 0; j < gameList.get(i).size(); j++) {
|
||||||
GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j));
|
GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j));
|
||||||
newGameDecorators.add(gameDecorator);
|
newGameDecorators.add(gameDecorator);
|
||||||
|
@ -94,6 +98,8 @@ public class FactoryDecorator implements IsObservable{
|
||||||
if(i>0){
|
if(i>0){
|
||||||
controller.addListener(gameDecorators.get(j*2));
|
controller.addListener(gameDecorators.get(j*2));
|
||||||
controller.addListener(gameDecorators.get(j*2+1));
|
controller.addListener(gameDecorators.get(j*2+1));
|
||||||
|
} else if(gameBoxHeight == 0) {
|
||||||
|
gameBoxHeight = controller.getGameBoxHeigth();
|
||||||
}
|
}
|
||||||
gameDecorator.addListener(new IsObserver() {
|
gameDecorator.addListener(new IsObserver() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,11 +7,15 @@ import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
|
||||||
public class GameController extends FXController{
|
public class GameController extends FXController{
|
||||||
|
|
||||||
private GameDecorator gameDecorator;
|
private GameDecorator gameDecorator;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private VBox mainVBox;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label participantNameOne;
|
private Label participantNameOne;
|
||||||
|
|
||||||
|
@ -27,12 +31,15 @@ public class GameController extends FXController{
|
||||||
@FXML
|
@FXML
|
||||||
private TextField pointsTeamTwo;
|
private TextField pointsTeamTwo;
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void saveGamerResult(ActionEvent event) {
|
void saveGamerResult(ActionEvent event) {
|
||||||
gameDecorator.saveGame(pointsTeamOne.getText(), pointsTeamTwo.getText(), placesChoiceBox.getValue());
|
gameDecorator.saveGame(pointsTeamOne.getText(), pointsTeamTwo.getText(), placesChoiceBox.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getGameBoxHeigth(){
|
||||||
|
return mainVBox.getPrefHeight();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadContent() {
|
public void loadContent() {
|
||||||
participantNameOne.setText(gameDecorator.getParticipantOne());
|
participantNameOne.setText(gameDecorator.getParticipantOne());
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="200.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController">
|
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="200.0" style="-fx-border-color: black; -fx-border-insets: 2; -fx-border-width: 3;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController">
|
||||||
|
<children>
|
||||||
|
<VBox fx:id="mainVBox" alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="participantNameOne" text="Participant One" />
|
<Label fx:id="participantNameOne" text="Participant One" />
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
|
@ -51,4 +53,6 @@
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</Button>
|
</Button>
|
||||||
</children>
|
</children>
|
||||||
|
</VBox>
|
||||||
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameScheduleController">
|
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameScheduleController">
|
||||||
<top>
|
<top>
|
||||||
<HBox alignment="TOP_RIGHT" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
<HBox alignment="TOP_RIGHT" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
|
@ -28,6 +28,10 @@
|
||||||
</HBox>
|
</HBox>
|
||||||
</top>
|
</top>
|
||||||
<center>
|
<center>
|
||||||
<HBox fx:id="hBoxCenter" prefHeight="324.0" prefWidth="600.0" BorderPane.alignment="CENTER" />
|
<ScrollPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
|
<content>
|
||||||
|
<HBox fx:id="hBoxCenter" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="324.0" prefWidth="600.0" spacing="100.0" />
|
||||||
|
</content>
|
||||||
|
</ScrollPane>
|
||||||
</center>
|
</center>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
|
Loading…
Reference in New Issue