Merge pull request #36 from PM2-IT21bWIN-ruiz-mach-krea/SpecialCharacterUsername
Special character username
This commit is contained in:
commit
4a998b0f61
|
@ -106,6 +106,7 @@ public class ChatWindowController {
|
|||
|
||||
private void startConnectionHandler() throws IOException {
|
||||
String userName = userNameField.getText();
|
||||
if(!userName.contains(" ")) {
|
||||
String serverAddress = serverAddressField.getText();
|
||||
int serverPort = Integer.parseInt(serverPortField.getText());
|
||||
connectionHandler = new ClientConnectionHandler(
|
||||
|
@ -118,6 +119,9 @@ public class ChatWindowController {
|
|||
|
||||
// register window close handler
|
||||
rootPane.getScene().getWindow().addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, windowCloseHandler);
|
||||
} else {
|
||||
addError("It is not allowed to have spaces in username!");
|
||||
}
|
||||
}
|
||||
|
||||
private void terminateConnectionHandler() {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ClientConnectionHandler implements Runnable {
|
|||
public static final String USER_NONE = "";
|
||||
public static final String USER_ALL = "*";
|
||||
|
||||
private final Pattern messagePattern = Pattern.compile( "^(?:@(\\w*))?\\s*(.*)$" );
|
||||
private final Pattern messagePattern = Pattern.compile( "^(?:@(\\S*))?\\s*(.*)$" );
|
||||
|
||||
private SimpleStringProperty userName;
|
||||
private SimpleObjectProperty<State> state;
|
||||
|
@ -63,7 +63,6 @@ public class ClientConnectionHandler implements Runnable {
|
|||
|
||||
public void setState (State newState) {
|
||||
state.set(newState);
|
||||
|
||||
}
|
||||
|
||||
public void run () {
|
||||
|
|
Loading…
Reference in New Issue