Add proper layout to ChatWindow, fix user field selection in LoginDialog

This commit is contained in:
2020-06-06 10:19:33 +02:00
parent fa42516c6f
commit ca9b72b1de
6 changed files with 399 additions and 69 deletions

View File

@ -61,8 +61,8 @@ public final class LoginDialog extends Dialog<Void> {
*
* @param client the client used to perform the handshake
* @param localDB the local database used for offline login
* @param receivedMessageCache the cache storing messages received during the
* handshake
* @param receivedMessageCache the cache storing messages received during
* the handshake
* @throws IOException if an exception occurs during loading
* @since Envoy Client v0.1-beta
*/
@ -99,6 +99,9 @@ public final class LoginDialog extends Dialog<Void> {
setOnShown(e -> { if (config.hasLoginCredentials()) performHandshake(config.getLoginCredentials()); });
setDialogPane(dialogPane);
// Set initial cursor
Platform.runLater(userTextField::requestFocus);
}
@FXML
@ -107,9 +110,6 @@ public final class LoginDialog extends Dialog<Void> {
// Show an alert after an unsuccessful handshake
eventBus.register(HandshakeRejectionEvent.class,
e -> Platform.runLater(() -> { clearPasswordFields(); new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
// Set initial cursor
userTextField.requestFocus();
}
@FXML
@ -144,7 +144,8 @@ public final class LoginDialog extends Dialog<Void> {
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
client.setSender(clientUser);
Platform.runLater(() -> {
new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.\n" + e)
new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.\n"
+ e)
.showAndWait();
hide();
});