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<GameDecorator> gameDecorators = new ArrayList<>();
|
||||
double gameBoxHeight = 0;
|
||||
double spacingFactor = 0;
|
||||
for (int i = 0; i < gameList.size(); i++) {
|
||||
List<GameDecorator> 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
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -8,47 +8,51 @@
|
|||
<?import javafx.scene.layout.HBox?>
|
||||
<?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>
|
||||
<Label fx:id="participantNameOne" text="Participant One" />
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<VBox fx:id="mainVBox" alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
|
||||
<children>
|
||||
<Label text="Points">
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<TextField fx:id="pointsTeamOne" prefHeight="25.0" prefWidth="50.0" />
|
||||
<Label fx:id="participantNameOne" text="Participant One" />
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Points">
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<TextField fx:id="pointsTeamOne" prefHeight="25.0" prefWidth="50.0" />
|
||||
</children>
|
||||
</HBox>
|
||||
<Label fx:id="participantNameTwo" text="Participant Two" />
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Points">
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<TextField fx:id="pointsTeamTwo" prefHeight="25.0" prefWidth="50.0" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Ort">
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<ChoiceBox fx:id="placesChoiceBox" prefWidth="150.0" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets top="10.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<Button mnemonicParsing="false" onAction="#saveGamerResult" text="Speichern">
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
<Label fx:id="participantNameTwo" text="Participant Two" />
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Points">
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<TextField fx:id="pointsTeamTwo" prefHeight="25.0" prefWidth="50.0" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label text="Ort">
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<ChoiceBox fx:id="placesChoiceBox" prefWidth="150.0" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets top="10.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<Button mnemonicParsing="false" onAction="#saveGamerResult" text="Speichern">
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
</VBox>
|
||||
</children>
|
||||
</VBox>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<?import javafx.scene.control.*?>
|
||||
<?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>
|
||||
<HBox alignment="TOP_RIGHT" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
|
@ -28,6 +28,10 @@
|
|||
</HBox>
|
||||
</top>
|
||||
<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>
|
||||
</BorderPane>
|
||||
|
|
Loading…
Reference in New Issue