Compare commits

..
6 changed files with 52 additions and 32 deletions
@@ -252,7 +252,7 @@ public class Tournament implements Serializable {
* (In the Prototype only the KO-System has full functionality * (In the Prototype only the KO-System has full functionality
*/ */
public enum Type { public enum Type {
KO("KO-System"); //GROUPS("Gruppenspiele"); //Type GROUPS is not implemented in this prototype. KO("KO-System"), GROUPS("Gruppenspiele");
private String name; private String name;
@@ -32,8 +32,6 @@ public class MainWindow extends Application {
Scene scene = new Scene(pane); Scene scene = new Scene(pane);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.setMinHeight(600);
primaryStage.setMinWidth(800);
primaryStage.setMaximized(true); primaryStage.setMaximized(true);
primaryStage.setResizable(true); primaryStage.setResizable(true);
primaryStage.setFullScreen(false); primaryStage.setFullScreen(false);
@@ -0,0 +1,26 @@
package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
public class AlertNewSchedule extends Alert {
private ButtonType yesButton = new ButtonType("Ja", ButtonBar.ButtonData.YES);
private ButtonType noButton = new ButtonType("Nein", ButtonBar.ButtonData.NO);
private boolean result;
public AlertNewSchedule() {
super(AlertType.WARNING);
setTitle("Neu erstellen");
setHeaderText("Spielplan neu erstellen?");
setContentText("Sind Sie sicher, dass Sie den Spielplan neu erstellen moechten?\nAlle Spielfortschritte gehen daraufhin verloren!");
getButtonTypes().setAll(yesButton,noButton);
}
public boolean showAndGetResult() {
showAndWait().ifPresent(input -> {
result = input == yesButton;
});
return result;
}
}
@@ -1,7 +1,6 @@
package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView; package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView;
import ch.zhaw.projekt2.turnierverwaltung.FXController; import ch.zhaw.projekt2.turnierverwaltung.FXController;
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;
@@ -30,8 +29,15 @@ public class GameScheduleController extends FXController {
@FXML @FXML
void createNewSchedule(ActionEvent event) { void createNewSchedule(ActionEvent event) {
if (getTournamentDecorator().getTournament().getGameList().size() > 0) {
AlertNewSchedule alert = new AlertNewSchedule();
if (alert.showAndGetResult()) {
getTournamentDecorator().createNewGameSchedule(); getTournamentDecorator().createNewGameSchedule();
} }
} else {
getTournamentDecorator().createNewGameSchedule();
}
}
@FXML @FXML
void openPlacesFormular(ActionEvent event) { void openPlacesFormular(ActionEvent event) {
@@ -21,9 +21,7 @@ public class AlertDelete extends Alert {
public boolean showAndGetResult() { public boolean showAndGetResult() {
result = false; result = false;
showAndWait().ifPresent(type -> { showAndWait().ifPresent(type -> {
if (type == yesButton) { result = type == yesButton;
result = true;
}
}); });
return result; return result;
} }
@@ -1,29 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.*?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.*?>
<?import javafx.scene.control.CheckBox?> <?import javafx.scene.layout.*?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" 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">
<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" />
</content>
</ScrollPane>
</center>
<top> <top>
<HBox alignment="CENTER_LEFT" 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"> <CheckBox fx:id="treeView" mnemonicParsing="false" onAction="#changeView" selected="true" text="Baumansicht" />
<HBox.margin> <Button fx:id="createScheduleBtn" mnemonicParsing="false" onAction="#createNewSchedule" text="Create New Game Schedule">
<Insets left="20.0" right="20.0" />
</HBox.margin>
</CheckBox>
<Button fx:id="createScheduleBtn" mnemonicParsing="false" onAction="#createNewSchedule" text="Spielplan neu erstellen">
<HBox.margin> <HBox.margin>
<Insets right="20.0" /> <Insets right="20.0" />
</HBox.margin> </HBox.margin>
@@ -38,12 +24,18 @@
<Insets right="20.0" /> <Insets right="20.0" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button fx:id="closeTournamentBtn" mnemonicParsing="false" onAction="#closeTournament" text="Close Tournament"> <Button fx:id="closeTournamentBtn" layoutX="470.0" layoutY="10.0" mnemonicParsing="false" onAction="#closeTournament" text="Close Tournament">
<HBox.margin> <HBox.margin>
<Insets right="20.0" /> <Insets right="20.0" />
</HBox.margin> </HBox.margin></Button>
</Button>
</children> </children>
</HBox> </HBox>
</top> </top>
<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" />
</content>
</ScrollPane>
</center>
</BorderPane> </BorderPane>