From 7fffa0da8307d15a34d412fa9ddcb2eb28a575a1 Mon Sep 17 00:00:00 2001 From: DieGurke Date: Wed, 30 Sep 2020 21:44:02 +0200 Subject: [PATCH] implemented basic architecture --- .../client/ui/control/QuickSelectControl.java | 21 +++++++++++++++++++ .../ui/controller/GroupCreationTab.java | 10 +++++++-- client/src/main/resources/css/dark.css | 4 ++++ .../main/resources/fxml/GroupCreationTab.fxml | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 client/src/main/java/envoy/client/ui/control/QuickSelectControl.java diff --git a/client/src/main/java/envoy/client/ui/control/QuickSelectControl.java b/client/src/main/java/envoy/client/ui/control/QuickSelectControl.java new file mode 100644 index 0000000..d7e7bfe --- /dev/null +++ b/client/src/main/java/envoy/client/ui/control/QuickSelectControl.java @@ -0,0 +1,21 @@ +package envoy.client.ui.control; + +import javafx.scene.control.Label; + +import envoy.data.User; + +/** + * @author Maximilian Käfer + * @since Envoy Client v0.3-beta + */ +public class QuickSelectControl extends Label { + + public QuickSelectControl(User user) { + setPrefSize(35, 35); + setMaxSize(35, 35); + setMinSize(35, 35); + setText(user.getName()); + getStyleClass().add("quick-select"); + } + +} 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 4243ce4..7970c5d 100644 --- a/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java +++ b/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java @@ -11,7 +11,7 @@ import javafx.scene.layout.HBox; import envoy.client.data.*; import envoy.client.event.BackEvent; -import envoy.client.ui.control.ContactControl; +import envoy.client.ui.control.*; import envoy.client.ui.listcell.ListCellFactory; import envoy.data.*; import envoy.event.GroupCreation; @@ -58,6 +58,9 @@ public class GroupCreationTab implements EventListener { @FXML private HBox errorProceedBox; + @FXML + private ListView quickSelectList; + private String name; private final LocalDB localDB = Context.getInstance().getLocalDB(); @@ -86,7 +89,10 @@ public class GroupCreationTab implements EventListener { * @since Envoy Client v0.1-beta */ @FXML - private void userListClicked() { createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); } + private void userListClicked() { + createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); + quickSelectList.getItems().add(new QuickSelectControl(userList.getSelectionModel().getSelectedItem())); + } /** * Checks, whether the {@code createButton} can be enabled because text is diff --git a/client/src/main/resources/css/dark.css b/client/src/main/resources/css/dark.css index 7ab6a59..df7527a 100644 --- a/client/src/main/resources/css/dark.css +++ b/client/src/main/resources/css/dark.css @@ -83,3 +83,7 @@ -fx-text-fill: white; -fx-background-color: transparent; } + +.quick-select { + -fx-background-color: black; +} diff --git a/client/src/main/resources/fxml/GroupCreationTab.fxml b/client/src/main/resources/fxml/GroupCreationTab.fxml index cb4dbad..f954324 100644 --- a/client/src/main/resources/fxml/GroupCreationTab.fxml +++ b/client/src/main/resources/fxml/GroupCreationTab.fxml @@ -64,6 +64,7 @@ +