implemented functionality to activate treeview
This commit is contained in:
parent
b51a585167
commit
7f723fd763
|
@ -77,7 +77,7 @@ public class FactoryDecorator implements IsObservable{
|
||||||
informListener();
|
informListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadGameTree(HBox hBoxCenter, TournamentDecorator tournamentDecorator) {
|
public void loadGameList(HBox hBoxCenter, TournamentDecorator tournamentDecorator, boolean treeView) {
|
||||||
hBoxCenter.getChildren().clear();
|
hBoxCenter.getChildren().clear();
|
||||||
|
|
||||||
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
|
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
|
||||||
|
@ -88,8 +88,12 @@ public class FactoryDecorator implements IsObservable{
|
||||||
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);
|
if(treeView){
|
||||||
vBox.setSpacing(gameBoxHeight * spacingFactor);
|
vBox.setAlignment(Pos.CENTER);
|
||||||
|
vBox.setSpacing(gameBoxHeight * spacingFactor);
|
||||||
|
} else {
|
||||||
|
vBox.setAlignment(Pos.TOP_CENTER);
|
||||||
|
}
|
||||||
spacingFactor = spacingFactor * 2 + 1;
|
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));
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ch.zhaw.projekt2.turnierverwaltung.Tournament;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
|
|
||||||
public class GameScheduleController extends FXController {
|
public class GameScheduleController extends FXController {
|
||||||
|
@ -24,6 +25,9 @@ public class GameScheduleController extends FXController {
|
||||||
@FXML
|
@FXML
|
||||||
private HBox hBoxCenter;
|
private HBox hBoxCenter;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private CheckBox treeView;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void createNewSchedule(ActionEvent event) {
|
void createNewSchedule(ActionEvent event) {
|
||||||
try {
|
try {
|
||||||
|
@ -52,9 +56,14 @@ public class GameScheduleController extends FXController {
|
||||||
getFactoryDecorator().openTournamentList();
|
getFactoryDecorator().openTournamentList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void changeView(ActionEvent event) {
|
||||||
|
loadContent();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadContent() {
|
public void loadContent() {
|
||||||
getFactoryDecorator().loadGameTree(hBoxCenter, getTournamentDecorator());
|
getFactoryDecorator().loadGameList(hBoxCenter, getTournamentDecorator(), treeView.isSelected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,43 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ChoiceBox?>
|
<?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.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="150.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">
|
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="450.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>
|
<children>
|
||||||
<VBox fx:id="mainVBox" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="150.0">
|
<VBox fx:id="mainVBox" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="90.0">
|
||||||
<children>
|
<children>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="participantNameOne" text="Participant One">
|
<Label fx:id="participantNameOne" style="-fx-font-weight: bold;" text="Participant One">
|
||||||
<HBox.margin>
|
<HBox.margin>
|
||||||
<Insets right="20.0" />
|
<Insets right="20.0" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<TextField fx:id="pointsTeamOne" prefHeight="25.0" prefWidth="50.0" />
|
<TextField fx:id="pointsTeamOne" alignment="CENTER" onKeyTyped="#saveGameResult" prefHeight="25.0" prefWidth="50.0">
|
||||||
</children>
|
<HBox.margin>
|
||||||
</HBox>
|
<Insets right="20.0" />
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
</HBox.margin>
|
||||||
<children>
|
</TextField>
|
||||||
<Label fx:id="participantNameTwo" text="Participant Two">
|
<Label text=":">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="20.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Label>
|
||||||
|
<TextField fx:id="pointsTeamTwo" alignment="CENTER" onKeyTyped="#saveGameResult" prefHeight="25.0" prefWidth="50.0">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="20.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</TextField>
|
||||||
|
<Label fx:id="participantNameTwo" style="-fx-font-weight: bold;" text="Participant Two">
|
||||||
<HBox.margin>
|
<HBox.margin>
|
||||||
<Insets right="20.0" />
|
<Insets right="20.0" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<TextField fx:id="pointsTeamTwo" prefHeight="25.0" prefWidth="50.0" />
|
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
|
@ -45,11 +53,6 @@
|
||||||
<Insets top="10.0" />
|
<Insets top="10.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</HBox>
|
</HBox>
|
||||||
<Button mnemonicParsing="false" onAction="#saveGamerResult" text="Speichern">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets bottom="10.0" top="10.0" />
|
|
||||||
</VBox.margin>
|
|
||||||
</Button>
|
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<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>
|
||||||
|
<CheckBox fx:id="treeView" mnemonicParsing="false" onAction="#changeView" selected="true" text="Baumansicht" />
|
||||||
<Button fx:id="createScheduleBtn" mnemonicParsing="false" onAction="#createNewSchedule" text="Create New Game Schedule">
|
<Button fx:id="createScheduleBtn" mnemonicParsing="false" onAction="#createNewSchedule" text="Create New Game Schedule">
|
||||||
<HBox.margin>
|
<HBox.margin>
|
||||||
<Insets right="20.0" />
|
<Insets right="20.0" />
|
||||||
|
|
Loading…
Reference in New Issue