From 49cc98b4f19b0c8aff7d2886e16b7d3e88560c82 Mon Sep 17 00:00:00 2001 From: DieGurke Date: Sun, 23 Aug 2020 20:59:25 +0200 Subject: [PATCH] Fixed createButton disabling bug --- .../java/envoy/client/ui/controller/GroupCreationTab.java | 5 ++++- client/src/main/resources/fxml/GroupCreationTab.fxml | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java b/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java index 0d6bdf5..f8d7259 100644 --- a/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java +++ b/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java @@ -61,7 +61,9 @@ public class GroupCreationTab { userList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); eventBus.register(LoadGroupCreationEvent.class, e -> { + createButton.setDisable(true); this.localDB = e.get(); + userList.getItems().clear(); Platform.runLater(() -> userList.getItems() .addAll(localDB.getChats() .stream() @@ -90,7 +92,7 @@ public class GroupCreationTab { * @since Envoy Client v0.1-beta */ @FXML - private void textUpdated() { createButton.setDisable(groupNameField.getText().isBlank()); } + private void textUpdated() { createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); } /** * Sends a {@link GroupCreation} to the server and closes this scene. @@ -114,6 +116,7 @@ public class GroupCreationTab { new Alert(AlertType.INFORMATION, String.format("Group '%s' successfully created.", name)).showAndWait(); createGroup(name); } + eventBus.dispatch(new BackEvent()); } /** diff --git a/client/src/main/resources/fxml/GroupCreationTab.fxml b/client/src/main/resources/fxml/GroupCreationTab.fxml index 5b56bee..68da2dd 100644 --- a/client/src/main/resources/fxml/GroupCreationTab.fxml +++ b/client/src/main/resources/fxml/GroupCreationTab.fxml @@ -49,6 +49,14 @@ +