Populated starting boat table
- boat names shown in first column - boat abbrevs. shown in second column #story[760]
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package seng302.Controllers;
|
package seng302.Controllers;
|
||||||
|
|
||||||
import javafx.beans.property.StringProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -9,7 +8,6 @@ import javafx.scene.control.TableView;
|
|||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import seng302.Model.Boat;
|
|
||||||
import seng302.Model.BoatInRace;
|
import seng302.Model.BoatInRace;
|
||||||
import seng302.RaceXMLReader;
|
import seng302.RaceXMLReader;
|
||||||
|
|
||||||
@@ -25,11 +23,9 @@ public class StartController extends Controller {
|
|||||||
|
|
||||||
@FXML private GridPane start;
|
@FXML private GridPane start;
|
||||||
|
|
||||||
@FXML TableView<BoatInRace> boatNameTable;
|
@FXML private TableView<BoatInRace> boatNameTable;
|
||||||
@FXML
|
@FXML private TableColumn<BoatInRace, String> boatNameColumn;
|
||||||
TableColumn<BoatInRace, String> boatNameColumn;
|
@FXML private TableColumn<BoatInRace, String> boatCodeColumn;
|
||||||
@FXML
|
|
||||||
TableColumn<BoatInRace, String> boatCodeColumn;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begins the race with a scale factor of 15
|
* Begins the race with a scale factor of 15
|
||||||
@@ -60,7 +56,7 @@ public class StartController extends Controller {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources){
|
public void initialize(URL location, ResourceBundle resources){
|
||||||
|
initialiseTables();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -81,7 +77,9 @@ public class StartController extends Controller {
|
|||||||
BoatInRace[] boats = new BoatInRace[raceXMLReader.getBoats().size()];
|
BoatInRace[] boats = new BoatInRace[raceXMLReader.getBoats().size()];
|
||||||
boats = raceXMLReader.getBoats().toArray(boats);
|
boats = raceXMLReader.getBoats().toArray(boats);
|
||||||
ObservableList<BoatInRace> observableBoats = FXCollections.observableArrayList(boats);
|
ObservableList<BoatInRace> observableBoats = FXCollections.observableArrayList(boats);
|
||||||
|
boatNameTable.setItems(observableBoats);
|
||||||
|
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().getName());
|
||||||
|
boatCodeColumn.setCellValueFactory(new PropertyValueFactory<>("abbrev"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user