From 74025c61113677eba995b56fd027a8e5c79786ab Mon Sep 17 00:00:00 2001 From: DieGurke Date: Sun, 30 Aug 2020 15:33:19 +0200 Subject: [PATCH] Added Tabs Constant --- .../envoy/client/ui/controller/ChatScene.java | 7 ++++--- client/src/main/java/envoy/constant/Tabs.java | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 client/src/main/java/envoy/constant/Tabs.java 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 4a77fd6..fb3f959 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -45,6 +45,7 @@ import envoy.client.net.WriteProxy; import envoy.client.ui.*; import envoy.client.ui.listcell.*; import envoy.client.util.ReflectionUtil; +import envoy.constant.Tabs; import envoy.data.*; import envoy.data.Attachment.AttachmentType; import envoy.event.*; @@ -193,7 +194,7 @@ public final class ChatScene implements Restorable { }); //Listen to backEvents - eventBus.register(BackEvent.class, e -> tabPane.getSelectionModel().select(0)); + eventBus.register(BackEvent.class, e -> tabPane.getSelectionModel().select(Tabs.CONTANCT_LIST)); // Listen to received messages eventBus.register(MessageCreationEvent.class, e -> { @@ -416,13 +417,13 @@ public final class ChatScene implements Restorable { */ @FXML private void addContactButtonClicked() { - tabPane.getSelectionModel().select(1); + tabPane.getSelectionModel().select(Tabs.CONTACT_SEARCH); } @FXML private void groupCreationButtonClicked() { eventBus.dispatch(new LoadGroupCreationEvent(localDB)); - tabPane.getSelectionModel().select(2); + tabPane.getSelectionModel().select(Tabs.GROUP_CREATION); } @FXML diff --git a/client/src/main/java/envoy/constant/Tabs.java b/client/src/main/java/envoy/constant/Tabs.java new file mode 100644 index 0000000..ebcbf3b --- /dev/null +++ b/client/src/main/java/envoy/constant/Tabs.java @@ -0,0 +1,17 @@ +package envoy.constant; + +/** + * Project: client
+ * File: Tabs.java
+ * Created: Aug 30, 2020
+ * + * @author Maximilian Käfer + * @since Envoy Client v0.2-beta + */ +public class Tabs { + private Tabs() {} + + public static int CONTANCT_LIST = 0; + public static int CONTACT_SEARCH = 1; + public static int GROUP_CREATION = 2; +}