This commit is contained in:
schrom01 2022-04-15 15:34:03 +02:00 committed by Leonardo Brandenberger
parent 5f6266c017
commit 46b0e4386a
1 changed files with 20 additions and 33 deletions

View File

@ -17,33 +17,28 @@ import java.io.IOException;
import static ch.zhaw.pm2.multichat.protocol.ConnectionHandler.State.*; import static ch.zhaw.pm2.multichat.protocol.ConnectionHandler.State.*;
public class ChatWindowController { public class ChatWindowController {
private ClientConnectionHandler connectionHandler; private ClientConnectionHandler connectionHandler;
private ClientMessageList messages; private ClientMessageList messages;
private final WindowCloseHandler windowCloseHandler = new WindowCloseHandler(); private final WindowCloseHandler windowCloseHandler = new WindowCloseHandler();
@FXML @FXML private Pane rootPane;
private Pane rootPane; @FXML private TextField serverAddressField;
@FXML @FXML private TextField serverPortField;
private TextField serverAddressField; @FXML private TextField userNameField;
@FXML @FXML private TextField messageField;
private TextField serverPortField; @FXML private TextArea messageArea;
@FXML @FXML private Button connectButton;
private TextField userNameField; @FXML private Button sendButton;
@FXML @FXML private TextField filterValue;
private TextField messageField;
@FXML
private TextArea messageArea;
@FXML
private Button connectButton;
@FXML
private Button sendButton;
@FXML
private TextField filterValue;
@FXML
public void initialize() {
}
public void setMessages(ClientMessageList messages) { public void setMessages(ClientMessageList messages) {
this.messages = messages; this.messages = messages;
messageListener(); messageListener();
@ -69,7 +64,6 @@ public class ChatWindowController {
} }
} }
private void connect() { private void connect() {
try { try {
messages.clear(); // clear message list messages.clear(); // clear message list
@ -80,9 +74,6 @@ public class ChatWindowController {
} }
} }
/**
* Initiates disconnecting of the connectionHandler, also checks if connectionHandler is avaible.
*/
private void disconnect() { private void disconnect() {
if (connectionHandler == null) { if (connectionHandler == null) {
addError("No connection handler"); addError("No connection handler");
@ -95,9 +86,6 @@ public class ChatWindowController {
} }
} }
/**
*
*/
@FXML @FXML
private void message() { private void message() {
String messageString = messageField.getText().strip(); String messageString = messageField.getText().strip();
@ -217,7 +205,6 @@ public class ChatWindowController {
}); });
} }
private void messageListener() { private void messageListener() {
messages.getChangedProperty().addListener(new ChangeListener<Boolean>() { messages.getChangedProperty().addListener(new ChangeListener<Boolean>() {
@Override @Override