From faefcc793859b5453c40723a5258c37e9e26ef4b Mon Sep 17 00:00:00 2001 From: Calum Date: Sat, 9 Sep 2017 13:03:55 +1200 Subject: [PATCH] Fixed bug with initializing race view elements. Made chat box unselectable. Only manually tested. #bugs #test #implement --- .../controllers/RaceViewController.java | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/main/java/seng302/visualiser/controllers/RaceViewController.java b/src/main/java/seng302/visualiser/controllers/RaceViewController.java index 2ac1f201..7103fc93 100644 --- a/src/main/java/seng302/visualiser/controllers/RaceViewController.java +++ b/src/main/java/seng302/visualiser/controllers/RaceViewController.java @@ -105,7 +105,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel private Timer timer = new Timer(); private List> sparkLineData = new ArrayList<>(); private ImportantAnnotationsState importantAnnotations; - private boolean done = false; + private ObservableList selectionComboBoxList = FXCollections.observableArrayList(); public void initialize() { Sounds.stopMusic(); @@ -114,9 +114,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel importantAnnotations = new ImportantAnnotationsState(); //Formatting the y axis of the sparkline -// raceSparkLine.getYAxis().setRotate(180); -// raceSparkLine.getYAxis().setTickLabelRotation(180); -// raceSparkLine.getYAxis().setTranslateX(-5); + raceSparkLine.getYAxis().setRotate(180); + raceSparkLine.getYAxis().setTickLabelRotation(180); + raceSparkLine.getYAxis().setTranslateX(-5); raceSparkLine.visibleProperty().setValue(false); raceSparkLine.getYAxis().setAutoRanging(false); sparklineYAxis.setTickMarkVisible(false); @@ -141,8 +141,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel // chatHistory.textProperty().addListener((obs, oldValue, newValue) -> { // chatHistory.setScrollTop(Double.MAX_VALUE); // }); - done = true; - + contentAnchorPane.setOnMouseClicked((event) -> + contentAnchorPane.requestFocus() + ); } public void loadRace ( @@ -193,12 +194,13 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel gameView.enableZoom(); } }); - - initializeUpdateTimer(); - initialiseFPSCheckBox(); - initialiseAnnotationSlider(); - initialiseBoatSelectionComboBox(); - initialiseSparkLine(); + Platform.runLater(() -> { + initializeUpdateTimer(); + initialiseFPSCheckBox(); + initialiseAnnotationSlider(); + initialiseBoatSelectionComboBox(); + initialiseSparkLine(); + }); } /** @@ -349,13 +351,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel ) ); } -// XYChart.Series positionData = sparkLineData.get(yacht.getSourceID()); -// positionData.getData().add( -// new XYChart.Data<>( -// Integer.toString(legNumber), -// 1.0 + participants.size() - yacht.getPlacing() -// ) -// ); } @@ -577,8 +572,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel * for the combobox to take action upon selection */ private void initialiseBoatSelectionComboBox() { - ObservableList selectables = FXCollections.observableArrayList(participants.values()); - yachtSelectionComboBox.setItems(selectables); + selectionComboBoxList.setAll(participants.values()); + yachtSelectionComboBox.setItems(selectionComboBoxList); yachtSelectionComboBox.valueProperty().addListener((obs, lastSelection, selectedBoat) -> { if (selectedBoat != null) { gameView.selectBoat(selectedBoat);