diff --git a/client/src/main/java/envoy/client/event/BackEvent.java b/client/src/main/java/envoy/client/event/BackEvent.java new file mode 100644 index 0000000..55c7691 --- /dev/null +++ b/client/src/main/java/envoy/client/event/BackEvent.java @@ -0,0 +1,18 @@ +package envoy.client.event; + +import envoy.event.Event.Valueless; + +/** + * This event serves the purpose to trigger the tab change to tab 0 in {@link ChatScene}.

+ * + * Project: client
+ * File: BackEvent.java
+ * Created: 23.08.2020
+ * + * @author Maximilian Käfer + * @since Envoy Client v0.2-beta + */ +public class BackEvent extends Valueless{ + + private static final long serialVersionUID = 0L; +} diff --git a/client/src/main/java/envoy/client/event/LoadGroupCreationEvent.java b/client/src/main/java/envoy/client/event/LoadGroupCreationEvent.java new file mode 100644 index 0000000..db5d455 --- /dev/null +++ b/client/src/main/java/envoy/client/event/LoadGroupCreationEvent.java @@ -0,0 +1,27 @@ +package envoy.client.event; + +import envoy.client.data.LocalDB; +import envoy.client.ui.controller.ChatScene; +import envoy.event.Event; + +/** + * This event carries an instance of {@link LocalDB} so the groupCreationTab has the most recent version of the contactList.
+ * It is triggered as soon as the corresponding button in {@link ChatScene} is clicked.

+ * + * Project: client
+ * File: LoadGroupCreationEvent.java
+ * Created: 23.08.2020
+ * + * @author Maximilian Käfer + * @since Envoy Client v0.2-beta + */ +public class LoadGroupCreationEvent extends Event{ + + private static final long serialVersionUID = 0L; + + /** + * @param value the localDB + * @since Envoy Client v0.2-beta + */ + public LoadGroupCreationEvent(LocalDB value) { super(value); } +} diff --git a/client/src/main/java/envoy/client/ui/SceneContext.java b/client/src/main/java/envoy/client/ui/SceneContext.java index a7ab403..63edc06 100644 --- a/client/src/main/java/envoy/client/ui/SceneContext.java +++ b/client/src/main/java/envoy/client/ui/SceneContext.java @@ -54,33 +54,12 @@ 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. - * - * @since Envoy Client v0.1-beta - */ - GROUP_CREATION_SCENE("/fxml/GroupCreationScene.fxml"), - /** * The scene in which the login screen is displayed. * * @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 83bb085..c4e286b 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -20,13 +20,16 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.geometry.Insets; +import javafx.geometry.Pos; import javafx.scene.control.*; import javafx.scene.control.Alert.AlertType; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; -import javafx.scene.layout.GridPane; +import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.FileChooser; @@ -36,13 +39,13 @@ import envoy.client.data.*; import envoy.client.data.audio.AudioRecorder; import envoy.client.data.commands.SystemCommandBuilder; import envoy.client.data.commands.SystemCommandsMap; -import envoy.client.event.MessageCreationEvent; -import envoy.client.event.SendEvent; +import envoy.client.event.*; import envoy.client.net.Client; 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.*; @@ -84,9 +87,6 @@ public final class ChatScene implements Restorable { @FXML private Button settingsButton; - @FXML - private Button rotateButton; - @FXML private Button messageSearchButton; @@ -122,6 +122,18 @@ public final class ChatScene implements Restorable { @FXML private TextArea contactSearch; + + @FXML + private VBox contactOperations; + + @FXML + private TabPane tabPane; + + @FXML + private Tab contactSearchTab; + + @FXML + private Tab groupCreationTab; private LocalDB localDB; private Client client; @@ -161,7 +173,6 @@ public final class ChatScene implements Restorable { voiceButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("microphone", DEFAULT_ICON_SIZE))); attachmentButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("attachment", DEFAULT_ICON_SIZE))); attachmentView.setImage(DEFAULT_ATTACHMENT_VIEW_IMAGE); - rotateButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("rotate", (int) (DEFAULT_ICON_SIZE * 1.5)))); messageSearchButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("search", DEFAULT_ICON_SIZE))); clientProfilePic.setImage(IconUtil.loadIconThemeSensitive("user_icon", 43)); final Rectangle clip = new Rectangle(); @@ -170,7 +181,24 @@ public final class ChatScene implements Restorable { clip.setArcHeight(43); clip.setArcWidth(43); clientProfilePic.setClip(clip); - + + Platform.runLater(() -> { + if(client.isOnline()) { + try { + contactSearchTab.setContent(FXMLLoader.load(new File("src/main/resources/fxml/ContactSearchTab.fxml").toURI().toURL())); + groupCreationTab.setContent(FXMLLoader.load(new File("src/main/resources/fxml/GroupCreationTab.fxml").toURI().toURL())); + } catch (IOException e2) { + logger.log(Level.SEVERE, "An error occurred when attempting to load tabs: ", e2); + } + } else { + contactSearchTab.setContent(createOfflineNote()); + groupCreationTab.setContent(createOfflineNote()); + } + }); + + //Listen to backEvents + eventBus.register(BackEvent.class, e -> tabPane.getSelectionModel().select(Tabs.CONTACT_LIST)); + // Listen to received messages eventBus.register(MessageCreationEvent.class, e -> { final var message = e.get(); @@ -256,6 +284,22 @@ public final class ChatScene implements Restorable { eventBus.register(GroupCreationResult.class, e -> Platform.runLater(() -> { newGroupButton.setDisable(!e.get()); })); } + + private AnchorPane createOfflineNote() { + AnchorPane anc = new AnchorPane(); + VBox vBox = new VBox(); + vBox.setAlignment(Pos.TOP_CENTER); + vBox.setPrefWidth(316); + Label label = new Label("You have to be online!"); + label.setPadding(new Insets(50, 0, 5, 0)); + Button button = new Button("OK"); + button.setOnAction(e -> eventBus.dispatch(new BackEvent())); + vBox.getChildren().add(label); + vBox.getChildren().add(button); + anc.getChildren().add(vBox); + anc.setId("note-background"); + return anc; + } /** * Initializes all {@code SystemCommands} used in {@code ChatScene}. @@ -391,8 +435,13 @@ public final class ChatScene implements Restorable { */ @FXML private void addContactButtonClicked() { - sceneContext.load(SceneContext.SceneInfo.CONTACT_SEARCH_SCENE); - sceneContext.getController().initializeData(sceneContext, localDB); + tabPane.getSelectionModel().select(Tabs.CONTACT_SEARCH); + } + + @FXML + private void groupCreationButtonClicked() { + eventBus.dispatch(new LoadGroupCreationEvent(localDB)); + tabPane.getSelectionModel().select(Tabs.GROUP_CREATION); } @FXML @@ -472,18 +521,6 @@ public final class ChatScene implements Restorable { } } - /** - * Rotates every element in our application by (at most 4 *) 360° in at most - * 2.75s. - * - * @since Envoy Client v0.1-beta - */ - @FXML - private void doABarrelRoll() { - final var random = new Random(); - doABarrelRoll(random.nextInt(3) + 1, random.nextDouble() * 3 + 1); - } - /** * Rotates every element in our application by {@code rotations}*360° in * {@code an}. 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 58% 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 63f16b0..1109e18 100644 --- a/client/src/main/java/envoy/client/ui/controller/ContactSearchScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ContactSearchTab.java @@ -9,16 +9,13 @@ import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.control.Alert.AlertType; -import envoy.client.data.LocalDB; +import envoy.client.event.BackEvent; import envoy.client.event.SendEvent; -import envoy.client.ui.ClearableTextField; -import envoy.client.ui.SceneContext; import envoy.client.ui.listcell.ContactControl; import envoy.client.ui.listcell.ListCellFactory; import envoy.data.User; import envoy.event.ElementOperation; import envoy.event.EventBus; -import envoy.event.GroupCreationResult; import envoy.event.contact.ContactOperation; import envoy.event.contact.UserSearchRequest; import envoy.event.contact.UserSearchResult; @@ -32,30 +29,24 @@ import envoy.util.EnvoyLog; * The actual search algorithm is implemented on the server. *

* To create a group, a button is available that loads the - * {@link GroupCreationScene}. + * {@link GroupCreationTab}. *

* Project: envoy-client
* File: ContactSearchScene.java
* Created: 07.06.2020
* * @author Leon Hofmeister + * @author Maximilian Käfer * @since Envoy Client v0.1-beta */ -public final class ContactSearchScene { +public class ContactSearchTab { @FXML - private ClearableTextField searchBar; + private TextArea searchBar; @FXML private ListView userList; - @FXML - private Button newGroupButton; - - private SceneContext sceneContext; - - private LocalDB localDB; - private Alert alert = new Alert(AlertType.CONFIRMATION); private User currentlySelectedUser; @@ -71,24 +62,12 @@ public final class ContactSearchScene { private static final EventBus eventBus = EventBus.getInstance(); private static final Logger logger = EnvoyLog.getLogger(ChatScene.class); - /** - * @param sceneContext enables the user to return to the chat scene - * @param localDB the local database to which new contacts are added - * @since Envoy Client v0.1-beta - */ - public void initializeData(SceneContext sceneContext, LocalDB localDB) { - this.sceneContext = sceneContext; - this.localDB = localDB; - } - @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); - eventBus.register(GroupCreationResult.class, e -> Platform.runLater(() -> { newGroupButton.setDisable(!e.get()); })); } /** @@ -98,7 +77,7 @@ public final 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(); } @@ -111,7 +90,7 @@ public final class ContactSearchScene { */ @FXML private void clear() { - searchBar.getTextField().setText(null); + searchBar.setText(null); userList.getItems().clear(); } @@ -126,30 +105,16 @@ public final class ContactSearchScene { final var user = userList.getSelectionModel().getSelectedItem(); if (user != null) { currentlySelectedUser = user; - alert = new Alert(AlertType.CONFIRMATION); - alert.setTitle("Add User to Contact List"); - alert.setHeaderText("Add the user " + currentlySelectedUser.getName() + " to your contact list?"); - // Normally, this would be total BS (we are already on the FX Thread), however - // it could be proven that the creation of this dialog wrapped in - // Platform.runLater is less error-prone than without it - Platform.runLater(() -> alert.showAndWait().filter(btn -> btn == ButtonType.OK).ifPresent(btn -> { - final var event = new ContactOperation(currentlySelectedUser, ElementOperation.ADD); - // Sends the event to the server - eventBus.dispatch(new SendEvent(event)); - // Removes the chosen user and updates the UI - userList.getItems().remove(currentlySelectedUser); - eventBus.dispatch(event); - logger.log(Level.INFO, "Added user " + currentlySelectedUser); - })); + final var event = new ContactOperation(currentlySelectedUser, ElementOperation.ADD); + // Sends the event to the server + eventBus.dispatch(new SendEvent(event)); + // Removes the chosen user and updates the UI + userList.getItems().remove(currentlySelectedUser); + eventBus.dispatch(event); + logger.log(Level.INFO, "Added user " + currentlySelectedUser); } } @FXML - private void newGroupButtonClicked() { - sceneContext.load(SceneContext.SceneInfo.GROUP_CREATION_SCENE); - sceneContext.getController().initializeData(sceneContext, localDB); - } - - @FXML - private void backButtonClicked() { sceneContext.pop(); } + private void backButtonClicked() { eventBus.dispatch(new BackEvent()); } } diff --git a/client/src/main/java/envoy/client/ui/controller/GroupCreationScene.java b/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java similarity index 53% rename from client/src/main/java/envoy/client/ui/controller/GroupCreationScene.java rename to client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java index da9e997..9672063 100644 --- a/client/src/main/java/envoy/client/ui/controller/GroupCreationScene.java +++ b/client/src/main/java/envoy/client/ui/controller/GroupCreationTab.java @@ -7,13 +7,13 @@ import java.util.stream.Collectors; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.control.*; -import javafx.scene.control.Alert.AlertType; +import javafx.scene.layout.HBox; import envoy.client.data.Chat; import envoy.client.data.LocalDB; +import envoy.client.event.BackEvent; +import envoy.client.event.LoadGroupCreationEvent; import envoy.client.event.SendEvent; -import envoy.client.ui.ClearableTextField; -import envoy.client.ui.SceneContext; import envoy.client.ui.listcell.ContactControl; import envoy.client.ui.listcell.ListCellFactory; import envoy.data.Contact; @@ -21,7 +21,6 @@ import envoy.data.Group; import envoy.data.User; import envoy.event.EventBus; import envoy.event.GroupCreation; -import envoy.event.GroupCreationResult; import envoy.util.Bounds; /** @@ -40,22 +39,34 @@ import envoy.util.Bounds; * @author Maximilian Käfer * @since Envoy Client v0.1-beta */ -public final class GroupCreationScene { +public class GroupCreationTab { @FXML private Button createButton; + + @FXML + private Button cancelButton; @FXML - private ClearableTextField groupNameField; + private TextArea groupNameField; @FXML private ListView userList; - - private SceneContext sceneContext; + + @FXML + private Label errorMessageLabel; + + @FXML + private Button proceedDupButton; + + @FXML + private Button cancelDupButton; + + @FXML + private HBox errorProceedBox; private LocalDB localDB; - - private String groupName; + private String name; private static final EventBus eventBus = EventBus.getInstance(); @@ -63,38 +74,20 @@ public final class GroupCreationScene { private void initialize() { userList.setCellFactory(new ListCellFactory<>(ContactControl::new)); userList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); - groupNameField.setClearButtonListener(e -> { groupNameField.getTextField().clear(); createButton.setDisable(true); }); - eventBus.register(GroupCreationResult.class, e -> Platform.runLater(() -> { - if (e.get()) new Alert(AlertType.INFORMATION, String.format("Group '%s' successfully created.", groupName)).showAndWait(); - else { - createButton.setDisable(true); - final var alert = new Alert(AlertType.ERROR); - alert.setTitle("Groups are not allowed"); - alert.setHeaderText("Cannot create group as your current server disabled this feature"); - alert.setContentText("If this is unplanned, please contact your server administrator."); - alert.showAndWait(); - sceneContext.pop(); - } - })); - } - - /** - * @param sceneContext enables the user to return to the chat scene - * @param localDB the local database from which potential group members can - * be selected - * @since Envoy Client v0.1-beta - */ - public void initializeData(SceneContext sceneContext, LocalDB localDB) { - this.sceneContext = sceneContext; - this.localDB = localDB; - Platform.runLater(() -> userList.getItems() - .addAll(localDB.getChats() - .stream() - .map(Chat::getRecipient) - .filter(User.class::isInstance) - .filter(not(localDB.getUser()::equals)) - .map(User.class::cast) - .collect(Collectors.toList()))); + + eventBus.register(LoadGroupCreationEvent.class, e -> { + createButton.setDisable(true); + this.localDB = e.get(); + userList.getItems().clear(); + Platform.runLater(() -> userList.getItems() + .addAll(localDB.getChats() + .stream() + .map(Chat::getRecipient) + .filter(User.class::isInstance) + .filter(not(localDB.getUser()::equals)) + .map(User.class::cast) + .collect(Collectors.toList()))); + }); } /** @@ -104,7 +97,7 @@ public final class GroupCreationScene { */ @FXML private void userListClicked() { - createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getTextField().getText().isBlank()); + createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); } /** @@ -114,7 +107,7 @@ public final class GroupCreationScene { * @since Envoy Client v0.1-beta */ @FXML - private void textUpdated() { createButton.setDisable(groupNameField.getTextField().getText().isBlank()); } + private void textUpdated() { createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); } /** * Sends a {@link GroupCreation} to the server and closes this scene. @@ -125,16 +118,24 @@ public final class GroupCreationScene { */ @FXML private void createButtonClicked() { - final var name = groupNameField.getTextField().getText(); + name = groupNameField.getText(); if (!Bounds.isValidContactName(name)) { - new Alert(AlertType.ERROR, "The entered group name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait(); - groupNameField.getTextField().clear(); + setErrorMessageLabelSize(30); + errorMessageLabel.setText("The group name is not valid!"); + groupNameField.clear(); } else if (groupNameAlreadyPresent(name)) { - final var alert = new Alert(AlertType.WARNING, "You already have a group with that name.", ButtonType.OK, ButtonType.CANCEL); - alert.setTitle("Create Group?"); - alert.setHeaderText("Proceed?"); - alert.showAndWait().filter(btn -> btn == ButtonType.OK).ifPresent(btn -> createGroup(name)); - } else createGroup(name); + setErrorMessageLabelSize(30); + errorMessageLabel.setText("Name does already exist! Proceed anyways?"); + setProcessPaneSize(30); + createButton.setDisable(true); + cancelButton.setDisable(true); + } else { + createGroup(name); + eventBus.dispatch(new BackEvent()); + // Restoring the original design as tabs will always be reused + setErrorMessageLabelSize(0); + groupNameField.clear(); + } } /** @@ -145,7 +146,6 @@ public final class GroupCreationScene { * @since Envoy Client v0.1-beta */ private void createGroup(String name) { - groupName = name; eventBus.dispatch(new SendEvent( new GroupCreation(name, userList.getSelectionModel().getSelectedItems().stream().map(User::getID).collect(Collectors.toSet())))); } @@ -168,5 +168,47 @@ public final class GroupCreationScene { } @FXML - private void backButtonClicked() { sceneContext.pop(); } + private void backButtonClicked() { + eventBus.dispatch(new BackEvent()); + setErrorMessageLabelSize(0); + setProcessPaneSize(0); + } + + @FXML + private void proceedOnNameDuplication() { + createButton.setDisable(false); + cancelButton.setDisable(false); + createGroup(name); + eventBus.dispatch(new BackEvent()); + setErrorMessageLabelSize(0); + setProcessPaneSize(0); + groupNameField.clear(); + } + + @FXML + private void cancelOnNameDuplication() { + createButton.setDisable(false); + cancelButton.setDisable(false); + setErrorMessageLabelSize(0); + setProcessPaneSize(0); + groupNameField.clear(); + } + + private void setErrorMessageLabelSize(int value) { + errorMessageLabel.setPrefHeight(value); + errorMessageLabel.setMinHeight(value); + errorMessageLabel.setMaxHeight(value); + } + + private void setProcessPaneSize(int value) { + proceedDupButton.setPrefHeight(value); + proceedDupButton.setMinHeight(value); + proceedDupButton.setMaxHeight(value); + cancelDupButton.setPrefHeight(value); + cancelDupButton.setMinHeight(value); + cancelDupButton.setMaxHeight(value); + errorProceedBox.setPrefHeight(value); + errorProceedBox.setMinHeight(value); + errorProceedBox.setMaxHeight(value); + } } diff --git a/client/src/main/java/envoy/client/ui/listcell/AbstractListCell.java b/client/src/main/java/envoy/client/ui/listcell/AbstractListCell.java index 45e424d..a763981 100644 --- a/client/src/main/java/envoy/client/ui/listcell/AbstractListCell.java +++ b/client/src/main/java/envoy/client/ui/listcell/AbstractListCell.java @@ -29,7 +29,7 @@ public abstract class AbstractListCell extends ListCell { public AbstractListCell(ListView listView) { this.listView = listView; setContentDisplay(ContentDisplay.GRAPHIC_ONLY); - getStyleClass().add("listElement"); + getStyleClass().add("list-element"); } @Override diff --git a/client/src/main/java/envoy/client/ui/listcell/ChatControl.java b/client/src/main/java/envoy/client/ui/listcell/ChatControl.java index 027527b..402ef5d 100644 --- a/client/src/main/java/envoy/client/ui/listcell/ChatControl.java +++ b/client/src/main/java/envoy/client/ui/listcell/ChatControl.java @@ -61,10 +61,10 @@ public final class ChatControl extends HBox { final var vBox2 = new VBox(); vBox2.setAlignment(Pos.CENTER_RIGHT); unreadMessagesLabel.setAlignment(Pos.CENTER); - unreadMessagesLabel.getStyleClass().add("unreadMessagesAmount"); + unreadMessagesLabel.getStyleClass().add("unread-messages-amount"); vBox2.getChildren().add(unreadMessagesLabel); getChildren().add(vBox2); } - getStyleClass().add("listElement"); + getStyleClass().add("list-element"); } } diff --git a/client/src/main/java/envoy/client/ui/listcell/ContactControl.java b/client/src/main/java/envoy/client/ui/listcell/ContactControl.java index 99415cb..f7a8999 100644 --- a/client/src/main/java/envoy/client/ui/listcell/ContactControl.java +++ b/client/src/main/java/envoy/client/ui/listcell/ContactControl.java @@ -36,7 +36,9 @@ public final class ContactControl extends VBox { final var statusLabel = new Label(status); statusLabel.getStyleClass().add(status.toLowerCase()); getChildren().add(statusLabel); - } else getChildren().add(new Label(contact.getContacts().size() + " members")); - getStyleClass().add("listElement"); + } else { + getChildren().add(new Label(contact.getContacts().size() + " members")); + } + getStyleClass().add("list-element"); } } diff --git a/client/src/main/java/envoy/client/ui/listcell/MessageControl.java b/client/src/main/java/envoy/client/ui/listcell/MessageControl.java index 95676ea..e3c1664 100644 --- a/client/src/main/java/envoy/client/ui/listcell/MessageControl.java +++ b/client/src/main/java/envoy/client/ui/listcell/MessageControl.java @@ -66,7 +66,7 @@ public final class MessageControl extends Label { if (message.getSenderID() != localDB.getUser().getID() && message instanceof GroupMessage) { // Displaying the name of the sender in a group final var label = new Label(); - label.getStyleClass().add("groupMemberNames"); + label.getStyleClass().add("group-member-names"); label.setText(localDB.getUsers() .values() .stream() 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..2a8b42d --- /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 CONTACT_LIST = 0; + public static int CONTACT_SEARCH = 1; + public static int GROUP_CREATION = 2; +} diff --git a/client/src/main/resources/css/base.css b/client/src/main/resources/css/base.css index 4c289bb..bc6d471 100644 --- a/client/src/main/resources/css/base.css +++ b/client/src/main/resources/css/base.css @@ -8,11 +8,11 @@ -fx-background-color: transparent; } -#textEnterContainer, #contact-search-enter-container { +#text-enter-container, #contact-search-enter-container { -fx-background-radius: 5.0em; } -#roundButton { +#round-button { -fx-background-radius: 5.0em; } @@ -80,29 +80,29 @@ -fx-text-alignment: left; } -.unreadMessagesAmount { +.unread-messages-amount { -fx-alignment: center; -fx-background-color: orange; -fx-background-radius: 4.0em; -fx-text-alignment: center; } -#loginButton { +#login-button { -fx-background-radius: 1.0em; } -#registerSwitch { +#register-switch { -fx-background-color: transparent; -fx-text-fill: orange; } -#loginInputField { +#login-input-field { -fx-background-color: transparent; -fx-border: solid; -fx-border-width: 0.0 0.0 1.0 0.0; } -#remainingCharsLabel { +#remaining-chars-label { -fx-text-fill: #00FF00; -fx-background-color: transparent; } @@ -123,14 +123,22 @@ -fx-text-fill: red; } -#transparentBackground { +#transparent-background { -fx-background-color: transparent; } -#profilePic { +#profile-pic { -fx-radius: 1.0em; } -.listElement { +.list-element { -fx-background-color: transparent; } + +.tab-pane { + -fx-tab-max-height: 0 ; +} +.tab-pane .tab-header-area { + visibility: hidden ; + -fx-padding: -20 0 0 0; +} diff --git a/client/src/main/resources/css/dark.css b/client/src/main/resources/css/dark.css index ca98909..f990855 100644 --- a/client/src/main/resources/css/dark.css +++ b/client/src/main/resources/css/dark.css @@ -7,7 +7,7 @@ } .button { - -fx-background-color: rgb(105.0,0.0,153.0); + -fx-background-color: #690099; } .button:pressed { @@ -18,12 +18,12 @@ -fx-background-color: lightgray; } -#messageList, .text-field, .password-field, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content, .context-menu, .menu-item { +#message-list, .text-field, .password-field, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content, .context-menu, .menu-item { -fx-background-color: #222222; } .list-cell:selected, .list-cell:selected > *, .menu-item:hover { - -fx-background-color: rgb(105.0,0.0,153.0); + -fx-background-color: #690099; } .received-message { @@ -38,19 +38,19 @@ -fx-background-color: black; } -#loginInputField { +#login-input-field { -fx-border-color: white; } -#loginBackground { - -fx-background-color: rgb(25, 25, 25); +#login-background { + -fx-background-color: #191919; } -#chatList, #topBar, #search-panel { +#chat-list, #top-bar, #search-panel, #note-background { -fx-background-color: #303030; } -#textEnterContainer { +#text-enter-container { -fx-background-color: #363636; } @@ -64,8 +64,8 @@ -fx-border-color: #202020; } -.groupMemberNames { - -fx-text-fill: rgb(105.0,0.0,153.0); +.group-member-names { + -fx-text-fill: #690099; -fx-font-weight: bold; } @@ -82,3 +82,8 @@ -fx-background-insets : 4.0, 0.0, 0.0; -fx-background-radius : 2.0em; } + +#proceed-button { + -fx-text-fill: white; + -fx-background-color: transparent; +} diff --git a/client/src/main/resources/css/light.css b/client/src/main/resources/css/light.css index 8486dcb..147bd2b 100644 --- a/client/src/main/resources/css/light.css +++ b/client/src/main/resources/css/light.css @@ -1,20 +1,85 @@ -.button{ - -fx-background-color: orangered; +.root { + -fx-background-color: #E6E6E6; } -.list-cell:selected, .list-cell:selected > * { - -fx-background-color: orangered; - -fx-text-fill: black; +.button { + -fx-background-color: #B37D7D; } -.received-message, .menu-item { +.button:pressed { + -fx-background-color: #808080; +} + +.button:disabled { + -fx-background-color: lightgray; +} + +#message-list, .text-field, .password-field, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content, .context-menu, .menu-item { + -fx-background-color: #E3E3E3; +} + +.list-cell:selected, .list-cell:selected > *, .menu-item:hover { + -fx-background-color: #805959; +} + +.received-message { -fx-background-color: lightgray; } .own-message { - -fx-background-color: lightgreen; + -fx-background-color: #8FA88F; } -#loginInputField { +.alert.information.dialog-pane, .alert.warning.dialog-pane, .alert.error.dialog-pane { + -fx-background-color: black; +} + +#login-input-field { -fx-border-color: black; } + +#login-background { + -fx-background-color: white; +} + +#chat-list, #top-bar, #search-panel, #note-background { + -fx-background-color: white; +} + +#text-enter-container { + -fx-background-color: #F2F2F2; +} + +#contact-search-enter-container { + -fx-background-color: #CCCCCC; +} + +#underline { + -fx-border: solid; + -fx-border-width: 0.0 0.0 1.0 0.0; + -fx-border-color: #CCCCCC; +} + +.group-member-names { + -fx-text-fill: #805959; + -fx-font-weight: bold; +} + +.scroll-bar:vertical, .scroll-bar:vertical .track, .scroll-bar:vertical .increment-button , .scroll-bar:vertical .decrement-button { + -fx-background-color: transparent; +} + +.scroll-bar:vertical .increment-arrow, .scroll-bar:vertical .decrement-arrow { + -fx-background-color: transparent; +} + +.scroll-bar:vertical .thumb { + -fx-background-color: #707070; + -fx-background-insets : 4.0, 0.0, 0.0; + -fx-background-radius : 2.0em; +} + +#proceed-button { + -fx-text-fill: white; + -fx-background-color: transparent; +} diff --git a/client/src/main/resources/fxml/ChatScene.fxml b/client/src/main/resources/fxml/ChatScene.fxml index 5b6bf77..bdcb995 100644 --- a/client/src/main/resources/fxml/ChatScene.fxml +++ b/client/src/main/resources/fxml/ChatScene.fxml @@ -7,9 +7,12 @@ + + + @@ -30,10 +33,90 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<<<<<<< HEAD + + +======= @@ -94,13 +177,14 @@ +>>>>>>> refs/heads/develop - + -