diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java
index d5e2e2a..fa680ba 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java
@@ -38,4 +38,8 @@ public class ClientApp {
LOGGER.info("You've selected the client. It will connect port {} at host {}", port, host);
Launcher.main(new String[] {});
}
+
+ public static void main(String[] args) {
+ start(args[0]);
+ }
}
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/ChatController.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/ChatController.java
index 71ae97b..c3a809f 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/ChatController.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/ChatController.java
@@ -25,6 +25,10 @@ public class ChatController {
chatClient = new ChatClient(clientService);
}
+ public ChatModel getChatModel(int index) {
+ return chatModelArrayList.get(index);
+ }
+
public void createLobbyChat(int lobbyId, ChatType chatType) {
ChatModel chatModel = new ChatModel(chatType, username, lobbyId);
chatModelArrayList.add(chatModel);
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/ChatViewController.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/ChatViewController.java
index 5d7683e..17d07ec 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/ChatViewController.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/ChatViewController.java
@@ -3,18 +3,23 @@ package ch.unibas.dmi.dbis.cs108.casono.client.ui.chatui;
import ch.unibas.dmi.dbis.cs108.casono.client.chat.ChatController;
import ch.unibas.dmi.dbis.cs108.casono.client.chat.ChatModel;
import ch.unibas.dmi.dbis.cs108.casono.client.chat.ChatType;
+
+import java.net.URL;
+import java.util.ResourceBundle;
import java.util.Timer;
import java.util.TimerTask;
import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.VBox;
/** Responsible for the presentation of the ChatModel to the Client */
-public class ChatViewController {
+public class ChatViewController implements Initializable {
- private final GlobalChatView globalChatView;
+ private final ChatModel globalChatModel;
+ private GlobalChatView globalChatView;
private LobbyChatView lobbyChatView;
@@ -26,10 +31,6 @@ public class ChatViewController {
private Boolean lobbyActivated;
- @FXML private VBox whisperChatVBox;
-
- @FXML private VBox whisperChat;
-
@FXML private ToggleButton changeGlobalChatButton;
@FXML private ToggleButton changeLobbyChatButton;
@@ -50,9 +51,8 @@ public class ChatViewController {
String username, ChatModel globalChatModel, ChatController controller) {
this.username = username;
this.controller = controller;
- this.globalChatView =
- new GlobalChatView(username, new ChatModel(ChatType.GLOBAL, username), controller);
this.timer = new Timer();
+ this.globalChatModel = globalChatModel;
timer.schedule(
new TimerTask() {
@Override
@@ -69,10 +69,14 @@ public class ChatViewController {
REFRESH_TIME);
}
- @FXML
- public void initialize() {}
+
+ @Override
+ public void initialize(URL location, ResourceBundle resourceBundle) {
+ this.globalChatView =
+ new GlobalChatView(username, globalChatModel, controller);
+
+ }
- @FXML
public void setLobbyChat(int lobbyId) {
this.lobbyChatView =
new LobbyChatView(
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/GlobalChatView.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/GlobalChatView.java
index 5483de1..dab5782 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/GlobalChatView.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/GlobalChatView.java
@@ -4,6 +4,8 @@ import ch.unibas.dmi.dbis.cs108.casono.client.chat.ChatController;
import ch.unibas.dmi.dbis.cs108.casono.client.chat.ChatModel;
import ch.unibas.dmi.dbis.cs108.casono.client.chat.ChatType;
import ch.unibas.dmi.dbis.cs108.casono.client.chat.Message;
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.property.SimpleBooleanProperty;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
@@ -28,6 +30,8 @@ public class GlobalChatView {
@FXML private ScrollPane globalChatScrollPane;
+ final BooleanProperty isContentVisible = new SimpleBooleanProperty(true);
+
private static final int CHAT_PADDING = 20;
public GlobalChatView(String username, ChatModel globalChatModel, ChatController controller) {
@@ -36,11 +40,11 @@ public class GlobalChatView {
this.globalChatModel = globalChatModel;
}
- @FXML
public void initialize() {
globalChatInputField.setOnAction(event -> sendGlobalMessage());
globalChatSendButton.setOnAction(event -> sendGlobalMessage());
globalChatScrollPane.vvalueProperty().bind(globalChatVBox.heightProperty());
+ globalChatVBox.visibleProperty().bind(isContentVisible);
}
public void sendGlobalMessage() {
@@ -48,7 +52,7 @@ public class GlobalChatView {
if (!message.isEmpty()) {
globalChatInputField.clear();
Message msg = new Message(ChatType.GLOBAL, 0, username, null, message);
- controller.sendMessageToNetwork(msg);
+ controller.onSendToNetwork(msg);
}
}
@@ -64,6 +68,6 @@ public class GlobalChatView {
}
public void setVisibility(Boolean bool) {
- globalChatVBox.setVisible(bool);
+ this.isContentVisible.set(bool);
}
}
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/LobbyChatView.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/LobbyChatView.java
index 21d7097..7163d9d 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/LobbyChatView.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/chatui/LobbyChatView.java
@@ -51,7 +51,7 @@ public class LobbyChatView {
if (!message.isEmpty()) {
lobbyChatInputField.clear();
Message msg = new Message(ChatType.LOBBY, lobbyId, username, null, message);
- controller.sendMessageToNetwork(msg);
+ controller.onSendToNetwork(msg);
}
}
diff --git a/src/main/resources/ui-structure/Casinomainui.fxml b/src/main/resources/ui-structure/Casinomainui.fxml
index 7cae21e..1ec9a0f 100644
--- a/src/main/resources/ui-structure/Casinomainui.fxml
+++ b/src/main/resources/ui-structure/Casinomainui.fxml
@@ -106,7 +106,7 @@
-
+
diff --git a/src/main/resources/ui-structure/components/chatui/chatbox.fxml b/src/main/resources/ui-structure/components/chatui/chatbox.fxml
index d58b480..e090466 100644
--- a/src/main/resources/ui-structure/components/chatui/chatbox.fxml
+++ b/src/main/resources/ui-structure/components/chatui/chatbox.fxml
@@ -14,10 +14,10 @@
- Globaler Chat (Gesamter Server)
Features, die später implementiert werden sollen:
- - Schicke Chat-Bubbles mit Namen und Uhrzeit.
+ - Schicke Chat-Bubbles mit Namen und Uhrzeit./home/mathis/dev/Gruppe-13/src/main/resources/ui-structure/gameuicomponents/chatui
-->
-
-
-
+
-
+
-
+
-
-
- ...
-
-
-
-
-
-
-
+
+
+ ...
+
+
+
+
+
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/main/resources/ui-structure/components/chatui/globalchat.fxml b/src/main/resources/ui-structure/components/chatui/globalchat.fxml
index 73c2325..906855b 100644
--- a/src/main/resources/ui-structure/components/chatui/globalchat.fxml
+++ b/src/main/resources/ui-structure/components/chatui/globalchat.fxml
@@ -7,7 +7,9 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/main/resources/ui-structure/components/chatui/lobbychat.fxml b/src/main/resources/ui-structure/components/chatui/lobbychat.fxml
index 7bbe557..3488296 100644
--- a/src/main/resources/ui-structure/components/chatui/lobbychat.fxml
+++ b/src/main/resources/ui-structure/components/chatui/lobbychat.fxml
@@ -8,7 +8,9 @@
-
-