From 0cd53a8a0a4a3ece5663fb6fdc2a95206e17ee62 Mon Sep 17 00:00:00 2001 From: DieGurke Date: Sat, 22 Aug 2020 21:02:49 +0200 Subject: [PATCH] Implemented TabPane and done preparation for internal file loading --- .../java/envoy/client/ui/SceneContext.java | 17 +-- .../envoy/client/ui/controller/ChatScene.java | 18 ++- client/src/main/resources/fxml/ChatScene.fxml | 141 ++++++++++-------- client/src/main/resources/fxml/Test.fxml | 10 ++ 4 files changed, 109 insertions(+), 77 deletions(-) create mode 100644 client/src/main/resources/fxml/Test.fxml diff --git a/client/src/main/java/envoy/client/ui/SceneContext.java b/client/src/main/java/envoy/client/ui/SceneContext.java index a7ab403..c221d36 100644 --- a/client/src/main/java/envoy/client/ui/SceneContext.java +++ b/client/src/main/java/envoy/client/ui/SceneContext.java @@ -1,6 +1,7 @@ package envoy.client.ui; import java.io.IOException; +import java.net.URL; import java.util.Stack; import java.util.logging.Level; @@ -54,13 +55,6 @@ public final class SceneContext { */ SETTINGS_SCENE("/fxml/SettingsScene.fxml"), - /** - * The scene in which the contact search screen is displayed. - * - * @since Envoy Client v0.1-beta - */ - CONTACT_SEARCH_SCENE("/fxml/ContactSearchScene.fxml"), - /** * The scene in which the group creation screen is displayed. * @@ -73,14 +67,7 @@ public final class SceneContext { * * @since Envoy Client v0.1-beta */ - LOGIN_SCENE("/fxml/LoginScene.fxml"), - - /** - * The scene in which the info screen is displayed. - * - * @since Envoy Client v0.1-beta - */ - MESSAGE_INFO_SCENE("/fxml/MessageInfoScene.fxml"); + LOGIN_SCENE("/fxml/LoginScene.fxml"); /** * The path to the FXML resource. diff --git a/client/src/main/java/envoy/client/ui/controller/ChatScene.java b/client/src/main/java/envoy/client/ui/controller/ChatScene.java index 707803c..62bd6bf 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -7,6 +7,7 @@ import java.awt.datatransfer.StringSelection; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; +import java.net.URL; import java.nio.file.Files; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -20,6 +21,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; import javafx.scene.control.*; import javafx.scene.control.Alert.AlertType; import javafx.scene.image.Image; @@ -123,6 +125,9 @@ public final class ChatScene implements Restorable { @FXML private VBox contactOperations; + + @FXML + private TabPane tabPane; private LocalDB localDB; private Client client; @@ -171,6 +176,15 @@ public final class ChatScene implements Restorable { clip.setArcHeight(43); clip.setArcWidth(43); clientProfilePic.setClip(clip); + +// FXMLLoader loader = new FXMLLoader(); +// +// try { +// URL url = new File("src/main/resources/fxml/Test.fxml").toURI().toURL(); +// contactOperations.getChildren().add(0, loader.load(url)); +// } catch (Exception e2) { +// e2.printStackTrace(); +// } // Listen to received messages eventBus.register(MessageCreationEvent.class, e -> { @@ -377,8 +391,8 @@ public final class ChatScene implements Restorable { */ @FXML private void addContactButtonClicked() { - sceneContext.load(SceneContext.SceneInfo.CONTACT_SEARCH_SCENE); - sceneContext.getController().initializeData(sceneContext, localDB); +// sceneContext.load(SceneContext.SceneInfo.CONTACT_SEARCH_SCENE); +// sceneContext.getController().initializeData(sceneContext, localDB); } @FXML diff --git a/client/src/main/resources/fxml/ChatScene.fxml b/client/src/main/resources/fxml/ChatScene.fxml index 99afa30..cae6396 100644 --- a/client/src/main/resources/fxml/ChatScene.fxml +++ b/client/src/main/resources/fxml/ChatScene.fxml @@ -7,9 +7,12 @@ + + + @@ -30,69 +33,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/client/src/main/resources/fxml/Test.fxml b/client/src/main/resources/fxml/Test.fxml new file mode 100644 index 0000000..6ad0119 --- /dev/null +++ b/client/src/main/resources/fxml/Test.fxml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file