Renamed some directories, optimized imports, general code clean up
#story[778]
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package seng302.Controllers;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
import seng302.App;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -25,7 +24,7 @@ public abstract class Controller implements Initializable {
|
||||
/**
|
||||
* Initialisation class that is run on start up.
|
||||
*
|
||||
* @param location resources location
|
||||
* @param location resources location
|
||||
* @param resources resources bundle
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package seng302.Controllers;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import seng302.RaceDataSource;
|
||||
import seng302.RaceXMLReader;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -14,20 +11,20 @@ import java.util.ResourceBundle;
|
||||
* Created by fwy13 on 15/03/2017.
|
||||
*/
|
||||
public class MainController extends Controller {
|
||||
@FXML StartController startController;
|
||||
@FXML RaceController raceController;
|
||||
@FXML
|
||||
StartController startController;
|
||||
@FXML
|
||||
RaceController raceController;
|
||||
|
||||
public void beginRace(int scaleFactor, RaceDataSource raceData) {
|
||||
raceController.startRace(scaleFactor, raceData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Main Controller for the applications will house the menu and the displayed pane.
|
||||
*
|
||||
* @param location of resources
|
||||
* @param location of resources
|
||||
* @param resources bundle
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
package seng302.Controllers;
|
||||
|
||||
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.Mock.StreamedRace;
|
||||
import seng302.Model.*;
|
||||
import seng302.Model.BoatInRace;
|
||||
import seng302.Model.Race;
|
||||
import seng302.Model.RaceClock;
|
||||
import seng302.Model.ResizableRaceCanvas;
|
||||
import seng302.RaceDataSource;
|
||||
import seng302.RaceXMLReader;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
@@ -28,16 +22,11 @@ import java.util.ResourceBundle;
|
||||
public class RaceController extends Controller {
|
||||
@FXML
|
||||
GridPane canvasBase;
|
||||
|
||||
//user saved data for annotation display
|
||||
private ArrayList<Boolean> presetAnno;
|
||||
|
||||
ResizableRaceCanvas raceMap;
|
||||
@FXML
|
||||
SplitPane race;
|
||||
@FXML
|
||||
CheckBox showFPS;
|
||||
|
||||
@FXML
|
||||
CheckBox showBoatPath;
|
||||
@FXML
|
||||
@@ -48,7 +37,6 @@ public class RaceController extends Controller {
|
||||
Label FPS;
|
||||
@FXML
|
||||
Label timeZone;
|
||||
|
||||
@FXML
|
||||
CheckBox showName;
|
||||
@FXML
|
||||
@@ -59,7 +47,6 @@ public class RaceController extends Controller {
|
||||
Button saveAnno;
|
||||
@FXML
|
||||
Button showSetAnno;
|
||||
|
||||
@FXML
|
||||
TableView<BoatInRace> boatInfoTable;
|
||||
@FXML
|
||||
@@ -70,6 +57,8 @@ public class RaceController extends Controller {
|
||||
TableColumn<BoatInRace, String> boatMarkColumn;
|
||||
@FXML
|
||||
TableColumn<BoatInRace, String> boatSpeedColumn;
|
||||
//user saved data for annotation display
|
||||
private ArrayList<Boolean> presetAnno;
|
||||
|
||||
/**
|
||||
* Updates the ResizableRaceCanvas (raceMap) with most recent data
|
||||
|
||||
@@ -17,7 +17,6 @@ import seng302.Mock.*;
|
||||
import seng302.Model.BoatInRace;
|
||||
import seng302.Model.RaceClock;
|
||||
import seng302.RaceDataSource;
|
||||
import seng302.RaceXMLReader;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
@@ -31,20 +30,28 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
public class StartController extends Controller {
|
||||
|
||||
@FXML private GridPane start;
|
||||
@FXML private AnchorPane startWrapper;
|
||||
|
||||
@FXML private TableView<BoatInRace> boatNameTable;
|
||||
@FXML private TableColumn<BoatInRace, String> boatNameColumn;
|
||||
@FXML private TableColumn<BoatInRace, String> boatCodeColumn;
|
||||
@FXML private Label timeZoneTime;
|
||||
@FXML private Label timer;
|
||||
@FXML private int PRERACE_TIME = 15000;
|
||||
|
||||
@FXML Button oneMinButton;
|
||||
@FXML Button fiveMinButton;
|
||||
@FXML Button fifteenMinButton;
|
||||
|
||||
@FXML
|
||||
Button oneMinButton;
|
||||
@FXML
|
||||
Button fiveMinButton;
|
||||
@FXML
|
||||
Button fifteenMinButton;
|
||||
@FXML
|
||||
private GridPane start;
|
||||
@FXML
|
||||
private AnchorPane startWrapper;
|
||||
@FXML
|
||||
private TableView<BoatInRace> boatNameTable;
|
||||
@FXML
|
||||
private TableColumn<BoatInRace, String> boatNameColumn;
|
||||
@FXML
|
||||
private TableColumn<BoatInRace, String> boatCodeColumn;
|
||||
@FXML
|
||||
private Label timeZoneTime;
|
||||
@FXML
|
||||
private Label timer;
|
||||
@FXML
|
||||
private int PRERACE_TIME = 15000;
|
||||
private RaceClock raceClock;
|
||||
|
||||
private RaceDataSource raceData;
|
||||
@@ -71,7 +78,7 @@ public class StartController extends Controller {
|
||||
startRace(1);
|
||||
}
|
||||
|
||||
private void startRace(int raceScale){
|
||||
private void startRace(int raceScale) {
|
||||
|
||||
oneMinButton.setDisable(true);
|
||||
fiveMinButton.setDisable(true);
|
||||
@@ -80,7 +87,7 @@ public class StartController extends Controller {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources){
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
raceData = null;
|
||||
try {
|
||||
StreamedCourse streamedCourse = new StreamedCourse(new BoatXMLReader("mockXML/boatXML/boatTest.xml"));
|
||||
@@ -102,7 +109,7 @@ public class StartController extends Controller {
|
||||
setRaceClock();
|
||||
}
|
||||
|
||||
public AnchorPane startWrapper(){
|
||||
public AnchorPane startWrapper() {
|
||||
return startWrapper;
|
||||
}
|
||||
|
||||
@@ -133,7 +140,7 @@ public class StartController extends Controller {
|
||||
protected void countdownTimer(int scaleFactor) {
|
||||
new AnimationTimer() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
||||
long startTime = currentTime + (PRERACE_TIME / scaleFactor);
|
||||
long minutes;
|
||||
long currentTimeInSeconds;
|
||||
long remainingSeconds;
|
||||
@@ -149,7 +156,7 @@ public class StartController extends Controller {
|
||||
startWrapper.setVisible(false);
|
||||
|
||||
} else {
|
||||
currentTimeInSeconds = (timeLeft*scaleFactor) / 1000;
|
||||
currentTimeInSeconds = (timeLeft * scaleFactor) / 1000;
|
||||
minutes = currentTimeInSeconds / 60;
|
||||
remainingSeconds = currentTimeInSeconds % 60;
|
||||
hours = minutes / 60;
|
||||
|
||||
Reference in New Issue
Block a user