clean up
This commit is contained in:
Andrin Fassbind
2022-04-16 22:09:56 +02:00
parent a189fedd76
commit 40e3e14666
7 changed files with 15 additions and 18 deletions
@@ -242,7 +242,6 @@ public class ChatWindowController {
class WindowCloseHandler implements EventHandler<WindowEvent> {
/**
*
* @param event the event which occurred when Windows is closed
*/
public void handle(WindowEvent event) {
@@ -50,8 +50,8 @@ public class ClientConnectionHandler extends ConnectionHandler implements Runnab
* Called to initialize the ClientConnectionHandler when trying to start a connection
*
* @param serverAddress to connect to
* @param serverPort to connect to
* @param userName to connect as
* @param serverPort to connect to
* @param userName to connect as
* @throws IOException if connection to Server not possible
*/
public void initialize(String serverAddress, int serverPort, String userName) throws IOException {
@@ -214,6 +214,7 @@ public class ClientConnectionHandler extends ConnectionHandler implements Runnab
/**
* Initiates the procedure to send a new message and sends one as such.
*
* @param data Data which has been transmitted
*/
private void caseMessage(Message data) {
@@ -17,6 +17,7 @@ public class ClientMessageList {
/**
* Adds a new message to ArrayList and also informs Listener.
*
* @param message that should be added
*/
public void addMessage(Message message) {
@@ -37,12 +38,10 @@ public class ClientMessageList {
for (Message message : messages) {
if (showAll || message.matchesFilter(filter)) {
switch (message.getType()) {
case DATA_TYPE_MESSAGE ->
result.append(String.format("[%s -> %s] %s\n", message.getSender(), message.getReceiver(), message.getText()));
case DATA_TYPE_MESSAGE -> result.append(String.format("[%s -> %s] %s\n", message.getSender(), message.getReceiver(), message.getText()));
case DATA_TYPE_ERROR -> result.append(String.format("[ERROR] %s\n", message.getText()));
case DATA_TYPE_CONFIRM, DATA_TYPE_DISCONNECT, DATA_TYPE_CONNECT -> result.append(String.format("[INFO] %s\n", message.getText()));
default ->
result.append(String.format("[ERROR] %s\n", "Unexpected message type: " + message.getType()));
default -> result.append(String.format("[ERROR] %s\n", "Unexpected message type: " + message.getType()));
}
}
}