Apply code review suggestions from @CyB3RC0nN0R
Additionally added Tooltips to all current items in the SettingsScene, added ReflectionUtil, changed the cursor on listcells and merged develop into this branch
This commit is contained in:
commit
71bb329857
@ -13,13 +13,14 @@
|
|||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -18,6 +18,7 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
|||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.APILeak=warning
|
org.eclipse.jdt.core.compiler.problem.APILeak=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@ -125,8 +126,12 @@ public final class SceneContext {
|
|||||||
|
|
||||||
sceneStack.push(scene);
|
sceneStack.push(scene);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
applyCSS();
|
// The LoginScene is the only scene not intended to be resized
|
||||||
|
// As strange as it seems, this is needed as otherwise the LoginScene won't be
|
||||||
|
// displayed on some OS (...Debian...)
|
||||||
stage.sizeToScene();
|
stage.sizeToScene();
|
||||||
|
Platform.runLater(() -> stage.setResizable(sceneInfo != SceneInfo.LOGIN_SCENE));
|
||||||
|
applyCSS();
|
||||||
stage.show();
|
stage.show();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
EnvoyLog.getLogger(SceneContext.class).log(Level.SEVERE, String.format("Could not load scene for %s: ", sceneInfo), e);
|
EnvoyLog.getLogger(SceneContext.class).log(Level.SEVERE, String.format("Could not load scene for %s: ", sceneInfo), e);
|
||||||
|
@ -10,17 +10,16 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javafx.animation.RotateTransition;
|
import javafx.animation.RotateTransition;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.collections.transformation.FilteredList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
@ -29,6 +28,7 @@ import javafx.scene.input.KeyCode;
|
|||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.shape.Rectangle;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
|
||||||
@ -41,9 +41,8 @@ import envoy.client.event.SendEvent;
|
|||||||
import envoy.client.net.Client;
|
import envoy.client.net.Client;
|
||||||
import envoy.client.net.WriteProxy;
|
import envoy.client.net.WriteProxy;
|
||||||
import envoy.client.ui.*;
|
import envoy.client.ui.*;
|
||||||
import envoy.client.ui.listcell.ChatControl;
|
import envoy.client.ui.listcell.*;
|
||||||
import envoy.client.ui.listcell.ListCellFactory;
|
import envoy.client.util.ReflectionUtil;
|
||||||
import envoy.client.ui.listcell.MessageControl;
|
|
||||||
import envoy.data.*;
|
import envoy.data.*;
|
||||||
import envoy.data.Attachment.AttachmentType;
|
import envoy.data.Attachment.AttachmentType;
|
||||||
import envoy.event.*;
|
import envoy.event.*;
|
||||||
@ -103,6 +102,24 @@ public final class ChatScene implements Restorable {
|
|||||||
@FXML
|
@FXML
|
||||||
private ImageView attachmentView;
|
private ImageView attachmentView;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label topBarContactLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label topBarStatusLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button messageSearchButton;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ImageView clientProfilePic;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ImageView recipientProfilePic;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextArea contactSearch;
|
||||||
|
|
||||||
private LocalDB localDB;
|
private LocalDB localDB;
|
||||||
private Client client;
|
private Client client;
|
||||||
private WriteProxy writeProxy;
|
private WriteProxy writeProxy;
|
||||||
@ -124,6 +141,8 @@ public final class ChatScene implements Restorable {
|
|||||||
private static final int MAX_MESSAGE_LENGTH = 255;
|
private static final int MAX_MESSAGE_LENGTH = 255;
|
||||||
private static final int DEFAULT_ICON_SIZE = 16;
|
private static final int DEFAULT_ICON_SIZE = 16;
|
||||||
|
|
||||||
|
private FilteredList<Chat> chats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the appearance of certain visual components.
|
* Initializes the appearance of certain visual components.
|
||||||
*
|
*
|
||||||
@ -131,9 +150,8 @@ public final class ChatScene implements Restorable {
|
|||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
|
|
||||||
// Initialize message and user rendering
|
// Initialize message and user rendering
|
||||||
messageList.setCellFactory(new ListCellFactory<>(MessageControl::new));
|
messageList.setCellFactory(MessageListCell::new);
|
||||||
chatList.setCellFactory(new ListCellFactory<>(ChatControl::new));
|
chatList.setCellFactory(new ListCellFactory<>(ChatControl::new));
|
||||||
|
|
||||||
settingsButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
|
settingsButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
|
||||||
@ -141,6 +159,14 @@ public final class ChatScene implements Restorable {
|
|||||||
attachmentButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("attachment", DEFAULT_ICON_SIZE)));
|
attachmentButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("attachment", DEFAULT_ICON_SIZE)));
|
||||||
attachmentView.setImage(DEFAULT_ATTACHMENT_VIEW_IMAGE);
|
attachmentView.setImage(DEFAULT_ATTACHMENT_VIEW_IMAGE);
|
||||||
rotateButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("rotate", (int) (DEFAULT_ICON_SIZE * 1.5))));
|
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();
|
||||||
|
clip.setWidth(43);
|
||||||
|
clip.setHeight(43);
|
||||||
|
clip.setArcHeight(43);
|
||||||
|
clip.setArcWidth(43);
|
||||||
|
clientProfilePic.setClip(clip);
|
||||||
|
|
||||||
// Listen to received messages
|
// Listen to received messages
|
||||||
eventBus.register(MessageCreationEvent.class, e -> {
|
eventBus.register(MessageCreationEvent.class, e -> {
|
||||||
@ -165,8 +191,9 @@ public final class ChatScene implements Restorable {
|
|||||||
|
|
||||||
// Move chat with most recent unread messages to the top
|
// Move chat with most recent unread messages to the top
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
chatList.getItems().remove(chat);
|
chats.getSource().remove(chat);
|
||||||
chatList.getItems().add(0, chat);
|
((ObservableList<Chat>) chats.getSource()).add(0, chat);
|
||||||
|
|
||||||
if (chat.equals(currentChat)) chatList.getSelectionModel().select(0);
|
if (chat.equals(currentChat)) chatList.getSelectionModel().select(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -189,7 +216,7 @@ public final class ChatScene implements Restorable {
|
|||||||
|
|
||||||
// Listen to user status changes
|
// Listen to user status changes
|
||||||
eventBus.register(UserStatusChange.class,
|
eventBus.register(UserStatusChange.class,
|
||||||
e -> chatList.getItems()
|
e -> chats.getSource()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(c -> c.getRecipient().getID() == e.getID())
|
.filter(c -> c.getRecipient().getID() == e.getID())
|
||||||
.findAny()
|
.findAny()
|
||||||
@ -203,10 +230,10 @@ public final class ChatScene implements Restorable {
|
|||||||
case ADD:
|
case ADD:
|
||||||
if (contact instanceof User) localDB.getUsers().put(contact.getName(), (User) contact);
|
if (contact instanceof User) localDB.getUsers().put(contact.getName(), (User) contact);
|
||||||
final var chat = contact instanceof User ? new Chat(contact) : new GroupChat(client.getSender(), contact);
|
final var chat = contact instanceof User ? new Chat(contact) : new GroupChat(client.getSender(), contact);
|
||||||
Platform.runLater(() -> chatList.getItems().add(chat));
|
Platform.runLater(() -> ((ObservableList<Chat>) chats.getSource()).add(0, chat));
|
||||||
break;
|
break;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
Platform.runLater(() -> chatList.getItems().removeIf(c -> c.getRecipient().equals(contact)));
|
Platform.runLater(() -> chats.getSource().removeIf(c -> c.getRecipient().equals(contact)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -244,10 +271,12 @@ public final class ChatScene implements Restorable {
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
this.writeProxy = writeProxy;
|
this.writeProxy = writeProxy;
|
||||||
|
|
||||||
MessageControl.setUser(localDB.getUser());
|
chats = new FilteredList<>(FXCollections.observableList(localDB.getChats()));
|
||||||
MessageControl.setSceneContext(sceneContext);
|
chatList.setItems(chats);
|
||||||
chatList.setItems(FXCollections.observableList(localDB.getChats()));
|
|
||||||
contactLabel.setText(localDB.getUser().getName());
|
contactLabel.setText(localDB.getUser().getName());
|
||||||
|
MessageControl.setLocalDB(localDB);
|
||||||
|
MessageControl.setSceneContext(sceneContext);
|
||||||
|
|
||||||
if (!client.isOnline()) updateInfoLabel("You are offline", "infoLabel-info");
|
if (!client.isOnline()) updateInfoLabel("You are offline", "infoLabel-info");
|
||||||
|
|
||||||
recorder = new AudioRecorder();
|
recorder = new AudioRecorder();
|
||||||
@ -275,7 +304,7 @@ public final class ChatScene implements Restorable {
|
|||||||
currentChat = localDB.getChat(user.getID()).get();
|
currentChat = localDB.getChat(user.getID()).get();
|
||||||
|
|
||||||
messageList.setItems(FXCollections.observableList(currentChat.getMessages()));
|
messageList.setItems(FXCollections.observableList(currentChat.getMessages()));
|
||||||
final var scrollIndex = messageList.getItems().size() - currentChat.getUnreadAmount() - 1;
|
final var scrollIndex = messageList.getItems().size() - currentChat.getUnreadAmount();
|
||||||
messageList.scrollTo(scrollIndex);
|
messageList.scrollTo(scrollIndex);
|
||||||
logger.log(Level.FINEST, "Loading chat with " + user + " at index " + scrollIndex);
|
logger.log(Level.FINEST, "Loading chat with " + user + " at index " + scrollIndex);
|
||||||
deleteContactMenuItem.setText("Delete " + user.getName());
|
deleteContactMenuItem.setText("Delete " + user.getName());
|
||||||
@ -303,6 +332,27 @@ public final class ChatScene implements Restorable {
|
|||||||
voiceButton.setDisable(!recorder.isSupported());
|
voiceButton.setDisable(!recorder.isSupported());
|
||||||
attachmentButton.setDisable(false);
|
attachmentButton.setDisable(false);
|
||||||
chatList.refresh();
|
chatList.refresh();
|
||||||
|
|
||||||
|
if (currentChat != null) {
|
||||||
|
topBarContactLabel.setText(currentChat.getRecipient().getName());
|
||||||
|
if (currentChat.getRecipient() instanceof User) {
|
||||||
|
final String status = ((User) currentChat.getRecipient()).getStatus().toString();
|
||||||
|
topBarStatusLabel.setText(status);
|
||||||
|
topBarStatusLabel.getStyleClass().add(status.toLowerCase());
|
||||||
|
recipientProfilePic.setImage(IconUtil.loadIconThemeSensitive("user_icon", 43));
|
||||||
|
} else {
|
||||||
|
topBarStatusLabel.setText(currentChat.getRecipient().getContacts().size() + " members");
|
||||||
|
recipientProfilePic.setImage(IconUtil.loadIconThemeSensitive("group_icon", 43));
|
||||||
|
}
|
||||||
|
final Rectangle clip = new Rectangle();
|
||||||
|
clip.setWidth(43);
|
||||||
|
clip.setHeight(43);
|
||||||
|
clip.setArcHeight(43);
|
||||||
|
clip.setArcWidth(43);
|
||||||
|
recipientProfilePic.setClip(clip);
|
||||||
|
|
||||||
|
messageSearchButton.setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -313,7 +363,7 @@ public final class ChatScene implements Restorable {
|
|||||||
@FXML
|
@FXML
|
||||||
private void settingsButtonClicked() {
|
private void settingsButtonClicked() {
|
||||||
sceneContext.load(SceneContext.SceneInfo.SETTINGS_SCENE);
|
sceneContext.load(SceneContext.SceneInfo.SETTINGS_SCENE);
|
||||||
sceneContext.<SettingsScene>getController().initializeData(sceneContext, localDB.getUser());
|
sceneContext.<SettingsScene>getController().initializeData(sceneContext, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -432,14 +482,7 @@ public final class ChatScene implements Restorable {
|
|||||||
animationTime = Math.max(animationTime, 0.25);
|
animationTime = Math.max(animationTime, 0.25);
|
||||||
|
|
||||||
// contains all Node objects in ChatScene
|
// contains all Node objects in ChatScene
|
||||||
final var rotatableNodes = Arrays.stream(ChatScene.class.getDeclaredFields()).map(field -> {
|
final var rotatableNodes = ReflectionUtil.getAllDeclaredNodeVariables(this);
|
||||||
try {
|
|
||||||
return field.get(this);
|
|
||||||
} catch (IllegalArgumentException | IllegalAccessException e1) {
|
|
||||||
// In this case, this option can never be executed
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}).filter(Node.class::isInstance).map(Node.class::cast).collect(Collectors.toList());
|
|
||||||
for (final var node : rotatableNodes) {
|
for (final var node : rotatableNodes) {
|
||||||
// Sets the animation duration to {animationTime}
|
// Sets the animation duration to {animationTime}
|
||||||
final var rotateTransition = new RotateTransition(Duration.seconds(animationTime), node);
|
final var rotateTransition = new RotateTransition(Duration.seconds(animationTime), node);
|
||||||
@ -575,8 +618,8 @@ public final class ChatScene implements Restorable {
|
|||||||
currentChat.insert(message);
|
currentChat.insert(message);
|
||||||
// Moving currentChat to the top
|
// Moving currentChat to the top
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
chatList.getItems().remove(currentChat);
|
chats.getSource().remove(currentChat);
|
||||||
chatList.getItems().add(0, currentChat);
|
((ObservableList<Chat>) chats.getSource()).add(0, currentChat);
|
||||||
chatList.getSelectionModel().select(0);
|
chatList.getSelectionModel().select(0);
|
||||||
localDB.getChats().remove(currentChat);
|
localDB.getChats().remove(currentChat);
|
||||||
localDB.getChats().add(0, currentChat);
|
localDB.getChats().add(0, currentChat);
|
||||||
@ -651,4 +694,10 @@ public final class ChatScene implements Restorable {
|
|||||||
if (attachmentView.getImage() != null) attachmentView.setVisible(true);
|
if (attachmentView.getImage() != null) attachmentView.setVisible(true);
|
||||||
pendingAttachment = messageAttachment;
|
pendingAttachment = messageAttachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void searchContacts() {
|
||||||
|
chats.setPredicate(contactSearch.getText().isBlank() ? c -> true
|
||||||
|
: c -> c.getRecipient().getName().toLowerCase().contains(contactSearch.getText().toLowerCase()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,10 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
|
||||||
import envoy.client.data.*;
|
import envoy.client.data.*;
|
||||||
import envoy.client.net.Client;
|
import envoy.client.net.Client;
|
||||||
@ -37,7 +39,7 @@ import envoy.util.EnvoyLog;
|
|||||||
public final class LoginScene {
|
public final class LoginScene {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ClearableTextField userTextField;
|
private TextField userTextField;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private PasswordField passwordField;
|
private PasswordField passwordField;
|
||||||
@ -46,19 +48,30 @@ public final class LoginScene {
|
|||||||
private PasswordField repeatPasswordField;
|
private PasswordField repeatPasswordField;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label repeatPasswordLabel;
|
private Button registerSwitch;
|
||||||
|
|
||||||
@FXML
|
|
||||||
private CheckBox registerCheckBox;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label connectionLabel;
|
private Label connectionLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button loginButton;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button offlineModeButton;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label registerTextLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ImageView logo;
|
||||||
|
|
||||||
private Client client;
|
private Client client;
|
||||||
private LocalDB localDB;
|
private LocalDB localDB;
|
||||||
private CacheMap cacheMap;
|
private CacheMap cacheMap;
|
||||||
private SceneContext sceneContext;
|
private SceneContext sceneContext;
|
||||||
|
|
||||||
|
private boolean registration = false;
|
||||||
|
|
||||||
private static final Logger logger = EnvoyLog.getLogger(LoginScene.class);
|
private static final Logger logger = EnvoyLog.getLogger(LoginScene.class);
|
||||||
private static final EventBus eventBus = EventBus.getInstance();
|
private static final EventBus eventBus = EventBus.getInstance();
|
||||||
private static final ClientConfig config = ClientConfig.getInstance();
|
private static final ClientConfig config = ClientConfig.getInstance();
|
||||||
@ -70,6 +83,8 @@ public final class LoginScene {
|
|||||||
|
|
||||||
// Show an alert after an unsuccessful handshake
|
// Show an alert after an unsuccessful handshake
|
||||||
eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
|
eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
|
||||||
|
|
||||||
|
logo.setImage(IconUtil.loadIcon("envoy_logo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,28 +117,41 @@ public final class LoginScene {
|
|||||||
private void loginButtonPressed() {
|
private void loginButtonPressed() {
|
||||||
|
|
||||||
// Prevent registration with unequal passwords
|
// Prevent registration with unequal passwords
|
||||||
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
if (registration && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
||||||
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
|
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
|
||||||
repeatPasswordField.clear();
|
repeatPasswordField.clear();
|
||||||
} else if (!Bounds.isValidContactName(userTextField.getTextField().getText())) {
|
} else if (!Bounds.isValidContactName(userTextField.getText())) {
|
||||||
new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait();
|
new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait();
|
||||||
userTextField.getTextField().clear();
|
userTextField.clear();
|
||||||
} else performHandshake(new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText(), registerCheckBox.isSelected(),
|
} else performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText(), registration,
|
||||||
Startup.VERSION, loadLastSync(userTextField.getTextField().getText())));
|
Startup.VERSION, loadLastSync(userTextField.getText())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void offlineModeButtonPressed() {
|
private void offlineModeButtonPressed() {
|
||||||
attemptOfflineMode(
|
attemptOfflineMode(new LoginCredentials(userTextField.getText(), passwordField.getText(), false, Startup.VERSION,
|
||||||
new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText(), false, Startup.VERSION, localDB.getLastSync()));
|
loadLastSync(userTextField.getText())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void registerCheckboxChanged() {
|
private void registerSwitchPressed() {
|
||||||
|
if (!registration) {
|
||||||
|
// case if the current mode is login
|
||||||
|
loginButton.setText("Register");
|
||||||
|
loginButton.setPadding(new Insets(2, 116, 2, 116));
|
||||||
|
registerTextLabel.setText("Already an account?");
|
||||||
|
registerSwitch.setText("Login");
|
||||||
|
} else {
|
||||||
|
// case if the current mode is registration
|
||||||
|
loginButton.setText("Login");
|
||||||
|
loginButton.setPadding(new Insets(2, 125, 2, 125));
|
||||||
|
registerTextLabel.setText("No account yet?");
|
||||||
|
registerSwitch.setText("Register");
|
||||||
|
}
|
||||||
|
registration = !registration;
|
||||||
// Make repeat password field and label visible / invisible
|
// Make repeat password field and label visible / invisible
|
||||||
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
repeatPasswordField.setVisible(registration);
|
||||||
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
offlineModeButton.setDisable(registration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -206,9 +234,10 @@ public final class LoginScene {
|
|||||||
// Load ChatScene
|
// Load ChatScene
|
||||||
sceneContext.pop();
|
sceneContext.pop();
|
||||||
sceneContext.getStage().setMinHeight(400);
|
sceneContext.getStage().setMinHeight(400);
|
||||||
sceneContext.getStage().setMinWidth(350);
|
sceneContext.getStage().setMinWidth(843);
|
||||||
sceneContext.load(SceneContext.SceneInfo.CHAT_SCENE);
|
sceneContext.load(SceneContext.SceneInfo.CHAT_SCENE);
|
||||||
sceneContext.<ChatScene>getController().initializeData(sceneContext, localDB, client, writeProxy);
|
sceneContext.<ChatScene>getController().initializeData(sceneContext, localDB, client, writeProxy);
|
||||||
|
sceneContext.getStage().centerOnScreen();
|
||||||
|
|
||||||
if (StatusTrayIcon.isSupported()) {
|
if (StatusTrayIcon.isSupported()) {
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package envoy.client.ui.controller;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
||||||
|
import envoy.client.net.Client;
|
||||||
import envoy.client.ui.SceneContext;
|
import envoy.client.ui.SceneContext;
|
||||||
import envoy.client.ui.settings.*;
|
import envoy.client.ui.settings.*;
|
||||||
import envoy.data.User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project: <strong>envoy-client</strong><br>
|
* Project: <strong>envoy-client</strong><br>
|
||||||
@ -27,13 +27,14 @@ public class SettingsScene {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sceneContext enables the user to return to the chat scene
|
* @param sceneContext enables the user to return to the chat scene
|
||||||
* @param client the user who uses Envoy
|
* @param client the {@code Client} used to get the current user and to
|
||||||
|
* check if this user is online
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public void initializeData(SceneContext sceneContext, User client) {
|
public void initializeData(SceneContext sceneContext, Client client) {
|
||||||
this.sceneContext = sceneContext;
|
this.sceneContext = sceneContext;
|
||||||
settingsList.getItems().add(new GeneralSettingsPane());
|
settingsList.getItems().add(new GeneralSettingsPane());
|
||||||
settingsList.getItems().add(new UserSettingsPane(sceneContext, client));
|
settingsList.getItems().add(new UserSettingsPane(sceneContext, client.getSender(), client.isOnline()));
|
||||||
settingsList.getItems().add(new DownloadSettingsPane(sceneContext));
|
settingsList.getItems().add(new DownloadSettingsPane(sceneContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package envoy.client.ui.custom;
|
||||||
|
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.shape.Rectangle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a set of convenience constructors for images that are displayed as profile pictures.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>ProfilePicImageView.java</strong><br>
|
||||||
|
* Created: <strong>30.07.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Leon Hofmeister
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public final class ProfilePicImageView extends ImageView {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code ProfilePicImageView} without a default image.
|
||||||
|
*
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public ProfilePicImageView() { this(null); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code ProfilePicImageView}.
|
||||||
|
*
|
||||||
|
* @param image the image to display
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public ProfilePicImageView(Image image) { this(image, 40); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code ProfilePicImageView}.
|
||||||
|
*
|
||||||
|
* @param image the image to display
|
||||||
|
* @param sizeAndRounding the size and rounding for a circular
|
||||||
|
* {@code ProfilePicImageView}
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public ProfilePicImageView(Image image, double sizeAndRounding) { this(image, sizeAndRounding, sizeAndRounding); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code ProfilePicImageView}.
|
||||||
|
*
|
||||||
|
* @param image the image to display
|
||||||
|
* @param size the size of this {@code ProfilePicImageView}
|
||||||
|
* @param rounding how rounded this {@code ProfilePicImageView} should be
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public ProfilePicImageView(Image image, double size, double rounding) {
|
||||||
|
super(image);
|
||||||
|
final var clip = new Rectangle();
|
||||||
|
clip.setWidth(size);
|
||||||
|
clip.setHeight(size);
|
||||||
|
clip.setArcHeight(rounding);
|
||||||
|
clip.setArcWidth(rounding);
|
||||||
|
setClip(clip);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* This package stores custom components for use in JavaFX.
|
||||||
|
* These components are also expected to be used via FXML.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>package-info.java</strong><br>
|
||||||
|
* Created: <strong>30.07.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Leon Hofmeister
|
||||||
|
* @author Maximilian Käfer
|
||||||
|
* @author Kai S. K. Engelbart
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
package envoy.client.ui.custom;
|
@ -0,0 +1,50 @@
|
|||||||
|
package envoy.client.ui.listcell;
|
||||||
|
|
||||||
|
import javafx.scene.Cursor;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.ContentDisplay;
|
||||||
|
import javafx.scene.control.ListCell;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a convenience frame for list cell creation.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>AbstractListCell.java</strong><br>
|
||||||
|
* Created: <strong>18.07.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Kai S. K. Engelbart
|
||||||
|
* @param <T> the type of element displayed by the list cell
|
||||||
|
* @param <U> the type of node as which the list element will be displayed
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public abstract class AbstractListCell<T, U extends Node> extends ListCell<T> {
|
||||||
|
|
||||||
|
protected ListView<? extends T> listView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listView the list view inside of which the cell will be displayed
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public AbstractListCell(ListView<? extends T> listView) {
|
||||||
|
this.listView = listView;
|
||||||
|
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
||||||
|
getStyleClass().add("listElement");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void updateItem(T item, boolean empty) {
|
||||||
|
super.updateItem(item, empty);
|
||||||
|
setGraphic(empty || item == null ? null : renderItem(item));
|
||||||
|
if (!empty) setCursor(Cursor.HAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a list item to a node. This can have side effects on the list cell.
|
||||||
|
*
|
||||||
|
* @param item the item to render
|
||||||
|
* @return a node representing the item
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
protected abstract U renderItem(T item);
|
||||||
|
}
|
@ -1,10 +1,15 @@
|
|||||||
package envoy.client.ui.listcell;
|
package envoy.client.ui.listcell;
|
||||||
|
|
||||||
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
import javafx.scene.shape.Rectangle;
|
||||||
|
|
||||||
import envoy.client.data.Chat;
|
import envoy.client.data.Chat;
|
||||||
|
import envoy.client.ui.IconUtil;
|
||||||
|
import envoy.data.Group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a chat using a contact control for the recipient and a label for the
|
* Displays a chat using a contact control for the recipient and a label for the
|
||||||
@ -25,10 +30,27 @@ public class ChatControl extends HBox {
|
|||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public ChatControl(Chat chat) {
|
public ChatControl(Chat chat) {
|
||||||
|
setAlignment(Pos.CENTER_LEFT);
|
||||||
|
setPadding(new Insets(0, 0, 3, 0));
|
||||||
|
// profile pic
|
||||||
|
ImageView contactProfilePic;
|
||||||
|
if (chat.getRecipient() instanceof Group) contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("group_icon", 32));
|
||||||
|
else contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("user_icon", 32));
|
||||||
|
Rectangle clip = new Rectangle();
|
||||||
|
clip.setWidth(32);
|
||||||
|
clip.setHeight(32);
|
||||||
|
clip.setArcHeight(32);
|
||||||
|
clip.setArcWidth(32);
|
||||||
|
contactProfilePic.setClip(clip);
|
||||||
|
getChildren().add(contactProfilePic);
|
||||||
|
// spacing
|
||||||
|
Region leftSpacing = new Region();
|
||||||
|
leftSpacing.setPrefSize(8, 0);
|
||||||
|
leftSpacing.setMinSize(8, 0);
|
||||||
|
leftSpacing.setMaxSize(8, 0);
|
||||||
|
getChildren().add(leftSpacing);
|
||||||
// Contact control
|
// Contact control
|
||||||
getChildren().add(new ContactControl(chat.getRecipient()));
|
getChildren().add(new ContactControl(chat.getRecipient()));
|
||||||
|
|
||||||
// Unread messages
|
// Unread messages
|
||||||
if (chat.getUnreadAmount() != 0) {
|
if (chat.getUnreadAmount() != 0) {
|
||||||
final var spacing = new Region();
|
final var spacing = new Region();
|
||||||
@ -43,5 +65,6 @@ public class ChatControl extends HBox {
|
|||||||
vBox2.getChildren().add(unreadMessagesLabel);
|
vBox2.getChildren().add(unreadMessagesLabel);
|
||||||
getChildren().add(vBox2);
|
getChildren().add(vBox2);
|
||||||
}
|
}
|
||||||
|
getStyleClass().add("listElement");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,5 +39,6 @@ public class ContactControl extends VBox {
|
|||||||
} else {
|
} else {
|
||||||
getChildren().add(new Label(contact.getContacts().size() + " members"));
|
getChildren().add(new Label(contact.getContacts().size() + " members"));
|
||||||
}
|
}
|
||||||
|
getStyleClass().add("listElement");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package envoy.client.ui.listcell;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic list cell rendering an item using a provided render function.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>GenericListCell.java</strong><br>
|
||||||
|
* Created: <strong>18.07.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Kai S. K. Engelbart
|
||||||
|
* @param <T> the type of element displayed by the list cell
|
||||||
|
* @param <U> the type of node as which the list element will be displayed
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public final class GenericListCell<T, U extends Node> extends AbstractListCell<T, U> {
|
||||||
|
|
||||||
|
private final Function<? super T, U> renderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listView the list view inside of which the cell will be displayed
|
||||||
|
* @param renderer a function converting a list item to a node
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public GenericListCell(ListView<? extends T> listView, Function<? super T, U> renderer) {
|
||||||
|
super(listView);
|
||||||
|
this.renderer = renderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected U renderItem(T item) { return renderer.apply(item); }
|
||||||
|
}
|
@ -17,38 +17,19 @@ import javafx.util.Callback;
|
|||||||
*
|
*
|
||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @param <T> the type of object to display
|
* @param <T> the type of object to display
|
||||||
|
* @param <U> the type of node displayed
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public final class ListCellFactory<T> implements Callback<ListView<T>, ListCell<T>> {
|
public final class ListCellFactory<T, U extends Node> implements Callback<ListView<T>, ListCell<T>> {
|
||||||
|
|
||||||
private final class GenericListCell extends ListCell<T> {
|
private final Function<? super T, U> renderer;
|
||||||
|
|
||||||
private ListView<? extends T> listView;
|
|
||||||
|
|
||||||
private GenericListCell(ListView<? extends T> listView) { this.listView = listView; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void updateItem(T item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
if (empty || item == null) {
|
|
||||||
setText(null);
|
|
||||||
setGraphic(null);
|
|
||||||
} else {
|
|
||||||
final var control = converter.apply(item);
|
|
||||||
prefWidthProperty().bind(listView.widthProperty().subtract(40));
|
|
||||||
setGraphic(control);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Function<? super T, ? extends Node> converter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param converter a function converting the type to display into a node
|
* @param renderer a function converting the type to display into a node
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public ListCellFactory(Function<? super T, ? extends Node> converter) { this.converter = converter; }
|
public ListCellFactory(Function<? super T, U> renderer) { this.renderer = renderer; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListCell<T> call(ListView<T> listView) { return new GenericListCell(listView); }
|
public ListCell<T> call(ListView<T> listView) { return new GenericListCell<>(listView, renderer); }
|
||||||
}
|
}
|
||||||
|
@ -10,18 +10,22 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.*;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
|
|
||||||
|
import envoy.client.data.LocalDB;
|
||||||
import envoy.client.data.Settings;
|
import envoy.client.data.Settings;
|
||||||
import envoy.client.ui.AudioControl;
|
import envoy.client.ui.AudioControl;
|
||||||
import envoy.client.ui.IconUtil;
|
import envoy.client.ui.IconUtil;
|
||||||
import envoy.client.ui.SceneContext;
|
import envoy.client.ui.SceneContext;
|
||||||
|
|
||||||
|
import envoy.data.GroupMessage;
|
||||||
import envoy.data.Message;
|
import envoy.data.Message;
|
||||||
import envoy.data.Message.MessageStatus;
|
import envoy.data.Message.MessageStatus;
|
||||||
import envoy.data.User;
|
import envoy.data.User;
|
||||||
@ -35,11 +39,14 @@ import envoy.util.EnvoyLog;
|
|||||||
* Created: <strong>01.07.2020</strong><br>
|
* Created: <strong>01.07.2020</strong><br>
|
||||||
*
|
*
|
||||||
* @author Leon Hofmeister
|
* @author Leon Hofmeister
|
||||||
|
* @author Maximilian Käfer
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public class MessageControl extends Label {
|
public class MessageControl extends Label {
|
||||||
|
|
||||||
private static User client;
|
private boolean ownMessage;
|
||||||
|
|
||||||
|
private static LocalDB localDB;
|
||||||
|
|
||||||
private static SceneContext sceneContext;
|
private static SceneContext sceneContext;
|
||||||
|
|
||||||
@ -56,15 +63,31 @@ public class MessageControl extends Label {
|
|||||||
*/
|
*/
|
||||||
public MessageControl(Message message) {
|
public MessageControl(Message message) {
|
||||||
// Creating the underlying VBox and the dateLabel
|
// Creating the underlying VBox and the dateLabel
|
||||||
final var vbox = new VBox(new Label(dateFormat.format(message.getCreationDate())));
|
final var hbox = new HBox();
|
||||||
|
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.setText(localDB.getUsers()
|
||||||
|
.values()
|
||||||
|
.stream()
|
||||||
|
.filter(c -> c.getID() == message.getSenderID())
|
||||||
|
.findFirst()
|
||||||
|
.map(User::getName)
|
||||||
|
.orElse("Unknown User"));
|
||||||
|
label.setPadding(new Insets(0, 5, 0, 0));
|
||||||
|
hbox.getChildren().add(label);
|
||||||
|
}
|
||||||
|
hbox.getChildren().add(new Label(dateFormat.format(message.getCreationDate())));
|
||||||
|
final var vbox = new VBox(hbox);
|
||||||
|
|
||||||
// Creating the actions for the MenuItems
|
// Creating the actions for the MenuItems
|
||||||
final ContextMenu contextMenu = new ContextMenu();
|
final var contextMenu = new ContextMenu();
|
||||||
final MenuItem copyMenuItem = new MenuItem("Copy");
|
final var copyMenuItem = new MenuItem("Copy");
|
||||||
final MenuItem deleteMenuItem = new MenuItem("Delete");
|
final var deleteMenuItem = new MenuItem("Delete");
|
||||||
final MenuItem forwardMenuItem = new MenuItem("Forward");
|
final var forwardMenuItem = new MenuItem("Forward");
|
||||||
final MenuItem quoteMenuItem = new MenuItem("Quote");
|
final var quoteMenuItem = new MenuItem("Quote");
|
||||||
final MenuItem infoMenuItem = new MenuItem("Info");
|
final var infoMenuItem = new MenuItem("Info");
|
||||||
copyMenuItem.setOnAction(e -> copyMessage(message));
|
copyMenuItem.setOnAction(e -> copyMessage(message));
|
||||||
deleteMenuItem.setOnAction(e -> deleteMessage(message));
|
deleteMenuItem.setOnAction(e -> deleteMessage(message));
|
||||||
forwardMenuItem.setOnAction(e -> forwardMessage(message));
|
forwardMenuItem.setOnAction(e -> forwardMessage(message));
|
||||||
@ -93,15 +116,27 @@ public class MessageControl extends Label {
|
|||||||
}
|
}
|
||||||
// Creating the textLabel
|
// Creating the textLabel
|
||||||
final var textLabel = new Label(message.getText());
|
final var textLabel = new Label(message.getText());
|
||||||
|
textLabel.setMaxWidth(430);
|
||||||
textLabel.setWrapText(true);
|
textLabel.setWrapText(true);
|
||||||
vbox.getChildren().add(textLabel);
|
final var hBoxBottom = new HBox();
|
||||||
|
hBoxBottom.getChildren().add(textLabel);
|
||||||
// Setting the message status icon and background color
|
// Setting the message status icon and background color
|
||||||
if (message.getSenderID() == client.getID()) {
|
if (message.getSenderID() == localDB.getUser().getID()) {
|
||||||
final var statusIcon = new ImageView(statusImages.get(message.getStatus()));
|
final var statusIcon = new ImageView(statusImages.get(message.getStatus()));
|
||||||
statusIcon.setPreserveRatio(true);
|
statusIcon.setPreserveRatio(true);
|
||||||
vbox.getChildren().add(statusIcon);
|
final var space = new Region();
|
||||||
|
HBox.setHgrow(space, Priority.ALWAYS);
|
||||||
|
hBoxBottom.getChildren().add(space);
|
||||||
|
hBoxBottom.getChildren().add(statusIcon);
|
||||||
|
hBoxBottom.setAlignment(Pos.BOTTOM_RIGHT);
|
||||||
getStyleClass().add("own-message");
|
getStyleClass().add("own-message");
|
||||||
} else getStyleClass().add("received-message");
|
ownMessage = true;
|
||||||
|
hbox.setAlignment(Pos.CENTER_RIGHT);
|
||||||
|
} else {
|
||||||
|
getStyleClass().add("received-message");
|
||||||
|
ownMessage = false;
|
||||||
|
}
|
||||||
|
vbox.getChildren().add(hBoxBottom);
|
||||||
// Adjusting height and weight of the cell to the corresponding ListView
|
// Adjusting height and weight of the cell to the corresponding ListView
|
||||||
paddingProperty().setValue(new Insets(5, 20, 5, 20));
|
paddingProperty().setValue(new Insets(5, 20, 5, 20));
|
||||||
setContextMenu(contextMenu);
|
setContextMenu(contextMenu);
|
||||||
@ -144,10 +179,17 @@ public class MessageControl extends Label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param client the user who has logged in
|
* @param localDB the localDB used by the current user
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public static void setLocalDB(LocalDB localDB) { MessageControl.localDB = localDB; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether the message stored by this {@code MessageControl} has been
|
||||||
|
* sent by this user of Envoy
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public static void setUser(User client) { MessageControl.client = client; }
|
public boolean isOwnMessage() { return ownMessage; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sceneContext the scene context storing the stage used in Envoy
|
* @param sceneContext the scene context storing the stage used in Envoy
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package envoy.client.ui.listcell;
|
||||||
|
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
|
||||||
|
import envoy.data.Message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list cell containing messages represented as message controls.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>MessageListCell.java</strong><br>
|
||||||
|
* Created: <strong>18.07.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Kai S. K. Engelbart
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public final class MessageListCell extends AbstractListCell<Message, MessageControl> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param listView the list view inside of which the cell will be displayed
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public MessageListCell(ListView<? extends Message> listView) { super(listView); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MessageControl renderItem(Message message) {
|
||||||
|
final var control = new MessageControl(message);
|
||||||
|
listView.widthProperty().addListener((observable, oldValue, newValue) -> adjustPadding(newValue.intValue(), control.isOwnMessage()));
|
||||||
|
adjustPadding((int) listView.getWidth(), control.isOwnMessage());
|
||||||
|
if (control.isOwnMessage()) setAlignment(Pos.CENTER_RIGHT);
|
||||||
|
else setAlignment(Pos.CENTER_LEFT);
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void adjustPadding(int listWidth, boolean ownMessage) {
|
||||||
|
int padding = 10 + Math.max((listWidth - 1000) / 2, 0);
|
||||||
|
setPadding(ownMessage ? new Insets(0, padding, 6, 0) : new Insets(0, 0, 6, padding));
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
package envoy.client.ui.settings;
|
package envoy.client.ui.settings;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
|
|
||||||
@ -30,17 +28,21 @@ public class DownloadSettingsPane extends SettingsPane {
|
|||||||
*/
|
*/
|
||||||
public DownloadSettingsPane(SceneContext sceneContext) {
|
public DownloadSettingsPane(SceneContext sceneContext) {
|
||||||
super("Download");
|
super("Download");
|
||||||
vbox.setSpacing(15);
|
setSpacing(15);
|
||||||
vbox.setPadding(new Insets(15));
|
setPadding(new Insets(15));
|
||||||
// checkbox to disable asking
|
// checkbox to disable asking
|
||||||
final var checkBox = new CheckBox(settings.getItems().get("autoSaveDownloads").getUserFriendlyName());
|
final var checkBox = new CheckBox(settings.getItems().get("autoSaveDownloads").getUserFriendlyName());
|
||||||
checkBox.setSelected(settings.isDownloadSavedWithoutAsking());
|
checkBox.setSelected(settings.isDownloadSavedWithoutAsking());
|
||||||
|
checkBox.setTooltip(new Tooltip("Determines whether a \"Select save location\" - dialogue will be shown when saving attachments."));
|
||||||
checkBox.setOnAction(e -> settings.setDownloadSavedWithoutAsking(checkBox.isSelected()));
|
checkBox.setOnAction(e -> settings.setDownloadSavedWithoutAsking(checkBox.isSelected()));
|
||||||
vbox.getChildren().add(checkBox);
|
getChildren().add(checkBox);
|
||||||
|
|
||||||
// Displaying the default path to save to
|
// Displaying the default path to save to
|
||||||
vbox.getChildren().add(new Label(settings.getItems().get("downloadLocation").getDescription() + ":"));
|
final var pathLabel = new Label(settings.getItems().get("downloadLocation").getDescription() + ":");
|
||||||
|
pathLabel.setWrapText(true);
|
||||||
|
getChildren().add(pathLabel);
|
||||||
final var hbox = new HBox(20);
|
final var hbox = new HBox(20);
|
||||||
|
Tooltip.install(hbox, new Tooltip("Determines the location where attachments will be saved to."));
|
||||||
final var currentPath = new Label(settings.getDownloadLocation().getAbsolutePath());
|
final var currentPath = new Label(settings.getDownloadLocation().getAbsolutePath());
|
||||||
hbox.getChildren().add(currentPath);
|
hbox.getChildren().add(currentPath);
|
||||||
|
|
||||||
@ -58,6 +60,6 @@ public class DownloadSettingsPane extends SettingsPane {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
hbox.getChildren().add(button);
|
hbox.getChildren().add(button);
|
||||||
vbox.getChildren().add(hbox);
|
getChildren().add(hbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package envoy.client.ui.settings;
|
package envoy.client.ui.settings;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
|
import javafx.scene.control.Tooltip;
|
||||||
|
|
||||||
import envoy.client.data.SettingsItem;
|
import envoy.client.data.SettingsItem;
|
||||||
import envoy.client.event.ThemeChangeEvent;
|
import envoy.client.event.ThemeChangeEvent;
|
||||||
@ -24,27 +23,36 @@ public class GeneralSettingsPane extends SettingsPane {
|
|||||||
*/
|
*/
|
||||||
public GeneralSettingsPane() {
|
public GeneralSettingsPane() {
|
||||||
super("General");
|
super("General");
|
||||||
|
setSpacing(10);
|
||||||
|
|
||||||
// TODO: Support other value types
|
// TODO: Support other value types
|
||||||
List.of("hideOnClose", "enterToSend")
|
final var settingsItems = settings.getItems();
|
||||||
.stream()
|
final var hideOnCloseCheckbox = new SettingsCheckbox((SettingsItem<Boolean>) settingsItems.get("hideOnClose"));
|
||||||
.map(settings.getItems()::get)
|
hideOnCloseCheckbox.setTooltip(new Tooltip("If selected, Envoy will still be present in the task bar when closed."));
|
||||||
.map(i -> new SettingsCheckbox((SettingsItem<Boolean>) i))
|
getChildren().add(hideOnCloseCheckbox);
|
||||||
.forEach(vbox.getChildren()::add);
|
|
||||||
|
final var enterToSendCheckbox = new SettingsCheckbox((SettingsItem<Boolean>) settingsItems.get("enterToSend"));
|
||||||
|
final var enterToSendTooltip = new Tooltip(
|
||||||
|
"If selected, messages can be sent pressing \"Enter\". They can always be sent by pressing \"Ctrl\" + \"Enter\"");
|
||||||
|
enterToSendTooltip.setWrapText(true);
|
||||||
|
enterToSendCheckbox.setTooltip(enterToSendTooltip);
|
||||||
|
getChildren().add(enterToSendCheckbox);
|
||||||
|
|
||||||
final var combobox = new ComboBox<String>();
|
final var combobox = new ComboBox<String>();
|
||||||
combobox.getItems().add("dark");
|
combobox.getItems().add("dark");
|
||||||
combobox.getItems().add("light");
|
combobox.getItems().add("light");
|
||||||
|
combobox.setTooltip(new Tooltip("Determines the current theme Envoy will be displayed in."));
|
||||||
combobox.setValue(settings.getCurrentTheme());
|
combobox.setValue(settings.getCurrentTheme());
|
||||||
combobox.setOnAction(
|
combobox.setOnAction(
|
||||||
e -> { settings.setCurrentTheme(combobox.getValue()); EventBus.getInstance().dispatch(new ThemeChangeEvent(combobox.getValue())); });
|
e -> { settings.setCurrentTheme(combobox.getValue()); EventBus.getInstance().dispatch(new ThemeChangeEvent(combobox.getValue())); });
|
||||||
vbox.getChildren().add(combobox);
|
getChildren().add(combobox);
|
||||||
|
|
||||||
final var statusComboBox = new ComboBox<UserStatus>();
|
final var statusComboBox = new ComboBox<UserStatus>();
|
||||||
statusComboBox.getItems().setAll(UserStatus.values());
|
statusComboBox.getItems().setAll(UserStatus.values());
|
||||||
statusComboBox.setValue(UserStatus.ONLINE);
|
statusComboBox.setValue(UserStatus.ONLINE);
|
||||||
|
statusComboBox.setTooltip(new Tooltip("Change your current status"));
|
||||||
// TODO add action when value is changed
|
// TODO add action when value is changed
|
||||||
statusComboBox.setOnAction(e -> {});
|
statusComboBox.setOnAction(e -> {});
|
||||||
vbox.getChildren().add(statusComboBox);
|
getChildren().add(statusComboBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package envoy.client.ui.settings;
|
package envoy.client.ui.settings;
|
||||||
|
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
|
||||||
import envoy.client.data.Settings;
|
import envoy.client.data.Settings;
|
||||||
@ -13,17 +12,13 @@ import envoy.client.data.Settings;
|
|||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public abstract class SettingsPane extends Pane {
|
public abstract class SettingsPane extends VBox {
|
||||||
|
|
||||||
protected String title;
|
protected String title;
|
||||||
protected final VBox vbox = new VBox();
|
|
||||||
|
|
||||||
protected static final Settings settings = Settings.getInstance();
|
protected static final Settings settings = Settings.getInstance();
|
||||||
|
|
||||||
protected SettingsPane(String title) {
|
protected SettingsPane(String title) { this.title = title; }
|
||||||
this.title = title;
|
|
||||||
getChildren().add(vbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the title of this settings pane
|
* @return the title of this settings pane
|
||||||
|
@ -4,8 +4,8 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
@ -21,6 +21,8 @@ import javafx.stage.FileChooser;
|
|||||||
import envoy.client.event.SendEvent;
|
import envoy.client.event.SendEvent;
|
||||||
import envoy.client.ui.IconUtil;
|
import envoy.client.ui.IconUtil;
|
||||||
import envoy.client.ui.SceneContext;
|
import envoy.client.ui.SceneContext;
|
||||||
|
import envoy.client.ui.custom.ProfilePicImageView;
|
||||||
|
import envoy.client.util.ReflectionUtil;
|
||||||
import envoy.data.User;
|
import envoy.data.User;
|
||||||
import envoy.event.*;
|
import envoy.event.*;
|
||||||
import envoy.util.Bounds;
|
import envoy.util.Bounds;
|
||||||
@ -37,30 +39,45 @@ import envoy.util.EnvoyLog;
|
|||||||
public class UserSettingsPane extends SettingsPane {
|
public class UserSettingsPane extends SettingsPane {
|
||||||
|
|
||||||
private boolean profilePicChanged, usernameChanged, validPassword;
|
private boolean profilePicChanged, usernameChanged, validPassword;
|
||||||
private byte[] currentImageBytes, originalImageBytes;
|
private byte[] currentImageBytes;
|
||||||
private String newUsername, newPassword = "";
|
private String newUsername, newPassword = "";
|
||||||
|
|
||||||
|
private final ImageView profilePic = new ProfilePicImageView(null, 60);
|
||||||
|
private final TextField usernameTextField = new TextField();
|
||||||
|
private final PasswordField currentPasswordField = new PasswordField();
|
||||||
|
private final PasswordField newPasswordField = new PasswordField();
|
||||||
|
private final PasswordField repeatNewPasswordField = new PasswordField();
|
||||||
|
private final Button saveButton = new Button("Save");
|
||||||
|
|
||||||
|
private final Tooltip beOnlineReminder = new Tooltip("You need to be online to modify your acount.");
|
||||||
|
|
||||||
|
private static final EventBus eventBus = EventBus.getInstance();
|
||||||
|
private static final Logger logger = EnvoyLog.getLogger(UserSettingsPane.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@code UserSettingsPane}.
|
* Creates a new {@code UserSettingsPane}.
|
||||||
*
|
*
|
||||||
* @param sceneContext the {@code SceneContext} to block input to Envoy
|
* @param sceneContext the {@code SceneContext} to block input to Envoy
|
||||||
* @param user the user who wants to customize his profile
|
* @param user the user who wants to customize his profile
|
||||||
|
* @param online whether this user is currently online
|
||||||
* @since Envoy Client v0.2-beta
|
* @since Envoy Client v0.2-beta
|
||||||
*/
|
*/
|
||||||
public UserSettingsPane(SceneContext sceneContext, User user) {
|
public UserSettingsPane(SceneContext sceneContext, User user, boolean online) {
|
||||||
super("User");
|
super("User");
|
||||||
|
setSpacing(10);
|
||||||
|
|
||||||
// Display of profile pic change mechanism
|
// Display of profile pic change mechanism
|
||||||
final var hbox = new HBox();
|
final var hbox = new HBox();
|
||||||
// TODO: display current profile pic
|
// TODO: display current profile pic
|
||||||
final var profilePic = new ImageView(IconUtil.loadIcon("envoy_logo", 50));
|
profilePic.setImage(IconUtil.loadIconThemeSensitive("user_icon"));
|
||||||
profilePic.setCursor(Cursor.HAND);
|
profilePic.setCursor(Cursor.HAND);
|
||||||
profilePic.setFitWidth(50);
|
profilePic.setFitWidth(60);
|
||||||
profilePic.setFitHeight(50);
|
profilePic.setFitHeight(60);
|
||||||
profilePic.setOnMouseClicked(e -> {
|
profilePic.setOnMouseClicked(e -> {
|
||||||
|
if (!online) return;
|
||||||
final var pictureChooser = new FileChooser();
|
final var pictureChooser = new FileChooser();
|
||||||
|
|
||||||
pictureChooser.setTitle("Select a new picture");
|
pictureChooser.setTitle("Select a new profile pic");
|
||||||
pictureChooser.setInitialDirectory(new File(System.getProperty("user.home")));
|
pictureChooser.setInitialDirectory(new File(System.getProperty("user.home")));
|
||||||
pictureChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Pictures", "*.png", "*.jpg", "*.bmp", "*.gif"));
|
pictureChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Pictures", "*.png", "*.jpg", "*.bmp", "*.gif"));
|
||||||
|
|
||||||
@ -88,7 +105,7 @@ public class UserSettingsPane extends SettingsPane {
|
|||||||
// Displaying the username change mechanism
|
// Displaying the username change mechanism
|
||||||
final var username = user.getName();
|
final var username = user.getName();
|
||||||
newUsername = username;
|
newUsername = username;
|
||||||
final var usernameTextField = new TextField(username);
|
usernameTextField.setText(username);
|
||||||
final EventHandler<? super InputEvent> textChanged = e -> {
|
final EventHandler<? super InputEvent> textChanged = e -> {
|
||||||
newUsername = usernameTextField.getText();
|
newUsername = usernameTextField.getText();
|
||||||
usernameChanged = newUsername != username;
|
usernameChanged = newUsername != username;
|
||||||
@ -96,16 +113,13 @@ public class UserSettingsPane extends SettingsPane {
|
|||||||
usernameTextField.setOnInputMethodTextChanged(textChanged);
|
usernameTextField.setOnInputMethodTextChanged(textChanged);
|
||||||
usernameTextField.setOnKeyTyped(textChanged);
|
usernameTextField.setOnKeyTyped(textChanged);
|
||||||
hbox.getChildren().add(usernameTextField);
|
hbox.getChildren().add(usernameTextField);
|
||||||
vbox.getChildren().add(hbox);
|
getChildren().add(hbox);
|
||||||
|
|
||||||
// "Displaying" the password change mechanism
|
// "Displaying" the password change mechanism
|
||||||
final HBox[] passwordHBoxes = { new HBox(), new HBox(), new HBox() };
|
final HBox[] passwordHBoxes = { new HBox(), new HBox(), new HBox() };
|
||||||
final Label[] passwordLabels = { new Label("Enter current password:"), new Label("Enter new password:"),
|
final Label[] passwordLabels = { new Label("Enter current password:"), new Label("Enter new password:"),
|
||||||
new Label("Repeat new password:") };
|
new Label("Repeat new password:") };
|
||||||
|
|
||||||
final var currentPasswordField = new PasswordField();
|
|
||||||
final var newPasswordField = new PasswordField();
|
|
||||||
final var repeatNewPasswordField = new PasswordField();
|
|
||||||
final PasswordField[] passwordFields = { currentPasswordField, newPasswordField, repeatNewPasswordField };
|
final PasswordField[] passwordFields = { currentPasswordField, newPasswordField, repeatNewPasswordField };
|
||||||
final EventHandler<? super InputEvent> passwordEntered = e -> {
|
final EventHandler<? super InputEvent> passwordEntered = e -> {
|
||||||
newPassword = newPasswordField.getText();
|
newPassword = newPasswordField.getText();
|
||||||
@ -119,17 +133,27 @@ public class UserSettingsPane extends SettingsPane {
|
|||||||
|
|
||||||
for (int i = 0; i < passwordHBoxes.length; i++) {
|
for (int i = 0; i < passwordHBoxes.length; i++) {
|
||||||
final var hBox2 = passwordHBoxes[i];
|
final var hBox2 = passwordHBoxes[i];
|
||||||
|
passwordLabels[i].setWrapText(true);
|
||||||
hBox2.getChildren().add(passwordLabels[i]);
|
hBox2.getChildren().add(passwordLabels[i]);
|
||||||
hBox2.getChildren().add(passwordFields[i]);
|
hBox2.getChildren().add(passwordFields[i]);
|
||||||
vbox.getChildren().add(hBox2);
|
getChildren().add(hBox2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Displaying the save button
|
// Displaying the save button
|
||||||
final var saveButton = new Button("Save");
|
|
||||||
saveButton.setOnAction(e -> save(user.getID(), currentPasswordField.getText()));
|
saveButton.setOnAction(e -> save(user.getID(), currentPasswordField.getText()));
|
||||||
saveButton.setAlignment(Pos.BOTTOM_RIGHT);
|
saveButton.setAlignment(Pos.BOTTOM_RIGHT);
|
||||||
vbox.getChildren().add(saveButton);
|
getChildren().add(saveButton);
|
||||||
|
|
||||||
|
final var offline = !online;
|
||||||
|
ReflectionUtil.getAllDeclaredNodeVariables(this).forEach(node -> node.setDisable(offline));
|
||||||
|
if (offline) {
|
||||||
|
final var infoLabel = new Label("You shall not pass!\n(... Unless you would happen to be online)");
|
||||||
|
infoLabel.setId("infoLabel-warning");
|
||||||
|
infoLabel.setWrapText(true);
|
||||||
|
getChildren().add(infoLabel);
|
||||||
|
|
||||||
|
Tooltip.install(this, beOnlineReminder);
|
||||||
|
} else Tooltip.uninstall(this, beOnlineReminder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,11 +163,9 @@ public class UserSettingsPane extends SettingsPane {
|
|||||||
* @since Envoy Client v0.2-beta
|
* @since Envoy Client v0.2-beta
|
||||||
*/
|
*/
|
||||||
private void save(long userID, String oldPassword) {
|
private void save(long userID, String oldPassword) {
|
||||||
final var eventBus = EventBus.getInstance();
|
|
||||||
final var logger = EnvoyLog.getLogger(UserSettingsPane.class);
|
|
||||||
|
|
||||||
// The profile pic was changed
|
// The profile pic was changed
|
||||||
if (profilePicChanged && !Arrays.equals(currentImageBytes, originalImageBytes)) {
|
if (profilePicChanged) {
|
||||||
final var profilePicChangeEvent = new ProfilePicChange(currentImageBytes, userID);
|
final var profilePicChangeEvent = new ProfilePicChange(currentImageBytes, userID);
|
||||||
eventBus.dispatch(profilePicChangeEvent);
|
eventBus.dispatch(profilePicChangeEvent);
|
||||||
eventBus.dispatch(new SendEvent(profilePicChangeEvent));
|
eventBus.dispatch(new SendEvent(profilePicChangeEvent));
|
||||||
|
88
client/src/main/java/envoy/client/util/ReflectionUtil.java
Normal file
88
client/src/main/java/envoy/client/util/ReflectionUtil.java
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
package envoy.client.util;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>ReflectionUtil.java</strong><br>
|
||||||
|
* Created: <strong>02.08.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Leon Hofmeister
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public class ReflectionUtil {
|
||||||
|
|
||||||
|
private ReflectionUtil() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all declared variables of the given instance that have the specified
|
||||||
|
* class<br>
|
||||||
|
* (i.e. can get all {@code JComponents} (Swing) or {@code Nodes} (JavaFX) in a
|
||||||
|
* GUI class).
|
||||||
|
* <p>
|
||||||
|
* <b>Important: If you are using a module, you first need to declare <br>
|
||||||
|
* "opens {your_package} to envoy.client.util;" in your module-info.java</b>.
|
||||||
|
*
|
||||||
|
* @param <T> the type of the object
|
||||||
|
* @param <R> the type to return
|
||||||
|
* @param instance the instance of a given class whose values are to be
|
||||||
|
* evaluated
|
||||||
|
* @param typeToReturn the type of variable to return
|
||||||
|
* @return all variables in the given instance that have the requested type
|
||||||
|
* @throws RuntimeException if an exception occurs
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public static <T, R> Stream<R> getAllDeclaredVariablesOfTypeAsStream(T instance, Class<R> typeToReturn) {
|
||||||
|
return Arrays.stream(instance.getClass().getDeclaredFields()).filter(field -> typeToReturn.isAssignableFrom(field.getType())).map(field -> {
|
||||||
|
try {
|
||||||
|
field.setAccessible(true);
|
||||||
|
final var value = field.get(instance);
|
||||||
|
field.setAccessible(false);
|
||||||
|
return value;
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}).map(typeToReturn::cast);// field ->
|
||||||
|
// typeToReturn.isAssignableFrom(field.getClass())).map(typeToReturn::cast);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all declared variables of the given instance that are children of
|
||||||
|
* {@code Node}.
|
||||||
|
* <p>
|
||||||
|
* <b>Important: If you are using a module, you first need to declare <br>
|
||||||
|
* "opens {your_package} to envoy.client.util;" in your module-info.java</b>.
|
||||||
|
*
|
||||||
|
* @param <T> the type of the instance
|
||||||
|
* @param instance the instance of a given class whose values are to be
|
||||||
|
* evaluated
|
||||||
|
* @return all variables of the given object that have the requested type as
|
||||||
|
* {@code Stream}
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public static <T> Stream<Node> getAllDeclaredNodeVariablesAsStream(T instance) {
|
||||||
|
return getAllDeclaredVariablesOfTypeAsStream(instance, Node.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all declared variables of the given instance that are children of
|
||||||
|
* {@code Node}<br>
|
||||||
|
* <p>
|
||||||
|
* <b>Important: If you are using a module, you first need to declare <br>
|
||||||
|
* "opens {your_package} to envoy.client.util;" in your module-info.java</b>.
|
||||||
|
*
|
||||||
|
* @param <T> the type of the instance
|
||||||
|
* @param instance the instance of a given class whose values are to be
|
||||||
|
* evaluated
|
||||||
|
* @return all variables of the given object that have the requested type
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
public static <T> List<Node> getAllDeclaredNodeVariables(T instance) {
|
||||||
|
return getAllDeclaredNodeVariablesAsStream(instance).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
11
client/src/main/java/envoy/client/util/package-info.java
Normal file
11
client/src/main/java/envoy/client/util/package-info.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* This package contains utility classes for use in envoy-client.
|
||||||
|
* <p>
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>package-info.java</strong><br>
|
||||||
|
* Created: <strong>02.08.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Leon Hofmeister
|
||||||
|
* @since Envoy Client v0.2-beta
|
||||||
|
*/
|
||||||
|
package envoy.client.util;
|
@ -19,5 +19,7 @@ module envoy {
|
|||||||
requires javafx.graphics;
|
requires javafx.graphics;
|
||||||
|
|
||||||
opens envoy.client.ui to javafx.graphics, javafx.fxml;
|
opens envoy.client.ui to javafx.graphics, javafx.fxml;
|
||||||
opens envoy.client.ui.controller to javafx.graphics, javafx.fxml;
|
opens envoy.client.ui.controller to javafx.graphics, javafx.fxml, envoy.client.util;
|
||||||
|
opens envoy.client.ui.custom to javafx.graphics, javafx.fxml;
|
||||||
|
opens envoy.client.ui.settings to envoy.client.util;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.button, .list-cell, .progress-bar * {
|
.button, .list-cell, .progress-bar * {
|
||||||
-fx-background-radius: 5.0em;
|
-fx-background-radius: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.context-menu, .context-menu > * {
|
.context-menu, .context-menu > * {
|
||||||
@ -8,6 +8,28 @@
|
|||||||
-fx-background-color: transparent;
|
-fx-background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#textEnterContainer, #contact-search-enter-container {
|
||||||
|
-fx-background-radius: 5.0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#roundButton {
|
||||||
|
-fx-background-radius: 5.0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area .scroll-pane {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
.text-area .scroll-pane .viewport{
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
.text-area .scroll-pane .content{
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
-fx-background-radius: 15.0px;
|
-fx-background-radius: 15.0px;
|
||||||
}
|
}
|
||||||
@ -48,13 +70,13 @@
|
|||||||
|
|
||||||
.received-message {
|
.received-message {
|
||||||
-fx-alignment: center-left;
|
-fx-alignment: center-left;
|
||||||
-fx-background-radius: 4.0em;
|
-fx-background-radius: 1.3em;
|
||||||
-fx-text-alignment: right;
|
-fx-text-alignment: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.own-message {
|
.own-message {
|
||||||
-fx-alignment: center-right;
|
-fx-alignment: center-right;
|
||||||
-fx-background-radius: 4.0em;
|
-fx-background-radius: 1.3em;
|
||||||
-fx-text-alignment: left;
|
-fx-text-alignment: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +87,21 @@
|
|||||||
-fx-text-alignment: center;
|
-fx-text-alignment: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#loginButton {
|
||||||
|
-fx-background-radius: 1.0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#registerSwitch {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
-fx-text-fill: orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loginInputField {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
-fx-border: solid;
|
||||||
|
-fx-border-width: 0.0 0.0 1.0 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
#remainingCharsLabel {
|
#remainingCharsLabel {
|
||||||
-fx-text-fill: #00FF00;
|
-fx-text-fill: #00FF00;
|
||||||
-fx-background-color: transparent;
|
-fx-background-color: transparent;
|
||||||
@ -85,3 +122,15 @@
|
|||||||
#infoLabel-error {
|
#infoLabel-error {
|
||||||
-fx-text-fill: red;
|
-fx-text-fill: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#transparentBackground {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#profilePic {
|
||||||
|
-fx-radius: 1.0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listElement {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
-fx-background-color: lightgray;
|
-fx-background-color: lightgray;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-view, .list-cell, .text-area .content, .text-field, .password-field, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content, .context-menu, .menu-item {
|
#messageList, .text-field, .password-field, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content, .context-menu, .menu-item {
|
||||||
-fx-background-color: dimgray;
|
-fx-background-color: #222222;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-cell:selected, .list-cell:selected > *, .menu-item:hover {
|
.list-cell:selected, .list-cell:selected > *, .menu-item:hover {
|
||||||
@ -37,3 +37,48 @@
|
|||||||
.alert.information.dialog-pane, .alert.warning.dialog-pane, .alert.error.dialog-pane {
|
.alert.information.dialog-pane, .alert.warning.dialog-pane, .alert.error.dialog-pane {
|
||||||
-fx-background-color: black;
|
-fx-background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#loginInputField {
|
||||||
|
-fx-border-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loginBackground {
|
||||||
|
-fx-background-color: rgb(25, 25, 25);
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatList, #topBar, #search-panel {
|
||||||
|
-fx-background-color: #303030;
|
||||||
|
}
|
||||||
|
|
||||||
|
#textEnterContainer {
|
||||||
|
-fx-background-color: #363636;
|
||||||
|
}
|
||||||
|
|
||||||
|
#contact-search-enter-container {
|
||||||
|
-fx-background-color: #202020;
|
||||||
|
}
|
||||||
|
|
||||||
|
#underline {
|
||||||
|
-fx-border: solid;
|
||||||
|
-fx-border-width: 0.0 0.0 1.0 0.0;
|
||||||
|
-fx-border-color: #202020;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groupMemberNames {
|
||||||
|
-fx-text-fill: rgb(105.0,0.0,153.0);
|
||||||
|
-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;
|
||||||
|
}
|
||||||
|
@ -14,3 +14,7 @@
|
|||||||
.own-message {
|
.own-message {
|
||||||
-fx-background-color: lightgreen;
|
-fx-background-color: lightgreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#loginInputField {
|
||||||
|
-fx-border-color: black;
|
||||||
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.geometry.Rectangle2D?>
|
<?import javafx.geometry.Rectangle2D?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.ButtonBar?>
|
|
||||||
<?import javafx.scene.control.ContextMenu?>
|
<?import javafx.scene.control.ContextMenu?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.ListView?>
|
<?import javafx.scene.control.ListView?>
|
||||||
@ -13,166 +12,199 @@
|
|||||||
<?import javafx.scene.image.ImageView?>
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.Region?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<GridPane fx:id="scene" hgap="5.0" maxHeight="-Infinity"
|
<GridPane fx:id="scene" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="500.0" prefHeight="1152.0" prefWidth="2042.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.controller.ChatScene">
|
||||||
maxWidth="-Infinity" minHeight="400.0" minWidth="350.0"
|
|
||||||
prefHeight="400.0" prefWidth="600.0" vgap="2.0"
|
|
||||||
xmlns="http://javafx.com/javafx/11.0.1"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
|
||||||
fx:controller="envoy.client.ui.controller.ChatScene">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="NEVER" minWidth="60.0"
|
<ColumnConstraints hgrow="NEVER" maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />
|
||||||
prefWidth="160.0" />
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" />
|
||||||
<ColumnConstraints hgrow="ALWAYS"
|
|
||||||
maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="357.0" />
|
|
||||||
<ColumnConstraints hgrow="ALWAYS"
|
|
||||||
maxWidth="1.7976931348623157E308" minWidth="10.0" percentWidth="7.0"
|
|
||||||
prefWidth="357.0" />
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="-Infinity"
|
<RowConstraints maxHeight="122.00000508626302" minHeight="-Infinity" prefHeight="96.66666158040364" vgrow="NEVER" />
|
||||||
minHeight="-Infinity" prefHeight="50.0" vgrow="NEVER" />
|
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="50.0" prefHeight="949.3333384195963" vgrow="ALWAYS" />
|
||||||
<RowConstraints maxHeight="-Infinity"
|
<RowConstraints maxHeight="59.3333740234375" minHeight="-Infinity" prefHeight="22.666748046875" vgrow="NEVER" />
|
||||||
minHeight="-Infinity" prefHeight="20.0" vgrow="NEVER" />
|
<RowConstraints maxHeight="120.0" minHeight="-Infinity" prefHeight="83.333251953125" vgrow="NEVER" />
|
||||||
<RowConstraints maxHeight="1.7976931348623157E308"
|
|
||||||
minHeight="50.0" prefHeight="155.14286150251115" vgrow="ALWAYS" />
|
|
||||||
<RowConstraints maxHeight="-Infinity"
|
|
||||||
minHeight="-Infinity" prefHeight="20.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="120.0" minHeight="40.0"
|
|
||||||
prefHeight="60.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="-Infinity"
|
|
||||||
minHeight="-Infinity" prefHeight="40.0" vgrow="NEVER" />
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="chatList" onMouseClicked="#chatListClicked"
|
<VBox prefWidth="316.0" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
|
||||||
prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1"
|
|
||||||
GridPane.rowSpan="2147483647">
|
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="10.0" />
|
<Insets right="1.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
<children>
|
||||||
|
<VBox id="search-panel" maxHeight="-Infinity" minHeight="-Infinity" prefHeight="80.0" prefWidth="316.0">
|
||||||
|
<children>
|
||||||
|
<Label id="contact-search-enter-container" maxHeight="30.0" minHeight="30.0" prefHeight="30.0" prefWidth="325.0">
|
||||||
|
<graphic>
|
||||||
|
<TextArea id="contactSearchInput" fx:id="contactSearch" focusTraversable="false" maxHeight="30.0" minHeight="30.0" onInputMethodTextChanged="#searchContacts" onKeyTyped="#searchContacts" prefHeight="30.0" prefWidth="200.0" promptText="Search Contacts">
|
||||||
|
<font>
|
||||||
|
<Font size="14.0" />
|
||||||
|
</font>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
<Insets left="12.0" right="12.0" />
|
||||||
</padding>
|
</padding>
|
||||||
|
</TextArea>
|
||||||
|
</graphic>
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets left="10.0" right="10.0" top="3.0" />
|
||||||
|
</VBox.margin>
|
||||||
|
</Label>
|
||||||
|
<HBox id="underline" alignment="TOP_CENTER" prefHeight="41.0" prefWidth="296.0" spacing="5.0">
|
||||||
|
<children>
|
||||||
|
<Button mnemonicParsing="true" onAction="#addContactButtonClicked" prefWidth="100.0" text=" Add Contact">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button mnemonicParsing="false" prefWidth="100.0" text="New Group">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</HBox.margin>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding></Button>
|
||||||
|
</children>
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets left="10.0" right="10.0" top="5.0" />
|
||||||
|
</VBox.margin>
|
||||||
|
<padding>
|
||||||
|
<Insets top="3.0" />
|
||||||
|
</padding>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
<ListView id="chatList" fx:id="chatList" focusTraversable="false" onMouseClicked="#chatListClicked" prefWidth="316.0" VBox.vgrow="ALWAYS">
|
||||||
<contextMenu>
|
<contextMenu>
|
||||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem fx:id="deleteContactMenuItem"
|
<MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
|
||||||
mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
|
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
</ListView>
|
|
||||||
<Label fx:id="contactLabel" prefHeight="27.0" prefWidth="134.0"
|
|
||||||
GridPane.columnSpan="2">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets left="10.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</padding>
|
|
||||||
</Label>
|
|
||||||
<Button fx:id="settingsButton" mnemonicParsing="true"
|
|
||||||
onAction="#settingsButtonClicked" text="_Settings"
|
|
||||||
GridPane.columnIndex="1" GridPane.columnSpan="2147483647"
|
|
||||||
GridPane.halignment="RIGHT" GridPane.valignment="CENTER">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" right="10.0" top="10.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</padding>
|
|
||||||
</Button>
|
|
||||||
<ListView fx:id="messageList" GridPane.columnIndex="1"
|
|
||||||
GridPane.columnSpan="2147483647" GridPane.rowIndex="1"
|
|
||||||
GridPane.rowSpan="2">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets left="5.0" right="10.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ButtonBar buttonMinWidth="40.0" GridPane.columnIndex="1"
|
</children>
|
||||||
GridPane.columnSpan="2147483647" GridPane.halignment="CENTER"
|
</VBox>
|
||||||
GridPane.rowIndex="5" GridPane.valignment="BOTTOM">
|
<HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0">
|
||||||
<GridPane.margin>
|
<children>
|
||||||
|
<ImageView id="profilePic" fx:id="clientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="15.0" top="5.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</ImageView>
|
||||||
|
<Label id="transparentBackground" fx:id="contactLabel" prefHeight="27.0" prefWidth="134.0">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
<font>
|
||||||
|
<Font size="18.0" />
|
||||||
|
</font>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="10.0" top="5.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Label>
|
||||||
|
<Region id="transparentBackground" prefHeight="77.0" prefWidth="115.0" />
|
||||||
|
<VBox id="transparentBackground" alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||||
|
<children>
|
||||||
|
<Button fx:id="settingsButton" mnemonicParsing="true" onAction="#settingsButtonClicked" prefHeight="30.0" prefWidth="30.0" text="">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</VBox.margin>
|
||||||
|
</Button>
|
||||||
|
</children>
|
||||||
|
<HBox.margin>
|
||||||
<Insets right="10.0" />
|
<Insets right="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
<opaqueInsets>
|
||||||
|
<Insets />
|
||||||
|
</opaqueInsets>
|
||||||
|
</VBox>
|
||||||
|
</children>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="1.0" right="1.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</HBox>
|
||||||
|
<ListView id="messageList" fx:id="messageList" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2147483647" GridPane.rowIndex="1" GridPane.rowSpan="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<buttons>
|
|
||||||
<Button fx:id="rotateButton" mnemonicParsing="false"
|
|
||||||
onAction="#doABarrelRoll">
|
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Button>
|
</ListView>
|
||||||
<Button fx:id="attachmentButton" disable="true"
|
<HBox alignment="CENTER" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||||
mnemonicParsing="false" onAction="#attachmentButtonClicked">
|
<children>
|
||||||
|
<Label id="textEnterContainer" alignment="CENTER" minWidth="300.0" prefHeight="100.0" prefWidth="800.0">
|
||||||
|
<graphic>
|
||||||
|
<TextArea id="messageEnter" fx:id="messageTextArea" disable="true" onInputMethodTextChanged="#messageTextUpdated" onKeyPressed="#checkPostConditions" onKeyTyped="#checkKeyCombination" prefHeight="100.0" prefWidth="1250.0" promptText="Enter Message" wrapText="true">
|
||||||
|
<opaqueInsets>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</opaqueInsets>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets left="17.0" right="17.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Button>
|
</TextArea>
|
||||||
<Button fx:id="voiceButton" disable="true"
|
</graphic>
|
||||||
onAction="#voiceButtonClicked">
|
</Label>
|
||||||
<padding>
|
<HBox prefHeight="38.0" prefWidth="100.0" spacing="5.0">
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<children>
|
||||||
</padding>
|
<Button id="roundButton" fx:id="postButton" defaultButton="true" disable="true" minWidth="40.0" mnemonicParsing="true" onAction="#postMessage" prefHeight="40.0" prefWidth="40.0" text="Post">
|
||||||
</Button>
|
|
||||||
<Button fx:id="postButton" defaultButton="true"
|
|
||||||
disable="true" mnemonicParsing="true" onAction="#postMessage"
|
|
||||||
text="_Post">
|
|
||||||
<tooltip>
|
<tooltip>
|
||||||
<Tooltip anchorLocation="WINDOW_TOP_LEFT" autoHide="true"
|
<Tooltip anchorLocation="WINDOW_TOP_LEFT" autoHide="true" maxWidth="350.0" text="Click this button to send the message. If it is disabled, you first have to select a contact to send it to. A message may automatically be sent when you press (Ctrl + ) Enter, according to your preferences. Additionally sends a message when pressing "Alt" + "P"." wrapText="true" />
|
||||||
maxWidth="350.0"
|
|
||||||
text="Click this button to send the message. If it is disabled, you first have to select a contact to send it to. A message may automatically be sent when you press (Ctrl + ) Enter, according to your preferences. Additionally sends a message when pressing "Alt" + "P"."
|
|
||||||
wrapText="true" />
|
|
||||||
</tooltip>
|
</tooltip>
|
||||||
<contextMenu>
|
<contextMenu>
|
||||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false"
|
<MenuItem mnemonicParsing="false" onAction="#copyAndPostMessage" text="Copy and Send" />
|
||||||
onAction="#copyAndPostMessage" text="Copy and Send" />
|
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
</Button>
|
</Button>
|
||||||
</buttons>
|
<Button id="roundButton" fx:id="voiceButton" disable="true" minWidth="40.0" onAction="#voiceButtonClicked" prefHeight="40.0" prefWidth="40.0">
|
||||||
</ButtonBar>
|
|
||||||
<TextArea fx:id="messageTextArea" disable="true"
|
|
||||||
onInputMethodTextChanged="#messageTextUpdated"
|
|
||||||
onKeyPressed="#checkPostConditions" onKeyTyped="#checkKeyCombination"
|
|
||||||
prefHeight="200.0" prefWidth="200.0" wrapText="true"
|
|
||||||
GridPane.columnIndex="1" GridPane.columnSpan="2147483647"
|
|
||||||
GridPane.rowIndex="4">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="5.0" right="10.0" top="3.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
<opaqueInsets>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</opaqueInsets>
|
|
||||||
</TextArea>
|
|
||||||
<Button mnemonicParsing="true"
|
|
||||||
onAction="#addContactButtonClicked" text="_Add Contacts"
|
|
||||||
GridPane.halignment="CENTER" GridPane.rowIndex="5"
|
|
||||||
GridPane.valignment="CENTER">
|
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="10.0" right="5.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</Button>
|
</Button>
|
||||||
<Label id="remainingCharsLabel" fx:id="remainingChars"
|
<Button id="roundButton" fx:id="attachmentButton" disable="true" minWidth="40.0" mnemonicParsing="false" onAction="#attachmentButtonClicked" prefHeight="40.0" prefWidth="40.0">
|
||||||
ellipsisString="" maxHeight="30.0" maxWidth="180.0" prefHeight="30.0"
|
<padding>
|
||||||
prefWidth="180.0" text="remaining chars: 0/x" textFill="LIME"
|
|
||||||
textOverrun="LEADING_WORD_ELLIPSIS" visible="false"
|
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="3">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
</Button>
|
||||||
|
<Button id="roundButton" fx:id="rotateButton" minWidth="40.0" mnemonicParsing="false" onAction="#doABarrelRoll" prefHeight="40.0" prefWidth="40.0">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
</Button>
|
||||||
|
</children>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="5.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="40.0" left="10.0" right="10.0" top="15.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
</HBox>
|
||||||
|
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||||
|
<children>
|
||||||
|
<Label id="remainingCharsLabel" fx:id="remainingChars" ellipsisString="" maxHeight="30.0" maxWidth="180.0" prefHeight="30.0" prefWidth="180.0" text="remaining chars: 0/x" textFill="LIME" textOverrun="LEADING_WORD_ELLIPSIS" visible="false">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" top="5.0" />
|
<Insets bottom="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
@ -180,25 +212,17 @@
|
|||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</opaqueInsets>
|
</opaqueInsets>
|
||||||
<tooltip>
|
<tooltip>
|
||||||
<Tooltip
|
<Tooltip text="Shows how many chars you can still enter in this message" wrapText="true" />
|
||||||
text="Shows how many chars you can still enter in this message"
|
|
||||||
wrapText="true" />
|
|
||||||
</tooltip>
|
</tooltip>
|
||||||
</Label>
|
</Label>
|
||||||
<Label fx:id="infoLabel" text="Something happened"
|
<Label fx:id="infoLabel" text="Something happened" textFill="#faa007" visible="false" wrapText="true">
|
||||||
textFill="#faa007" visible="false" wrapText="true"
|
|
||||||
GridPane.columnIndex="1">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<ImageView fx:id="attachmentView" pickOnBounds="true"
|
</children>
|
||||||
preserveRatio="true" visible="false" GridPane.columnIndex="1"
|
</HBox>
|
||||||
GridPane.columnSpan="2147483647" GridPane.halignment="RIGHT"
|
<ImageView fx:id="attachmentView" pickOnBounds="true" preserveRatio="true" visible="false" GridPane.columnIndex="1" GridPane.columnSpan="2147483647" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
||||||
GridPane.rowIndex="3">
|
|
||||||
<viewport>
|
<viewport>
|
||||||
<Rectangle2D height="20.0" width="20.0" />
|
<Rectangle2D height="20.0" width="20.0" />
|
||||||
</viewport>
|
</viewport>
|
||||||
@ -206,5 +230,33 @@
|
|||||||
<Insets bottom="5.0" right="10.0" top="5.0" />
|
<Insets bottom="5.0" right="10.0" top="5.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
<HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
|
<children>
|
||||||
|
<ImageView id="profilePic" fx:id="recipientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="20.0" top="5.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</ImageView>
|
||||||
|
<VBox alignment="CENTER_LEFT" prefHeight="97.0" prefWidth="316.0">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="topBarContactLabel" text="">
|
||||||
|
<font>
|
||||||
|
<Font size="18.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Label fx:id="topBarStatusLabel" text="" />
|
||||||
|
</children>
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="15.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</VBox>
|
||||||
|
<Region prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
|
||||||
|
<Button id="roundButton" fx:id="messageSearchButton" contentDisplay="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="40.0" prefWidth="40.0" visible="false">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="20.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
@ -1,94 +1,76 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import envoy.client.ui.ClearableTextField?>
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.CheckBox?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.PasswordField?>
|
<?import javafx.scene.control.PasswordField?>
|
||||||
<?import javafx.scene.layout.BorderPane?>
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.image.Image?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<VBox prefHeight="206.0" prefWidth="440.0"
|
<VBox id="loginBackground" alignment="TOP_CENTER" prefHeight="500.0" prefWidth="350.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.controller.LoginScene">
|
||||||
xmlns="http://javafx.com/javafx/11.0.1"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
|
||||||
fx:controller="envoy.client.ui.controller.LoginScene">
|
|
||||||
<children>
|
<children>
|
||||||
<Label text="User Login">
|
<ImageView fx:id="logo" fitHeight="80.0" fitWidth="80.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets bottom="10.0" top="50.0" />
|
||||||
|
</VBox.margin>
|
||||||
|
<image>
|
||||||
|
<Image url="file:@../icons/envoy_logo.png" />
|
||||||
|
</image>
|
||||||
|
</ImageView>
|
||||||
|
<Label alignment="TOP_CENTER" contentDisplay="CENTER" layoutX="142.0" layoutY="15.0" text="ENVOY MESSENGER" textAlignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="14.0" />
|
||||||
|
</font>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Label alignment="TOP_CENTER" contentDisplay="CENTER"
|
||||||
|
prefHeight="33.0" prefWidth="110.0" text="LOGIN"
|
||||||
|
textAlignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="26.0" />
|
<Font size="26.0" />
|
||||||
</font>
|
</font>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets left="5.0" right="5.0" top="5.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<GridPane hgap="5.0" vgap="10.0">
|
<GridPane hgap="5.0" vgap="8.5">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES"
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
minWidth="10.0" percentWidth="40.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES"
|
|
||||||
minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0"
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0"
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0"
|
|
||||||
vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="User Name:">
|
<TextField id="loginInputField" fx:id="userTextField" promptText="Username">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="0.0" left="5.0" right="5.0" top="0.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
</TextField>
|
||||||
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
|
<PasswordField id="loginInputField" fx:id="passwordField" promptText=" Password" GridPane.rowIndex="1">
|
||||||
</padding>
|
|
||||||
</Label>
|
|
||||||
<Label text="Password:" GridPane.rowIndex="1">
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
|
|
||||||
</padding>
|
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="0.0" left="5.0" right="5.0" top="0.0" />
|
||||||
</GridPane.margin>
|
|
||||||
</Label>
|
|
||||||
<Label fx:id="repeatPasswordLabel" text="Repeat Password:"
|
|
||||||
visible="false" GridPane.rowIndex="2">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
|
|
||||||
</padding>
|
|
||||||
</Label>
|
|
||||||
<ClearableTextField fx:id="userTextField"
|
|
||||||
GridPane.columnIndex="1">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</ClearableTextField>
|
|
||||||
<PasswordField fx:id="passwordField"
|
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="1">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="5.0" right="5.0" top="10.0" />
|
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</PasswordField>
|
</PasswordField>
|
||||||
<PasswordField fx:id="repeatPasswordField"
|
<PasswordField id="loginInputField" fx:id="repeatPasswordField" promptText=" Repeat Password" visible="false" GridPane.rowIndex="2">
|
||||||
visible="false" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="10.0" />
|
<Insets bottom="0.0" left="5.0" right="5.0" top="0.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
@ -96,54 +78,40 @@
|
|||||||
</PasswordField>
|
</PasswordField>
|
||||||
</children>
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="10.0" left="25.0" right="25.0" top="10.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<CheckBox fx:id="registerCheckBox" mnemonicParsing="true"
|
<Button id="loginButton" fx:id="loginButton" defaultButton="true" focusTraversable="false" mnemonicParsing="false" onAction="#loginButtonPressed" text="Login" textAlignment="CENTER">
|
||||||
onAction="#registerCheckboxChanged" prefHeight="17.0"
|
<font>
|
||||||
prefWidth="181.0" text="_Register">
|
<Font size="16.0" />
|
||||||
|
</font>
|
||||||
|
<opaqueInsets>
|
||||||
|
<Insets />
|
||||||
|
</opaqueInsets>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="2.0" left="125.0" right="125.0" top="2.0" />
|
||||||
|
</padding>
|
||||||
|
</Button>
|
||||||
|
<HBox alignment="CENTER" prefHeight="30.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="registerTextLabel" text="No account yet?" />
|
||||||
|
<Button id="registerSwitch" fx:id="registerSwitch" accessibleRole="CHECK_BOX" focusTraversable="false" mnemonicParsing="false" onAction="#registerSwitchPressed" text="Register" />
|
||||||
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets left="5.0" right="3.0" />
|
<Insets bottom="20.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</CheckBox>
|
</HBox>
|
||||||
|
<Button fx:id="offlineModeButton" focusTraversable="false" mnemonicParsing="false" onAction="#offlineModeButtonPressed" text="Offline mode">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets bottom="5.0" top="20.0" />
|
||||||
|
</VBox.margin></Button>
|
||||||
<Label fx:id="connectionLabel">
|
<Label fx:id="connectionLabel">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets left="5.0" />
|
<Insets left="5.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
|
<font>
|
||||||
|
<Font size="12.0" />
|
||||||
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<BorderPane prefWidth="200.0">
|
|
||||||
<left>
|
|
||||||
<Button cancelButton="true" mnemonicParsing="false"
|
|
||||||
onAction="#abortLogin" text="Close" BorderPane.alignment="CENTER">
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
|
||||||
</padding>
|
|
||||||
<BorderPane.margin>
|
|
||||||
<Insets />
|
|
||||||
</BorderPane.margin>
|
|
||||||
</Button>
|
|
||||||
</left>
|
|
||||||
<center>
|
|
||||||
<Button mnemonicParsing="false"
|
|
||||||
onAction="#offlineModeButtonPressed" text="Offline mode"
|
|
||||||
BorderPane.alignment="CENTER">
|
|
||||||
<BorderPane.margin>
|
|
||||||
<Insets />
|
|
||||||
</BorderPane.margin>
|
|
||||||
</Button>
|
|
||||||
</center>
|
|
||||||
<right>
|
|
||||||
<Button defaultButton="true" mnemonicParsing="false"
|
|
||||||
onAction="#loginButtonPressed" text="Login"
|
|
||||||
BorderPane.alignment="CENTER">
|
|
||||||
<BorderPane.margin>
|
|
||||||
<Insets />
|
|
||||||
</BorderPane.margin>
|
|
||||||
</Button>
|
|
||||||
</right>
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" />
|
|
||||||
</VBox.margin>
|
|
||||||
</BorderPane>
|
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
BIN
client/src/main/resources/icons/dark/group_icon.png
Normal file
BIN
client/src/main/resources/icons/dark/group_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
client/src/main/resources/icons/dark/user_icon.png
Normal file
BIN
client/src/main/resources/icons/dark/user_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
client/src/main/resources/icons/light/group_icon.png
Normal file
BIN
client/src/main/resources/icons/light/group_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
client/src/main/resources/icons/light/user_icon.png
Normal file
BIN
client/src/main/resources/icons/light/user_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
@ -13,7 +13,6 @@ import envoy.data.Contact;
|
|||||||
public class PasswordChangeRequest extends Event<String> {
|
public class PasswordChangeRequest extends Event<String> {
|
||||||
|
|
||||||
private final long id;
|
private final long id;
|
||||||
|
|
||||||
private final String oldPassword;
|
private final String oldPassword;
|
||||||
|
|
||||||
private static final long serialVersionUID = 0L;
|
private static final long serialVersionUID = 0L;
|
||||||
|
@ -25,9 +25,8 @@ public class ProfilePicChange extends Event<byte[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the ID of the user changing his profile pic
|
||||||
* @since Envoy Common v0.2-beta
|
* @since Envoy Common v0.2-beta
|
||||||
*/
|
*/
|
||||||
public long getId() { return id; }
|
public long getId() { return id; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ public class Bounds {
|
|||||||
*/
|
*/
|
||||||
public static final Pattern CONTACT_NAME_PATTERN = Pattern.compile("^\\w[a-zA-Z0-9-]{2,15}$");
|
public static final Pattern CONTACT_NAME_PATTERN = Pattern.compile("^\\w[a-zA-Z0-9-]{2,15}$");
|
||||||
|
|
||||||
|
// KAI: Trust of Chain - das berühmte Konzept aus der Kryptographie
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param contactName the contact name to validate
|
* @param contactName the contact name to validate
|
||||||
* @return {@code true} if the given contact name is valid
|
* @return {@code true} if the given contact name is valid
|
||||||
|
Reference in New Issue
Block a user