Created finish view to see when a race finishes.

-Implemented FinishController
-Fixed mock not sending Finish race status.

#Story[782]
This commit is contained in:
David Wu
2017-05-06 20:14:10 +12:00
parent a95a0c2543
commit 61afe8d608
10 changed files with 180 additions and 22 deletions
@@ -0,0 +1,64 @@
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 seng302.Model.Race;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by zwu18 on 6/05/17.
*/
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;
public 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){
}
public void enterFinish(ObservableList<Boat> boats){
finishWrapper.setVisible(true);
setFinishTable(boats);
}
}