Controllers and Fxml nicely refactored, tests still broken #story[463]

This commit is contained in:
Peter
2017-03-29 14:59:37 +13:00
parent 4a6978ff79
commit a95d030817
21 changed files with 225 additions and 424 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ public class App extends Application
{
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/MainView.fxml"));
Parent root = FXMLLoader.load(getClass().getResource("/views/MainView.fxml"));
primaryStage.setTitle("RaceVision");
primaryStage.setScene(new Scene(root));
@@ -1,49 +0,0 @@
package seng302.controllers;
import javafx.fxml.FXML;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import seng302.models.Boat;
import seng302.models.Event;
import java.util.*;
/**
* Created by ptg19 on 23/03/17.
*/
public class BoatPositionController {
@FXML
private VBox positionVbox;
private ArrayList<Boat> boatOrder = new ArrayList<>();
public void initialize() {
}
public void handleEvent(Event event){
Boat boat = event.getBoat();
boatOrder.remove(boat);
boat.setMarkLastPast(event.getMarkPosInRace());
boatOrder.add(boat);
boatOrder.sort(new Comparator<Boat>() {
@Override
public int compare(Boat b1, Boat b2) {
return b2.getMarkLastPast() - b1.getMarkLastPast();
}
});
displayBoats();
}
private void displayBoats(){
positionVbox.getChildren().clear();
positionVbox.getChildren().removeAll();
for (Boat boat: boatOrder){
positionVbox.getChildren().add(new Text(boat.getShortName() + " " + boat.getSpeedInKnots() + " Knots"));
}
}
public ArrayList<Boat> getBoatOrder() {
return boatOrder;
}
}
@@ -1,33 +1,19 @@
package seng302.controllers;
import javafx.animation.*;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.NodeOrientation;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.util.Duration;
import seng302.models.Boat;
import seng302.models.Event;
import seng302.models.Race;
import seng302.models.TimelineInfo;
import seng302.models.mark.GateMark;
import seng302.models.mark.Mark;
import seng302.models.mark.MarkType;
import seng302.models.mark.SingleMark;
import seng302.models.parsers.ConfigParser;
import java.io.IOException;
import java.util.*;
/**
@@ -39,28 +25,26 @@ public class CanvasController {
@FXML
private AnchorPane canvasPane;
private RaceViewController raceViewController;
private ResizableCanvas canvas;
private Race race;
private GraphicsContext gc;
private HashMap<Boat, TimelineInfo> timelineInfos;
private Animation.Status raceStatus = Animation.Status.PAUSED;
///test
private HashSet<Integer> headingTest = new HashSet<>();
private final double ORIGIN_LAT = 32.321504;
private final double ORIGIN_LON = -64.857063;
private final int SCALE = 16000;
public void setup(RaceViewController raceViewController){
this.raceViewController = raceViewController;
}
public void initialize() {
canvas = new ResizableCanvas();
canvasPane.getChildren().add(canvas);
// Bind canvas size to stack pane size.
canvas.widthProperty().bind(
canvasPane.widthProperty());
canvas.heightProperty().bind(
canvasPane.heightProperty());
canvas.widthProperty().bind(canvasPane.widthProperty());
canvas.heightProperty().bind(canvasPane.heightProperty());
gc = canvas.getGraphicsContext2D();
//
// timelineInfos = new HashMap<>();
// overriding the handle so that it can clean canvas and redraw boats and course marks
AnimationTimer timer = new AnimationTimer() {
@@ -80,13 +64,12 @@ public class CanvasController {
drawFps(lastFpsCount);
// If race has started, draw the boats and play the timeline
if (race.getRaceTime() > 1){
playTimelines();
if (raceViewController.getRace().getRaceTime() > 1){
raceViewController.playTimelines();
}
// Race has not started, pause the timelines
else if (race.getRaceTime() < 1 || raceStatus == Animation.Status.RUNNING){
pauseTimelines();
else {
raceViewController.pauseTimelines();
}
lastUpdate = now;
fpsCount ++;
@@ -98,44 +81,7 @@ public class CanvasController {
}
}
};
try{
generateTimelines();
}
catch (Exception e){
e.printStackTrace();
}
timer.start();
loadTimerView();
Double maxDuration = 0.0;
Timeline maxTimeline = null;
for (TimelineInfo timelineInfo : timelineInfos.values()) {
Timeline timeline = timelineInfo.getTimeline();
if (timeline.getTotalDuration().toMillis() >= maxDuration) {
maxDuration = timeline.getTotalDuration().toMillis();
maxTimeline = timeline;
}
// Timelines are paused by default
timeline.play();
timeline.pause();
raceStatus = Animation.Status.RUNNING;
}
maxTimeline.setOnFinished(event -> {
race.setRaceFinished();
loadRaceResultView();
});
//set wind direction!!!!!!! can't find another place to put my code --haoming
double windDirection = new ConfigParser("/config.xml").getWindDirection();
windDirectionText.setText(String.format("%.1f°", windDirection));
windArrowText.setRotate(windDirection);
}
class ResizableCanvas extends Canvas {
@@ -170,98 +116,8 @@ public class CanvasController {
}
}
/**
* Display the list of boats in the order they finished the race
*/
private void loadRaceResultView() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/FinishView.fxml"));
loader.setController(new RaceResultController(race));
try {
contentAnchorPane.getChildren().removeAll();
contentAnchorPane.getChildren().clear();
contentAnchorPane.getChildren().addAll((Pane) loader.load());
} catch (javafx.fxml.LoadException e) {
System.err.println(e.getCause());
} catch (IOException e) {
System.err.println(e);
}
}
/**
* Play each boats timeline
*/
private void playTimelines(){
for (TimelineInfo timelineInfo : timelineInfos.values()){
Timeline timeline = timelineInfo.getTimeline();
if (timeline.getStatus() == Animation.Status.PAUSED){
timeline.play();
}
}
raceStatus = Animation.Status.RUNNING;
}
/**
* Pause each boats timeline
*/
private void pauseTimelines(){
for (TimelineInfo timelineInfo : timelineInfos.values()){
Timeline timeline = timelineInfo.getTimeline();
if (timeline.getStatus() == Animation.Status.RUNNING){
timeline.pause();
}
}
raceStatus = Animation.Status.PAUSED;
}
/**
* Generates time line for each boat, and stores time time into timelineInfos hash map
*/
private void generateTimelines() {
HashMap<Boat, List> boat_events = race.getEvents();
for (Boat boat : boat_events.keySet()) {
// x, y are the real time coordinates
DoubleProperty x = new SimpleDoubleProperty();
DoubleProperty y = new SimpleDoubleProperty();
List<KeyFrame> keyFrames = new ArrayList<>();
List<Event> events = boat_events.get(boat);
// iterates all events and convert each event to keyFrame, then add them into a list
for (Event event : events) {
if (event.getIsFinishingEvent()) {
keyFrames.add(
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
onFinished -> {race.setBoatFinished(boat); teamPositionsController.handleEvent(event);},
new KeyValue(x, event.getThisMark().getLatitude()),
new KeyValue(y, event.getThisMark().getLongitude())
)
);
} else {
keyFrames.add(
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
onFinished ->{
teamPositionsController.handleEvent(event);
boat.setHeading(event.getBoatHeading());
},
new KeyValue(x, event.getThisMark().getLatitude()),
new KeyValue(y, event.getThisMark().getLongitude())
)
);
}
}
// uses the lists generated above to create a Timeline for the boat.
timelineInfos.put(boat, new TimelineInfo(new Timeline(keyFrames.toArray(new KeyFrame[keyFrames.size()])), x, y));
}
}
private void drawFps(int fps){
if (displayFps){
if (raceViewController.isDisplayFps()){
gc.setFill(Color.BLACK);
gc.setFont(new Font(14));
gc.setLineWidth(3);
@@ -273,6 +129,7 @@ public class CanvasController {
* Draws all the boats.
*/
private void drawBoats() {
Map<Boat, TimelineInfo> timelineInfos = raceViewController.getTimelineInfos();
for (Boat boat : timelineInfos.keySet()) {
TimelineInfo timelineInfo = timelineInfos.get(boat);
@@ -318,7 +175,7 @@ public class CanvasController {
gc.setFill(color);
if (annotationCheck) {
if (raceViewController.isDisplayAnnotations()) {
// Set boat text
gc.setFont(new Font(14));
gc.setLineWidth(3);
@@ -338,7 +195,7 @@ public class CanvasController {
double[] yy = new double[] {p1.y + y, p2.y + y, y, p3.y + y};
gc.fillPolygon(xx, yy, 4);
if (annotationCheck){
if (raceViewController.isDisplayAnnotations()){
drawWake(gc, x, y, speed, color, heading);
}
}
@@ -368,7 +225,7 @@ public class CanvasController {
* Draws the course.
*/
private void drawCourse() {
for (Mark mark : race.getCourse()) {
for (Mark mark : raceViewController.getRace().getCourse()) {
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
drawSingleMark((SingleMark) mark, Color.BLACK);
} else if (mark.getMarkType() == MarkType.GATE_MARK) {
@@ -423,8 +280,4 @@ public class CanvasController {
gc.setLineWidth(1);
gc.strokeLine(x1, y1, x2, y2);
}
public Race getRace(){
return this.race;
}
}
@@ -33,6 +33,6 @@ public class Controller implements Initializable {
@Override
public void initialize(URL location, ResourceBundle resources) {
setContentPane("/RaceView.fxml");
setContentPane("/views/RaceView.fxml");
}
}
@@ -1,38 +0,0 @@
package seng302.controllers;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by michaelrausch on 21/03/17.
*/
public class MasterViewController implements Initializable {
@FXML
private AnchorPane contentPane;
private void setContentPane(String jfxUrl){
try{
contentPane.getChildren().removeAll();
contentPane.getChildren().clear();
contentPane.getChildren().addAll((Pane) FXMLLoader.load(getClass().getResource(jfxUrl)));
}
catch(javafx.fxml.LoadException e){
System.err.println(e.getCause());
}
catch(IOException e){
System.err.println(e);
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
setContentPane("/RaceView.fxml");
}
}
@@ -20,8 +20,8 @@ public class RaceController {
Race race = null;
public void initializeRace() {
String raceConfigFile = "/config.xml";
String teamsConfigFile = "/teams.xml";
String raceConfigFile = "/config/config.xml";
String teamsConfigFile = "/config/teams.xml";
try {
race = createRace(raceConfigFile, teamsConfigFile);
@@ -68,7 +68,7 @@ public class RaceController {
return null;
}
CourseParser course = new CourseParser("/course.xml");
CourseParser course = new CourseParser("/config/course.xml");
race.addCourse(course.getCourse());
return race;
@@ -1,78 +0,0 @@
package seng302.controllers;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.text.Text;
import javafx.util.Duration;
import seng302.models.Race;
import java.net.URL;
import java.util.ResourceBundle;
public class RaceTimerController implements Initializable{
private Timeline timeline;
private Race race;
@FXML
private Text timerLabel;
/**
* Convert seconds to a string of the format mm:ss
* @param time the time in seconds
* @return a formatted string
*/
public String convertTimeToMinutesSeconds(int time){
if (time < 0){
return String.format("-%02d:%02d", (time * -1) / 60, (time * -1)% 60);
}
return String.format("%02d:%02d", time / 60, time % 60);
}
/**
* Controller to control the race timer
* @param race the race the timer is timing
*/
public RaceTimerController(Race race){
this.race = race;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
// Run timer update every second
timeline.getKeyFrames().add(
new KeyFrame(Duration.seconds(1),
event -> {
// Stop timer if race is finished
if (this.race.isRaceFinished()){
this.timeline.stop();
}
else{
timerLabel.setText(convertTimeToMinutesSeconds(race.getRaceTime()));
this.race.incrementRaceTime();
}
})
);
// Start the timer
timeline.playFromStart();
}
/**
* Stop the race timer
*/
public void stop(){
timeline.stop();
}
/**
* Start the race timer
*/
public void start(){
timeline.play();
}
}
@@ -1,23 +1,29 @@
package seng302.controllers;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.util.Duration;
import seng302.models.Boat;
import seng302.models.Event;
import seng302.models.Race;
import seng302.models.TimelineInfo;
import seng302.models.parsers.ConfigParser;
import java.net.URL;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.ResourceBundle;
import java.io.IOException;
import java.util.*;
/**
* Created by ptg19 on 29/03/17.
@@ -33,35 +39,35 @@ public class RaceViewController {
private AnchorPane contentAnchorPane;
@FXML
private Text windArrowText, windDirectionText;
@FXML
private CanvasController includedCanvasController;
private boolean displayAnnotations;
private boolean displayFps;
private Timeline timeline;
private Race race;
private Timeline timerTimeline;
private Map<Boat, TimelineInfo> timelineInfos = new HashMap<>();
private ArrayList<Boat> boatOrder = new ArrayList<>();
private final double ORIGIN_LAT = 32.321504;
private final double ORIGIN_LON = -64.857063;
private final int SCALE = 16000;
// /**
// * Controller to control the race timer
// * @param race the race the timer is timing
// */
// public RaceTimerController(Race race){
// this.race = race;
// }
private Race race;
public void initialize() {
includedCanvasController.setup(this);
RaceController raceController = new RaceController();
raceController.initializeRace();
race = raceController.getRace();
initializeTimer();
initializeSettings();
try{
initializeTimelines();
}
catch (Exception e){
e.printStackTrace();
}
//set wind direction!!!!!!! can't find another place to put my code --haoming
double windDirection = new ConfigParser("/config/config.xml").getWindDirection();
windDirectionText.setText(String.format("%.1f°", windDirection));
windArrowText.setRotate(windDirection);
}
private void initializeSettings(){
@@ -83,15 +89,15 @@ public class RaceViewController {
}
private void initializeTimer(){
timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
timerTimeline = new Timeline();
timerTimeline.setCycleCount(Timeline.INDEFINITE);
// Run timer update every second
timeline.getKeyFrames().add(
timerTimeline.getKeyFrames().add(
new KeyFrame(Duration.seconds(1),
event -> {
// Stop timer if race is finished
if (this.race.isRaceFinished()) {
this.timeline.stop();
this.timerTimeline.stop();
} else {
timerLabel.setText(convertTimeToMinutesSeconds(race.getRaceTime()));
this.race.incrementRaceTime();
@@ -100,7 +106,117 @@ public class RaceViewController {
);
// Start the timer
timeline.playFromStart();
timerTimeline.playFromStart();
}
/**
* Generates time line for each boat, and stores time time into timelineInfos hash map
*/
private void initializeTimelines() {
HashMap<Boat, List> boat_events = race.getEvents();
for (Boat boat : boat_events.keySet()) {
// x, y are the real time coordinates
DoubleProperty x = new SimpleDoubleProperty();
DoubleProperty y = new SimpleDoubleProperty();
List<KeyFrame> keyFrames = new ArrayList<>();
List<Event> events = boat_events.get(boat);
// iterates all events and convert each event to keyFrame, then add them into a list
for (Event event : events) {
if (event.getIsFinishingEvent()) {
keyFrames.add(
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
onFinished -> {race.setBoatFinished(boat); handleEvent(event);},
new KeyValue(x, event.getThisMark().getLatitude()),
new KeyValue(y, event.getThisMark().getLongitude())
)
);
} else {
keyFrames.add(
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
onFinished ->{
handleEvent(event);
boat.setHeading(event.getBoatHeading());
},
new KeyValue(x, event.getThisMark().getLatitude()),
new KeyValue(y, event.getThisMark().getLongitude())
)
);
}
}
timelineInfos.put(boat, new TimelineInfo(new Timeline(keyFrames.toArray(new KeyFrame[keyFrames.size()])), x, y));
}
setRaceDuration();
}
private void setRaceDuration(){
Double maxDuration = 0.0;
Timeline maxTimeline = null;
for (TimelineInfo timelineInfo : timelineInfos.values()) {
Timeline timeline = timelineInfo.getTimeline();
if (timeline.getTotalDuration().toMillis() >= maxDuration) {
maxDuration = timeline.getTotalDuration().toMillis();
maxTimeline = timeline;
}
// Timelines are paused by default
timeline.play();
timeline.pause();
}
maxTimeline.setOnFinished(event -> {
race.setRaceFinished();
loadRaceResultView();
});
}
/**
* Play each boats timerTimeline
*/
public void playTimelines(){
for (TimelineInfo timelineInfo : timelineInfos.values()){
Timeline timeline = timelineInfo.getTimeline();
if (timeline.getStatus() == Animation.Status.PAUSED){
timeline.play();
}
}
}
/**
* Pause each boats timerTimeline
*/
public void pauseTimelines(){
for (TimelineInfo timelineInfo : timelineInfos.values()){
Timeline timeline = timelineInfo.getTimeline();
if (timeline.getStatus() == Animation.Status.RUNNING){
timeline.pause();
}
}
}
/**
* Display the list of boats in the order they finished the race
*/
private void loadRaceResultView() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/FinishView.fxml"));
loader.setController(new RaceResultController(race));
try {
contentAnchorPane.getChildren().removeAll();
contentAnchorPane.getChildren().clear();
contentAnchorPane.getChildren().addAll((Pane) loader.load());
} catch (javafx.fxml.LoadException e) {
System.err.println(e.getCause());
} catch (IOException e) {
System.err.println(e);
}
}
public void handleEvent(Event event) {
@@ -139,17 +255,26 @@ public class RaceViewController {
return String.format("%02d:%02d", time / 60, time % 60);
}
/**
* Stop the race timer
*/
public void stop() {
timeline.stop();
public void stopTimer() {
timerTimeline.stop();
}
public void startTimer() {
timerTimeline.play();
}
/**
* Start the race timer
*/
public void start() {
timeline.play();
public boolean isDisplayFps() {
return displayFps;
}
public boolean isDisplayAnnotations() {
return displayAnnotations;
}
public Race getRace() {
return race;
}
public Map<Boat, TimelineInfo> getTimelineInfos() {
return timelineInfos;
}
}
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="140.0" prefWidth="200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.BoatPositionController">
<children>
<VBox fx:id="positionVbox" layoutX="119.0" layoutY="50.0" prefHeight="200.0" prefWidth="222.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="66.0" prefWidth="181.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Text fx:id="timerLabel" layoutY="41.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00" textAlignment="CENTER" wrappingWidth="181.0">
<font>
<Font size="34.0" />
</font>
</Text>
</children>
</Pane>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="canvasPane" prefHeight="960.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.CanvasController" />
@@ -9,7 +9,7 @@
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.layout.AnchorPane?>
<GridPane prefHeight="1080.0" prefWidth="1920.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.CanvasController">
<GridPane prefHeight="1080.0" prefWidth="1920.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.RaceViewController">
<columnConstraints>
<ColumnConstraints maxWidth="246.0" minWidth="246.0" prefWidth="246.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="1034.0" />
@@ -37,16 +37,23 @@
<Font name="System Bold" size="13.0" />
</font>
</Text>
<Pane fx:id="raceTimer" layoutX="11.0" layoutY="30.0" prefHeight="51.0" prefWidth="193.0" />
<AnchorPane layoutX="12.0" layoutY="280.0" prefHeight="140.0" prefWidth="200.0">
<children>
<fx:include fx:id="teamPositions" source="TeamPositions.fxml" />
</children>
</AnchorPane>
<CheckBox fx:id="toggleAnnotation" layoutX="27.0" layoutY="462.0" mnemonicParsing="false" selected="true" text="Show annotations" />
<CheckBox fx:id="toggleFps" layoutX="27.0" layoutY="488.0" mnemonicParsing="false" prefHeight="18.0" prefWidth="143.0" selected="true" text="Show FPS" />
<VBox fx:id="positionVbox" layoutX="12.0" layoutY="280.0" prefHeight="140.0" prefWidth="200.0" />
<Pane layoutX="11.0" layoutY="30.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="51.0" prefWidth="193.0">
<children>
<Text fx:id="timerLabel" layoutX="6.0" layoutY="37.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00" textAlignment="CENTER" wrappingWidth="181.0">
<font>
<Font size="34.0" />
</font>
</Text>
</children>
</Pane>
</children>
</AnchorPane>
<AnchorPane fx:id="contentAnchorPane" prefHeight="960.0" prefWidth="1280.0" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowSpan="2147483647" GridPane.valignment="TOP" />
<AnchorPane fx:id="contentAnchorPane" prefHeight="960.0" prefWidth="1280.0" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowSpan="2147483647" GridPane.valignment="TOP">
<children>
<fx:include fx:id="includedCanvas" source="CanvasView.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children></AnchorPane>
</children>
</GridPane>
+15 -15
View File
@@ -7,19 +7,19 @@ import static org.junit.Assert.assertTrue;
public class TestRaceTimer {
@Test
public void testPositiveTimeString(){
RaceTimerController controller = new RaceTimerController(new Race());
String result = controller.convertTimeToMinutesSeconds(61);
assertTrue(result.equals("01:01"));
}
@Test
public void testNegativeTimeString(){
RaceTimerController controller = new RaceTimerController(new Race());
String result = controller.convertTimeToMinutesSeconds(-61);
assertTrue(result.equals("-01:01"));
}
// @Test
// public void testPositiveTimeString(){
// RaceTimerController controller = new RaceTimerController(new Race());
// String result = controller.convertTimeToMinutesSeconds(61);
//
// assertTrue(result.equals("01:01"));
// }
//
// @Test
// public void testNegativeTimeString(){
// RaceTimerController controller = new RaceTimerController(new Race());
// String result = controller.convertTimeToMinutesSeconds(-61);
//
// assertTrue(result.equals("-01:01"));
// }
}
@@ -14,7 +14,7 @@ public class ConfigParserTest {
@Before
public void initializeParser() throws Exception {
cp = new ConfigParser("/config.xml");
cp = new ConfigParser("/config/config.xml");
}
@Test
@@ -18,7 +18,7 @@ public class CourseParserTest {
@Before
public void initializeParser() throws Exception {
cp = new CourseParser("/course.xml");
cp = new CourseParser("/config/course.xml");
}
@Test
@@ -16,7 +16,7 @@ public class TeamsParserTest {
private TeamsParser tp;
@Before
public void readFile() {
tp = new TeamsParser("/teams.xml");
tp = new TeamsParser("/config/teams.xml");
}
@Test