Merge branch 'unitTests'

This commit is contained in:
YaFedImYaEatIm
2016-09-19 06:11:41 +12:00
32 changed files with 35762 additions and 162 deletions
@@ -9,6 +9,7 @@ import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import seng202.group9.Controller.App;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.FlightPath;
import seng202.group9.Core.FlightPoint;
@@ -121,7 +122,11 @@ public class FlightRDController extends Controller {
*/
public void load() {
theDataSet = getParent().getCurrentDataset();
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
try {
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
} catch (DataException e) {
e.printStackTrace();
}
flightIdCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("ID"));
flightNameCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Name"));
flightTypeCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Type"));
@@ -199,7 +204,14 @@ public class FlightRDController extends Controller {
*/
public void deletePoint() {
FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem();
int pathID = toDelete.getIndex();
int pathID = 0;
try {
pathID = toDelete.getIndex();
} catch (DataException e) {
e.printStackTrace();
System.out.println("Point is Undeletable as the Index ID is not set.");
return;
}
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
FlightPath toDeletesPath = flightPathDict.get(pathID);
theDataSet.deleteFlightPoint(toDelete, toDeletesPath);