Skip to content
Snippets Groups Projects
Commit d95624f1 authored by Nicolai Hollup Brand's avatar Nicolai Hollup Brand :penguin:
Browse files

Merge branch 'feat/show-cup-info' into 'main'

feat(main...client): Started work on displaying divisions for a cup dynamically

See merge request carljgu/tournament-service!57
parents 64a98849 c1fc1f31
No related branches found
No related tags found
No related merge requests found
......@@ -92,14 +92,12 @@ public class Model {
boolean result = true;
try {
cupLocation = cupLocationField.getText();
startDateTime = LocalDateTime.of(startDateField.getValue(), LocalTime.parse(startTimeField.getText()));
endDateTime = LocalDateTime.of(endDateField.getValue(), LocalTime.parse(endTimeField.getText()));
cup = new Cup(cupLocation, startDateTime, endDateTime);
cups.add(cup);
} catch (IllegalArgumentException e) {
result = false;
giveError(e.getMessage());
......@@ -113,15 +111,4 @@ public class Model {
return result;
}
}
/**
* Send help.
*/
public static void sendHelp() {}
/**
* Send rules.
*/
public static void sendRules() {}
}
......@@ -44,7 +44,7 @@ public class ViewUtil {
try {
scene = new Scene(fxmlLoader.load(), getDefaultWidth(), getDefaultHeight());
} catch (IOException e) {
giveError(e.getMessage());
giveError(e.getCause().toString());
}
stage.setScene(scene);
}
......@@ -75,7 +75,6 @@ public class ViewUtil {
alert.setTitle("Error");
alert.setHeaderText(null);
alert.setContentText(message);
alert.showAndWait();
}
......
......@@ -4,28 +4,30 @@ import edu.ntnu.idatt1002.k1g4.Cup;
import static edu.ntnu.idatt1002.k1g4.client.Model.*;
import static edu.ntnu.idatt1002.k1g4.client.ViewUtil.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.DatePicker;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Cup Controller
* handles the page of creating a cup
* and viewing everything in a cup
*
* @author Carl Gützkow
* @author Carl Gützkow, Nicolai H. Brand.
* @version 0.1
*/
public class CupController {
public class CupController implements Initializable {
/* create cup scene */
private Cup cup;
@FXML
......@@ -44,6 +46,17 @@ public class CupController {
private TextField endTimeField;
/* cup overview scene */
@FXML
private ListView<String> divisionListView = new ListView<>();
@FXML
private ListView<?> matchListView = new ListView<>();
@FXML
private ListView<?> teamListView = new ListView<>();
/**
* Cancel creation of a cup and returns to the home page
*
......@@ -65,28 +78,10 @@ public class CupController {
*/
@FXML
void onCreateCup(ActionEvent event) {
boolean result = createCup(cupLocationField, startDateField, startTimeField, endDateField, endTimeField);
if (result)
if (result) {
changeScene("cup-overview", event);
}
@FXML
private ListView<?> divisionList;
@FXML
private ListView<?> divisionList1;
@FXML
private ListView<?> divisionList11;
/**
* Fill cup information. Fills the information
* about divisions, matches and teams in all listviews
*/
public void fillCupInformation() {
}
/**
......@@ -112,7 +107,6 @@ public class CupController {
}
/**
* Changes page to page for crating a match
*
......@@ -134,4 +128,11 @@ public class CupController {
void backToCups(ActionEvent event) {
changeScene("home", event);
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
/* temp list for testing purposes */
ObservableList<String> divisions = FXCollections.observableArrayList();
divisionListView.setItems(divisions);
}
}
\ No newline at end of file
package edu.ntnu.idatt1002.k1g4.client.controllers;
import static edu.ntnu.idatt1002.k1g4.client.Model.*;
import static edu.ntnu.idatt1002.k1g4.client.ViewUtil.*;
import javafx.event.ActionEvent;
......@@ -21,7 +20,7 @@ import java.net.URISyntaxException;
* and the buttons for go to
* the cup creation page, help and rules.
*
* @author Carl Gützkow
* @author Carl Gützkow, Nicolai H. Brand.
* @version 0.1
*/
public class HomeController {
......
......@@ -45,7 +45,7 @@
<Button mnemonicParsing="false" onAction="#addDivision" prefHeight="25.0" prefWidth="262.0" text="Add new division" />
</children>
</FlowPane>
<ListView fx:id="divisionList" prefHeight="200.0" prefWidth="200.0" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ListView fx:id="divisionListView" prefHeight="200.0" prefWidth="200.0" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
</children>
</GridPane>
</content>
......@@ -61,14 +61,8 @@
<RowConstraints maxHeight="461.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0">
<children>
<Button mnemonicParsing="false" onAction="#createMatch" prefHeight="25.0" prefWidth="198.0" text="Manually create match" />
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="262.0" text="Autogenerate matches for all divisions" />
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="262.0" text="Autogenerate matches for specific division" />
</children>
</FlowPane>
<ListView fx:id="divisionList1" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0" />
<ListView fx:id="matchListView" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
</children>
</GridPane>
</content>
......@@ -84,12 +78,8 @@
<RowConstraints maxHeight="394.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0">
<children>
<Button mnemonicParsing="false" onAction="#addTeam" prefHeight="25.0" prefWidth="262.0" text="Add new team" />
</children>
</FlowPane>
<ListView fx:id="divisionList11" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0" />
<ListView fx:id="teamListView" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
</children>
</GridPane>
</content>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment