From d0f125f0583a03bd64a6f4479dc93e9ad1b8fcf9 Mon Sep 17 00:00:00 2001 From: DieGurke Date: Sun, 23 Aug 2020 12:36:43 +0200 Subject: [PATCH] ContactSearchTab UI finished and reimplemented controller --- ...SearchScene.java => ContactSearchTab.java} | 28 ++++---- .../resources/fxml/ContactSearchScene.fxml | 2 +- .../main/resources/fxml/ContactSearchTab.fxml | 68 ++++++++++++++++--- 3 files changed, 74 insertions(+), 24 deletions(-) rename client/src/main/java/envoy/client/ui/controller/{ContactSearchScene.java => ContactSearchTab.java} (86%) diff --git a/client/src/main/java/envoy/client/ui/controller/ContactSearchScene.java b/client/src/main/java/envoy/client/ui/controller/ContactSearchTab.java similarity index 86% rename from client/src/main/java/envoy/client/ui/controller/ContactSearchScene.java rename to client/src/main/java/envoy/client/ui/controller/ContactSearchTab.java index 3e6071a..7d5f8b1 100644 --- a/client/src/main/java/envoy/client/ui/controller/ContactSearchScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ContactSearchTab.java @@ -6,10 +6,8 @@ import java.util.logging.Logger; import javafx.application.Platform; import javafx.fxml.FXML; -import javafx.scene.control.Alert; +import javafx.scene.control.*; import javafx.scene.control.Alert.AlertType; -import javafx.scene.control.ButtonType; -import javafx.scene.control.ListView; import envoy.client.data.LocalDB; import envoy.client.event.SendEvent; @@ -40,12 +38,13 @@ import envoy.util.EnvoyLog; * Created: 07.06.2020
* * @author Leon Hofmeister + * @author Maximilian Käfer * @since Envoy Client v0.1-beta */ -public class ContactSearchScene { +public class ContactSearchTab { @FXML - private ClearableTextField searchBar; + private TextArea searchBar; @FXML private ListView userList; @@ -82,7 +81,6 @@ public class ContactSearchScene { @FXML private void initialize() { userList.setCellFactory(new ListCellFactory<>(ContactControl::new)); - searchBar.setClearButtonListener(e -> { searchBar.getTextField().clear(); userList.getItems().clear(); }); eventBus.register(UserSearchResult.class, response -> Platform.runLater(() -> { userList.getItems().clear(); userList.getItems().addAll(response.get()); })); eventBus.register(ContactOperation.class, handler); @@ -95,7 +93,7 @@ public class ContactSearchScene { */ @FXML private void sendRequest() { - final var text = searchBar.getTextField().getText().strip(); + final var text = searchBar.getText().strip(); if (!text.isBlank()) eventBus.dispatch(new SendEvent(new UserSearchRequest(text))); else userList.getItems().clear(); } @@ -108,7 +106,7 @@ public class ContactSearchScene { */ @FXML private void clear() { - searchBar.getTextField().setText(null); + searchBar.setText(null); userList.getItems().clear(); } @@ -141,12 +139,12 @@ public class ContactSearchScene { } } - @FXML - private void newGroupButtonClicked() { - sceneContext.load(SceneContext.SceneInfo.GROUP_CREATION_SCENE); - sceneContext.getController().initializeData(sceneContext, localDB); - } +// @FXML +// private void newGroupButtonClicked() { +// sceneContext.load(SceneContext.SceneInfo.GROUP_CREATION_SCENE); +// sceneContext.getController().initializeData(sceneContext, localDB); +// } - @FXML - private void backButtonClicked() { sceneContext.pop(); } +// @FXML +// private void backButtonClicked() { sceneContext.pop(); } } diff --git a/client/src/main/resources/fxml/ContactSearchScene.fxml b/client/src/main/resources/fxml/ContactSearchScene.fxml index 70f5fe5..cbc758f 100644 --- a/client/src/main/resources/fxml/ContactSearchScene.fxml +++ b/client/src/main/resources/fxml/ContactSearchScene.fxml @@ -12,7 +12,7 @@ minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="envoy.client.ui.controller.ContactSearchScene"> + fx:controller="envoy.client.ui.controller.ContactSearchTab"> diff --git a/client/src/main/resources/fxml/ContactSearchTab.fxml b/client/src/main/resources/fxml/ContactSearchTab.fxml index f4c0730..4544a28 100644 --- a/client/src/main/resources/fxml/ContactSearchTab.fxml +++ b/client/src/main/resources/fxml/ContactSearchTab.fxml @@ -1,11 +1,63 @@ - - - - - + + + + + + + + + + + - -