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 { ...@@ -92,14 +92,12 @@ public class Model {
boolean result = true; boolean result = true;
try { try {
cupLocation = cupLocationField.getText(); cupLocation = cupLocationField.getText();
startDateTime = LocalDateTime.of(startDateField.getValue(), LocalTime.parse(startTimeField.getText())); startDateTime = LocalDateTime.of(startDateField.getValue(), LocalTime.parse(startTimeField.getText()));
endDateTime = LocalDateTime.of(endDateField.getValue(), LocalTime.parse(endTimeField.getText())); endDateTime = LocalDateTime.of(endDateField.getValue(), LocalTime.parse(endTimeField.getText()));
cup = new Cup(cupLocation, startDateTime, endDateTime); cup = new Cup(cupLocation, startDateTime, endDateTime);
cups.add(cup); cups.add(cup);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
result = false; result = false;
giveError(e.getMessage()); giveError(e.getMessage());
...@@ -113,15 +111,4 @@ public class Model { ...@@ -113,15 +111,4 @@ public class Model {
return result; return result;
} }
} }
/**
* Send help.
*/
public static void sendHelp() {}
/**
* Send rules.
*/
public static void sendRules() {}
} }
...@@ -44,7 +44,7 @@ public class ViewUtil { ...@@ -44,7 +44,7 @@ public class ViewUtil {
try { try {
scene = new Scene(fxmlLoader.load(), getDefaultWidth(), getDefaultHeight()); scene = new Scene(fxmlLoader.load(), getDefaultWidth(), getDefaultHeight());
} catch (IOException e) { } catch (IOException e) {
giveError(e.getMessage()); giveError(e.getCause().toString());
} }
stage.setScene(scene); stage.setScene(scene);
} }
...@@ -75,7 +75,6 @@ public class ViewUtil { ...@@ -75,7 +75,6 @@ public class ViewUtil {
alert.setTitle("Error"); alert.setTitle("Error");
alert.setHeaderText(null); alert.setHeaderText(null);
alert.setContentText(message); alert.setContentText(message);
alert.showAndWait(); alert.showAndWait();
} }
......
...@@ -4,28 +4,30 @@ import edu.ntnu.idatt1002.k1g4.Cup; ...@@ -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.Model.*;
import static edu.ntnu.idatt1002.k1g4.client.ViewUtil.*; import static edu.ntnu.idatt1002.k1g4.client.ViewUtil.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.DatePicker; import javafx.scene.control.DatePicker;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import java.time.LocalDateTime; import java.net.URL;
import java.time.LocalTime; import java.util.ResourceBundle;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.HashMap;
/** /**
* Cup Controller * Cup Controller
* handles the page of creating a cup * handles the page of creating a cup
* and viewing everything in a cup * and viewing everything in a cup
* *
* @author Carl Gützkow * @author Carl Gützkow, Nicolai H. Brand.
* @version 0.1 * @version 0.1
*/ */
public class CupController { public class CupController implements Initializable {
/* create cup scene */
private Cup cup; private Cup cup;
@FXML @FXML
...@@ -44,6 +46,17 @@ public class CupController { ...@@ -44,6 +46,17 @@ public class CupController {
private TextField endTimeField; 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 * Cancel creation of a cup and returns to the home page
* *
...@@ -65,28 +78,10 @@ public class CupController { ...@@ -65,28 +78,10 @@ public class CupController {
*/ */
@FXML @FXML
void onCreateCup(ActionEvent event) { void onCreateCup(ActionEvent event) {
boolean result = createCup(cupLocationField, startDateField, startTimeField, endDateField, endTimeField); boolean result = createCup(cupLocationField, startDateField, startTimeField, endDateField, endTimeField);
if (result) if (result) {
changeScene("cup-overview", event); 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 { ...@@ -112,7 +107,6 @@ public class CupController {
} }
/** /**
* Changes page to page for crating a match * Changes page to page for crating a match
* *
...@@ -134,4 +128,11 @@ public class CupController { ...@@ -134,4 +128,11 @@ public class CupController {
void backToCups(ActionEvent event) { void backToCups(ActionEvent event) {
changeScene("home", 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; package edu.ntnu.idatt1002.k1g4.client.controllers;
import static edu.ntnu.idatt1002.k1g4.client.Model.*;
import static edu.ntnu.idatt1002.k1g4.client.ViewUtil.*; import static edu.ntnu.idatt1002.k1g4.client.ViewUtil.*;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
...@@ -21,7 +20,7 @@ import java.net.URISyntaxException; ...@@ -21,7 +20,7 @@ import java.net.URISyntaxException;
* and the buttons for go to * and the buttons for go to
* the cup creation page, help and rules. * the cup creation page, help and rules.
* *
* @author Carl Gützkow * @author Carl Gützkow, Nicolai H. Brand.
* @version 0.1 * @version 0.1
*/ */
public class HomeController { public class HomeController {
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<Button mnemonicParsing="false" onAction="#addDivision" prefHeight="25.0" prefWidth="262.0" text="Add new division" /> <Button mnemonicParsing="false" onAction="#addDivision" prefHeight="25.0" prefWidth="262.0" text="Add new division" />
</children> </children>
</FlowPane> </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> </children>
</GridPane> </GridPane>
</content> </content>
...@@ -61,14 +61,8 @@ ...@@ -61,14 +61,8 @@
<RowConstraints maxHeight="461.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="461.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0"> <FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0" />
<children> <ListView fx:id="matchListView" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
<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" />
</children> </children>
</GridPane> </GridPane>
</content> </content>
...@@ -84,12 +78,8 @@ ...@@ -84,12 +78,8 @@
<RowConstraints maxHeight="394.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="394.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0"> <FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="50.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="55.0" prefWidth="1071.0" vgap="20.0" />
<children> <ListView fx:id="teamListView" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
<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" />
</children> </children>
</GridPane> </GridPane>
</content> </content>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment