- Important, Partial, Hidden, Visible are all radiobuttons - Fixed bug where the Visualiser would end the race before the last boat had finished - Refactored the visualiser and the mock to use the race finished status message - Added and Changed many Javadocs #story[877]
65 lines
1.5 KiB
Java
65 lines
1.5 KiB
Java
package seng302.Controllers;
|
|
|
|
|
|
import javafx.collections.ObservableList;
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.control.Label;
|
|
import javafx.scene.control.TableColumn;
|
|
import javafx.scene.control.TableView;
|
|
import javafx.scene.layout.AnchorPane;
|
|
import seng302.Model.Boat;
|
|
|
|
import java.net.URL;
|
|
import java.util.ResourceBundle;
|
|
|
|
|
|
/**
|
|
* Finish Screen for when the race finishs.
|
|
*/
|
|
public class FinishController extends Controller {
|
|
|
|
@FXML
|
|
AnchorPane finishWrapper;
|
|
|
|
@FXML
|
|
TableView<Boat> boatInfoTable;
|
|
|
|
@FXML
|
|
TableColumn<Boat, String> boatRankColumn;
|
|
|
|
@FXML
|
|
TableColumn<Boat, String> boatNameColumn;
|
|
|
|
@FXML
|
|
Label raceWinnerLabel;
|
|
|
|
/**
|
|
* Sets up the finish table
|
|
* @param boats Boats to display
|
|
*/
|
|
private void setFinishTable(ObservableList<Boat> boats){
|
|
boatInfoTable.setItems(boats);
|
|
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().getName());
|
|
boatRankColumn.setCellValueFactory(cellData -> cellData.getValue().positionProperty());
|
|
|
|
raceWinnerLabel.setText("Winner: "+ boatNameColumn.getCellObservableValue(0).getValue());
|
|
raceWinnerLabel.setWrapText(true);
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
public void initialize(URL location, ResourceBundle resources){
|
|
}
|
|
|
|
/**
|
|
* Display the table
|
|
* @param boats boats to display on the table.
|
|
*/
|
|
public void enterFinish(ObservableList<Boat> boats){
|
|
finishWrapper.setVisible(true);
|
|
setFinishTable(boats);
|
|
}
|
|
|
|
}
|