|
|
|
|
@ -46,6 +46,7 @@ public class StartController extends Controller {
|
|
|
|
|
private RaceClock raceClock;
|
|
|
|
|
|
|
|
|
|
private RaceDataSource raceData;
|
|
|
|
|
private long timeLeft = 1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Begins the race with a scale factor of 15
|
|
|
|
|
@ -89,6 +90,7 @@ public class StartController extends Controller {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
initialiseTables();
|
|
|
|
|
setRaceClock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AnchorPane startWrapper(){
|
|
|
|
|
@ -102,9 +104,6 @@ public class StartController extends Controller {
|
|
|
|
|
boatNameTable.setItems(observableBoats);
|
|
|
|
|
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().getName());
|
|
|
|
|
boatCodeColumn.setCellValueFactory(new PropertyValueFactory<>("abbrev"));
|
|
|
|
|
//timezone
|
|
|
|
|
raceClock = new RaceClock(raceData.getZonedDateTime());
|
|
|
|
|
timeZoneTime.textProperty().bind(raceClock.timeStringProperty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +129,6 @@ public class StartController extends Controller {
|
|
|
|
|
long currentTimeInSeconds;
|
|
|
|
|
long remainingSeconds;
|
|
|
|
|
long hours;
|
|
|
|
|
long timeLeft;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long arg0) {
|
|
|
|
|
@ -148,7 +146,6 @@ public class StartController extends Controller {
|
|
|
|
|
hours = minutes / 60;
|
|
|
|
|
minutes = minutes % 60;
|
|
|
|
|
updateTime(String.format("Race Clock: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
|
|
|
|
|
raceClock.updateTime();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
currentTime = System.currentTimeMillis();
|
|
|
|
|
@ -156,4 +153,20 @@ public class StartController extends Controller {
|
|
|
|
|
}.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setRaceClock() {
|
|
|
|
|
raceClock = new RaceClock(raceData.getZonedDateTime());
|
|
|
|
|
timeZoneTime.textProperty().bind(raceClock.timeStringProperty());
|
|
|
|
|
|
|
|
|
|
new AnimationTimer() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long arg0) {
|
|
|
|
|
if (timeLeft > 0) {
|
|
|
|
|
raceClock.updateTime();
|
|
|
|
|
} else {
|
|
|
|
|
stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|