Made chat history transparent.

#story[1246]
This commit is contained in:
Kusal Ekanayake
2017-09-07 17:02:42 +12:00
parent 0b61dffe71
commit 3364f8b516
5 changed files with 17 additions and 8 deletions
@@ -105,6 +105,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
private Timer timer = new Timer(); private Timer timer = new Timer();
private List<Series<String, Double>> sparkLineData = new ArrayList<>(); private List<Series<String, Double>> sparkLineData = new ArrayList<>();
private ImportantAnnotationsState importantAnnotations; private ImportantAnnotationsState importantAnnotations;
private boolean done = false;
public void initialize() { public void initialize() {
Sounds.stopMusic(); Sounds.stopMusic();
@@ -140,6 +141,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
// chatHistory.textProperty().addListener((obs, oldValue, newValue) -> { // chatHistory.textProperty().addListener((obs, oldValue, newValue) -> {
// chatHistory.setScrollTop(Double.MAX_VALUE); // chatHistory.setScrollTop(Double.MAX_VALUE);
// }); // });
done = true;
} }
public void loadRace ( public void loadRace (
@@ -574,9 +577,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
* for the combobox to take action upon selection * for the combobox to take action upon selection
*/ */
private void initialiseBoatSelectionComboBox() { private void initialiseBoatSelectionComboBox() {
yachtSelectionComboBox.setItems( ObservableList<ClientYacht> selectables = FXCollections.observableArrayList(participants.values());
FXCollections.observableArrayList(participants.values()) yachtSelectionComboBox.setItems(selectables);
);
yachtSelectionComboBox.valueProperty().addListener((obs, lastSelection, selectedBoat) -> { yachtSelectionComboBox.valueProperty().addListener((obs, lastSelection, selectedBoat) -> {
if (selectedBoat != null) { if (selectedBoat != null) {
gameView.selectBoat(selectedBoat); gameView.selectBoat(selectedBoat);
@@ -4,6 +4,8 @@ import java.util.Arrays;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane;
import javafx.scene.layout.Background;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint; import javafx.scene.paint.Paint;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.scene.text.TextFlow; import javafx.scene.text.TextFlow;
@@ -22,8 +24,13 @@ public class ChatHistory extends ScrollPane {
this.setFitToHeight(true); this.setFitToHeight(true);
this.setMaxHeight(Double.MAX_VALUE); this.setMaxHeight(Double.MAX_VALUE);
this.setMaxWidth(Double.MAX_VALUE); this.setMaxWidth(Double.MAX_VALUE);
this.setVbarPolicy(ScrollBarPolicy.ALWAYS); this.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
this.setHbarPolicy(ScrollBarPolicy.NEVER); this.setHbarPolicy(ScrollBarPolicy.NEVER);
this.lookup(".scroll-pane").setStyle("-fx-background: rgba(255, 255, 255, 0.1); -fx-background-color: rgba(255, 255, 255, 0.1);");
this.textFlow.setStyle(
"-fx-background: rgba(255, 255, 255, 0.1); -fx-background-color: rgba(255, 255, 255, 0.1);"
);
//This makes the window auto scroll. //This makes the window auto scroll.
textFlow.getChildren().addListener((ListChangeListener<Node>) c -> textFlow.getChildren().addListener((ListChangeListener<Node>) c ->
this.setVvalue(1.0) this.setVvalue(1.0)
+1 -1
View File
@@ -23,7 +23,7 @@
<children> <children>
<AnchorPane fx:id="contentAnchorPane" prefHeight="200.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.rowSpan="2"> <AnchorPane fx:id="contentAnchorPane" prefHeight="200.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.rowSpan="2">
<children> <children>
<AnchorPane layoutX="799.0" layoutY="770.0" prefHeight="214.0" prefWidth="468.0"> <AnchorPane layoutX="799.0" layoutY="702.0" prefHeight="214.0" prefWidth="468.0">
<children> <children>
<VBox prefHeight="214.0" prefWidth="468.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <VBox prefHeight="214.0" prefWidth="468.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
+1 -1
View File
@@ -1,5 +1,5 @@
Feature: SendChat Feature: SendChat
Scenario: User send chat to another client Scenario: User send chat to another client
Given There are two games running Given There are two games running
When the user has pressed sends the message "Hello world" in a text box When the first client has sent the message "Hello world"
Then the other client should receive the message "Hello world" Then the other client should receive the message "Hello world"
+1 -1
View File
@@ -42,7 +42,7 @@ public class SendChatSteps {
} }
@When("^the user has pressed sends the message \"([^\"]*)\" in a text box$") @When("^the first client has sent the message \"([^\"]*)\"$")
public void the_user_has_pressed_sends_the_message_in_a_text_box(String arg1) throws Throwable { public void the_user_has_pressed_sends_the_message_in_a_text_box(String arg1) throws Throwable {
client.sendChatterMessage("[time_prefix] <name_prefix> " + arg1); client.sendChatterMessage("[time_prefix] <name_prefix> " + arg1);
} }