Merge pull request #43 from informatik-ag-ngl/f/context
Simplified dependency injection for the client
This commit is contained in:
commit
63ed1c480d
File diff suppressed because one or more lines are too long
98
client/src/main/java/envoy/client/data/Context.java
Normal file
98
client/src/main/java/envoy/client/data/Context.java
Normal file
@ -0,0 +1,98 @@
|
||||
package envoy.client.data;
|
||||
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import envoy.client.net.Client;
|
||||
import envoy.client.net.WriteProxy;
|
||||
import envoy.client.ui.SceneContext;
|
||||
|
||||
/**
|
||||
* Provides access to commonly used objects.
|
||||
* <p>
|
||||
* Project: <strong>client</strong><br>
|
||||
* File: <strong>Context.java</strong><br>
|
||||
* Created: <strong>01.09.2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public class Context {
|
||||
|
||||
private WriteProxy writeProxy;
|
||||
private LocalDB localDB;
|
||||
private Stage stage;
|
||||
private SceneContext sceneContext;
|
||||
|
||||
private final Client client = new Client();
|
||||
|
||||
private static final Context instance = new Context();
|
||||
|
||||
private Context() {}
|
||||
|
||||
/**
|
||||
* @return the instance of {@code Context} used throughout Envoy
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public static Context getInstance() { return instance; }
|
||||
|
||||
/**
|
||||
* Initializes the write proxy given that {@code localDB} is initialized.
|
||||
*
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public void initWriteProxy() {
|
||||
if (localDB == null) throw new IllegalStateException("The LocalDB has to be initialized!");
|
||||
writeProxy = new WriteProxy(client, localDB);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the localDB
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public LocalDB getLocalDB() { return localDB; }
|
||||
|
||||
/**
|
||||
* @param localDB the localDB to set
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public void setLocalDB(LocalDB localDB) { this.localDB = localDB; }
|
||||
|
||||
/**
|
||||
* @return the sceneContext
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public SceneContext getSceneContext() { return sceneContext; }
|
||||
|
||||
/**
|
||||
* @param sceneContext the sceneContext to set. Additionally sets the stage.
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public void setSceneContext(SceneContext sceneContext) {
|
||||
this.sceneContext = sceneContext;
|
||||
stage = sceneContext.getStage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the client
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public Client getClient() { return client; }
|
||||
|
||||
/**
|
||||
* @return the writeProxy
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public WriteProxy getWriteProxy() { return writeProxy; }
|
||||
|
||||
/**
|
||||
* @return the stage
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public Stage getStage() { return stage; }
|
||||
|
||||
/**
|
||||
* @param stage the stage to set
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public void setStage(Stage stage) { this.stage = stage; }
|
||||
}
|
@ -3,8 +3,9 @@ package envoy.client.event;
|
||||
import envoy.event.Event.Valueless;
|
||||
|
||||
/**
|
||||
* This event serves the purpose to trigger the tab change to tab 0 in {@link ChatScene}.<p>
|
||||
*
|
||||
* This event serves the purpose to trigger the tab change to tab 0 in
|
||||
* {@link envoy.client.ui.controller.ChatScene}.
|
||||
* <p>
|
||||
* Project: <strong>client</strong><br>
|
||||
* File: <strong>BackEvent.java</strong><br>
|
||||
* Created: <strong>23.08.2020</strong><br>
|
||||
@ -12,7 +13,7 @@ import envoy.event.Event.Valueless;
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public class BackEvent extends Valueless{
|
||||
public class BackEvent extends Valueless {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
package envoy.client.event;
|
||||
|
||||
import envoy.client.data.LocalDB;
|
||||
import envoy.client.ui.controller.ChatScene;
|
||||
import envoy.event.Event;
|
||||
|
||||
/**
|
||||
* This event carries an instance of {@link LocalDB} so the groupCreationTab has the most recent version of the contactList. <br>
|
||||
* It is triggered as soon as the corresponding button in {@link ChatScene} is clicked. <p>
|
||||
*
|
||||
* Project: <strong>client</strong><br>
|
||||
* File: <strong>LoadGroupCreationEvent.java</strong><br>
|
||||
* Created: <strong>23.08.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public class LoadGroupCreationEvent extends Event<LocalDB>{
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* @param value the localDB
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public LoadGroupCreationEvent(LocalDB value) { super(value); }
|
||||
}
|
@ -33,10 +33,9 @@ public final class WriteProxy {
|
||||
* Initializes a write proxy using a client and a local database. The
|
||||
* corresponding cache processors are injected into the caches.
|
||||
*
|
||||
* @param client the client used to send messages and message status change
|
||||
* events
|
||||
* @param localDB the local database used to cache messages and message status
|
||||
* change events
|
||||
* @param client the client instance used to send messages and events if online
|
||||
* @param localDB the local database used to cache messages and events if
|
||||
* offline
|
||||
* @since Envoy Client v0.3-alpha
|
||||
*/
|
||||
public WriteProxy(Client client, LocalDB localDB) {
|
||||
|
@ -124,8 +124,12 @@ public final class SceneContext {
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public void pop() {
|
||||
|
||||
// Pop scene and controller
|
||||
sceneStack.pop();
|
||||
controllerStack.pop();
|
||||
|
||||
// Apply new scene if present
|
||||
if (!sceneStack.isEmpty()) {
|
||||
final var newScene = sceneStack.peek();
|
||||
stage.setScene(newScene);
|
||||
@ -160,4 +164,10 @@ public final class SceneContext {
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public Stage getStage() { return stage; }
|
||||
|
||||
/**
|
||||
* @return whether the scene stack is empty
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public boolean isEmpty() { return sceneStack.isEmpty(); }
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package envoy.client.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -14,10 +17,11 @@ import envoy.client.data.*;
|
||||
import envoy.client.net.Client;
|
||||
import envoy.client.ui.SceneContext.SceneInfo;
|
||||
import envoy.client.ui.controller.LoginScene;
|
||||
import envoy.data.GroupMessage;
|
||||
import envoy.data.Message;
|
||||
import envoy.data.*;
|
||||
import envoy.data.User.UserStatus;
|
||||
import envoy.event.GroupMessageStatusChange;
|
||||
import envoy.event.MessageStatusChange;
|
||||
import envoy.exception.EnvoyException;
|
||||
import envoy.util.EnvoyLog;
|
||||
|
||||
/**
|
||||
@ -40,9 +44,10 @@ public final class Startup extends Application {
|
||||
*/
|
||||
public static final String VERSION = "0.1-beta";
|
||||
|
||||
private LocalDB localDB;
|
||||
private Client client;
|
||||
private static LocalDB localDB;
|
||||
|
||||
private static final Context context = Context.getInstance();
|
||||
private static final Client client = context.getClient();
|
||||
private static final ClientConfig config = ClientConfig.getInstance();
|
||||
private static final Logger logger = EnvoyLog.getLogger(Startup.class);
|
||||
|
||||
@ -77,21 +82,145 @@ public final class Startup extends Application {
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize client and unread message cache
|
||||
client = new Client();
|
||||
|
||||
final var cacheMap = new CacheMap();
|
||||
cacheMap.put(Message.class, new Cache<Message>());
|
||||
cacheMap.put(GroupMessage.class, new Cache<GroupMessage>());
|
||||
cacheMap.put(MessageStatusChange.class, new Cache<MessageStatusChange>());
|
||||
cacheMap.put(GroupMessageStatusChange.class, new Cache<GroupMessageStatusChange>());
|
||||
// Prepare handshake
|
||||
localDB.loadIDGenerator();
|
||||
context.setLocalDB(localDB);
|
||||
|
||||
stage.setTitle("Envoy");
|
||||
stage.getIcons().add(IconUtil.loadIcon("envoy_logo"));
|
||||
|
||||
final var sceneContext = new SceneContext(stage);
|
||||
sceneContext.load(SceneInfo.LOGIN_SCENE);
|
||||
sceneContext.<LoginScene>getController().initializeData(client, localDB, cacheMap, sceneContext);
|
||||
context.setSceneContext(sceneContext);
|
||||
|
||||
// Perform automatic login if configured
|
||||
if (config.hasLoginCredentials())
|
||||
performHandshake(new LoginCredentials(config.getUser(), config.getPassword(), false, Startup.VERSION, loadLastSync(config.getUser())));
|
||||
else sceneContext.load(SceneInfo.LOGIN_SCENE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to perform a Handshake with the server.
|
||||
*
|
||||
* @param credentials the credentials to use for the handshake
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public static void performHandshake(LoginCredentials credentials) {
|
||||
final var cacheMap = new CacheMap();
|
||||
cacheMap.put(Message.class, new Cache<Message>());
|
||||
cacheMap.put(GroupMessage.class, new Cache<GroupMessage>());
|
||||
cacheMap.put(MessageStatusChange.class, new Cache<MessageStatusChange>());
|
||||
cacheMap.put(GroupMessageStatusChange.class, new Cache<GroupMessageStatusChange>());
|
||||
try {
|
||||
final var client = context.getClient();
|
||||
client.performHandshake(credentials, cacheMap);
|
||||
if (client.isOnline()) {
|
||||
loadChatScene();
|
||||
client.initReceiver(localDB, cacheMap);
|
||||
}
|
||||
} catch (IOException | InterruptedException | TimeoutException e) {
|
||||
logger.log(Level.INFO, "Could not connect to server. Entering offline mode...");
|
||||
attemptOfflineMode(credentials.getIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to load {@link envoy.client.ui.controller.ChatScene} in offline mode
|
||||
* for a given user.
|
||||
*
|
||||
* @param identifier the identifier of the user - currently his username
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public static void attemptOfflineMode(String identifier) {
|
||||
try {
|
||||
// Try entering offline mode
|
||||
localDB.loadUsers();
|
||||
final User clientUser = localDB.getUsers().get(identifier);
|
||||
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
||||
client.setSender(clientUser);
|
||||
loadChatScene();
|
||||
} catch (final Exception e) {
|
||||
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
||||
logger.log(Level.SEVERE, "Offline mode could not be loaded: ", e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the last known time a user has been online.
|
||||
*
|
||||
* @param identifier the identifier of this user - currently his name
|
||||
* @return the last {@code Instant} at which he has been online
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public static Instant loadLastSync(String identifier) {
|
||||
try {
|
||||
localDB.loadUsers();
|
||||
localDB.setUser(localDB.getUsers().get(identifier));
|
||||
localDB.initializeUserStorage();
|
||||
localDB.loadUserData();
|
||||
} catch (final Exception e) {
|
||||
// User storage empty, wrong user name etc. -> default lastSync
|
||||
}
|
||||
return localDB.getLastSync();
|
||||
}
|
||||
|
||||
private static void loadChatScene() {
|
||||
|
||||
// Set client user in local database
|
||||
localDB.setUser(client.getSender());
|
||||
|
||||
// Initialize chats in local database
|
||||
try {
|
||||
localDB.initializeUserStorage();
|
||||
localDB.loadUserData();
|
||||
} catch (final FileNotFoundException e) {
|
||||
// The local database file has not yet been created, probably first login
|
||||
} catch (final Exception e) {
|
||||
new Alert(AlertType.ERROR, "Error while loading local database: " + e + "\nChats will not be stored locally.").showAndWait();
|
||||
logger.log(Level.WARNING, "Could not load local database: ", e);
|
||||
}
|
||||
|
||||
context.initWriteProxy();
|
||||
localDB.synchronize();
|
||||
|
||||
if (client.isOnline()) context.getWriteProxy().flushCache();
|
||||
else
|
||||
// Set all contacts to offline mode
|
||||
localDB.getChats()
|
||||
.stream()
|
||||
.map(Chat::getRecipient)
|
||||
.filter(User.class::isInstance)
|
||||
.map(User.class::cast)
|
||||
.forEach(u -> u.setStatus(UserStatus.OFFLINE));
|
||||
|
||||
final var stage = context.getStage();
|
||||
|
||||
// Pop LoginScene if present
|
||||
if (!context.getSceneContext().isEmpty()) context.getSceneContext().pop();
|
||||
|
||||
// Load ChatScene
|
||||
stage.setMinHeight(400);
|
||||
stage.setMinWidth(843);
|
||||
context.getSceneContext().load(SceneContext.SceneInfo.CHAT_SCENE);
|
||||
stage.centerOnScreen();
|
||||
|
||||
if (StatusTrayIcon.isSupported()) {
|
||||
|
||||
// Configure hide on close
|
||||
stage.setOnCloseRequest(e -> {
|
||||
if (Settings.getInstance().isHideOnClose()) {
|
||||
stage.setIconified(true);
|
||||
e.consume();
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize status tray icon
|
||||
final var trayIcon = new StatusTrayIcon(stage);
|
||||
Settings.getInstance().getItems().get("hideOnClose").setChangeHandler(c -> {
|
||||
if ((Boolean) c) trayIcon.show();
|
||||
else trayIcon.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +235,7 @@ public final class Startup extends Application {
|
||||
localDB.save(client.isOnline());
|
||||
Settings.getInstance().save();
|
||||
|
||||
logger.log(Level.INFO, "Closing connection...");
|
||||
if (client.isOnline()) logger.log(Level.INFO, "Closing connection...");
|
||||
client.close();
|
||||
|
||||
logger.log(Level.INFO, "Envoy was terminated by its user");
|
||||
|
@ -21,15 +21,15 @@ import javafx.collections.ObservableList;
|
||||
import javafx.collections.transformation.FilteredList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.stage.FileChooser;
|
||||
@ -39,13 +39,16 @@ import envoy.client.data.*;
|
||||
import envoy.client.data.audio.AudioRecorder;
|
||||
import envoy.client.data.commands.SystemCommandBuilder;
|
||||
import envoy.client.data.commands.SystemCommandsMap;
|
||||
import envoy.client.event.*;
|
||||
import envoy.client.event.BackEvent;
|
||||
import envoy.client.event.MessageCreationEvent;
|
||||
import envoy.client.event.SendEvent;
|
||||
import envoy.client.net.Client;
|
||||
import envoy.client.net.WriteProxy;
|
||||
import envoy.client.ui.*;
|
||||
import envoy.client.ui.listcell.*;
|
||||
import envoy.client.ui.listcell.ChatControl;
|
||||
import envoy.client.ui.listcell.ListCellFactory;
|
||||
import envoy.client.ui.listcell.MessageListCell;
|
||||
import envoy.client.util.ReflectionUtil;
|
||||
import envoy.constant.Tabs;
|
||||
import envoy.data.*;
|
||||
import envoy.data.Attachment.AttachmentType;
|
||||
import envoy.event.*;
|
||||
@ -93,6 +96,9 @@ public final class ChatScene implements Restorable {
|
||||
@FXML
|
||||
private Button newGroupButton;
|
||||
|
||||
@FXML
|
||||
private Button newContactButton;
|
||||
|
||||
@FXML
|
||||
private TextArea messageTextArea;
|
||||
|
||||
@ -122,42 +128,45 @@ public final class ChatScene implements Restorable {
|
||||
|
||||
@FXML
|
||||
private TextArea contactSearch;
|
||||
|
||||
|
||||
@FXML
|
||||
private VBox contactOperations;
|
||||
|
||||
|
||||
@FXML
|
||||
private TabPane tabPane;
|
||||
|
||||
|
||||
@FXML
|
||||
private Tab contactSearchTab;
|
||||
|
||||
|
||||
@FXML
|
||||
private Tab groupCreationTab;
|
||||
|
||||
private LocalDB localDB;
|
||||
private Client client;
|
||||
private WriteProxy writeProxy;
|
||||
private SceneContext sceneContext;
|
||||
@FXML
|
||||
private HBox contactSpecificOnlineOperations;
|
||||
|
||||
private Chat currentChat;
|
||||
private AudioRecorder recorder;
|
||||
private boolean recording;
|
||||
private Attachment pendingAttachment;
|
||||
private boolean postingPermanentlyDisabled;
|
||||
private final LocalDB localDB = context.getLocalDB();
|
||||
private final Client client = context.getClient();
|
||||
private final WriteProxy writeProxy = context.getWriteProxy();
|
||||
private final SceneContext sceneContext = context.getSceneContext();
|
||||
private final AudioRecorder recorder = new AudioRecorder();
|
||||
private final SystemCommandsMap messageTextAreaCommands = new SystemCommandsMap();
|
||||
private final Tooltip onlyIfOnlineTooltip = new Tooltip("You need to be online to do this");
|
||||
|
||||
private final SystemCommandsMap messageTextAreaCommands = new SystemCommandsMap();
|
||||
private Chat currentChat;
|
||||
private FilteredList<Chat> chats;
|
||||
private boolean recording;
|
||||
private Attachment pendingAttachment;
|
||||
private boolean postingPermanentlyDisabled;
|
||||
|
||||
private static final Settings settings = Settings.getInstance();
|
||||
private static final EventBus eventBus = EventBus.getInstance();
|
||||
private static final Logger logger = EnvoyLog.getLogger(ChatScene.class);
|
||||
private static final Context context = Context.getInstance();
|
||||
|
||||
private static final Image DEFAULT_ATTACHMENT_VIEW_IMAGE = IconUtil.loadIconThemeSensitive("attachment_present", 20);
|
||||
private static final int MAX_MESSAGE_LENGTH = 255;
|
||||
private static final int DEFAULT_ICON_SIZE = 16;
|
||||
|
||||
private FilteredList<Chat> chats;
|
||||
|
||||
/**
|
||||
* Initializes the appearance of certain visual components.
|
||||
*
|
||||
@ -175,30 +184,41 @@ public final class ChatScene implements Restorable {
|
||||
attachmentView.setImage(DEFAULT_ATTACHMENT_VIEW_IMAGE);
|
||||
messageSearchButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("search", DEFAULT_ICON_SIZE)));
|
||||
clientProfilePic.setImage(IconUtil.loadIconThemeSensitive("user_icon", 43));
|
||||
final Rectangle clip = new Rectangle();
|
||||
onlyIfOnlineTooltip.setShowDelay(Duration.millis(250));
|
||||
final var clip = new Rectangle();
|
||||
clip.setWidth(43);
|
||||
clip.setHeight(43);
|
||||
clip.setArcHeight(43);
|
||||
clip.setArcWidth(43);
|
||||
clientProfilePic.setClip(clip);
|
||||
|
||||
|
||||
chatList.setItems(chats = new FilteredList<>(FXCollections.observableList(localDB.getChats())));
|
||||
contactLabel.setText(localDB.getUser().getName());
|
||||
|
||||
initializeSystemCommandsMap();
|
||||
|
||||
Platform.runLater(() -> {
|
||||
if(client.isOnline()) {
|
||||
try {
|
||||
contactSearchTab.setContent(FXMLLoader.load(new File("src/main/resources/fxml/ContactSearchTab.fxml").toURI().toURL()));
|
||||
groupCreationTab.setContent(FXMLLoader.load(new File("src/main/resources/fxml/GroupCreationTab.fxml").toURI().toURL()));
|
||||
} catch (IOException e2) {
|
||||
logger.log(Level.SEVERE, "An error occurred when attempting to load tabs: ", e2);
|
||||
}
|
||||
} else {
|
||||
contactSearchTab.setContent(createOfflineNote());
|
||||
groupCreationTab.setContent(createOfflineNote());
|
||||
final var online = client.isOnline();
|
||||
// no check will be performed in case it has already been disabled - a negative
|
||||
// GroupCreationResult might have been returned
|
||||
if (!newGroupButton.isDisabled()) newGroupButton.setDisable(!online);
|
||||
newContactButton.setDisable(!online);
|
||||
if (online) try {
|
||||
Tooltip.uninstall(contactSpecificOnlineOperations, onlyIfOnlineTooltip);
|
||||
contactSearchTab.setContent(new FXMLLoader().load(getClass().getResourceAsStream("/fxml/ContactSearchTab.fxml")));
|
||||
groupCreationTab.setContent(new FXMLLoader().load(getClass().getResourceAsStream("/fxml/GroupCreationTab.fxml")));
|
||||
} catch (final IOException e2) {
|
||||
logger.log(Level.SEVERE, "An error occurred when attempting to load tabs: ", e2);
|
||||
}
|
||||
else {
|
||||
Tooltip.install(contactSpecificOnlineOperations, onlyIfOnlineTooltip);
|
||||
updateInfoLabel("You are offline", "info-label-warning");
|
||||
}
|
||||
});
|
||||
|
||||
//Listen to backEvents
|
||||
eventBus.register(BackEvent.class, e -> tabPane.getSelectionModel().select(Tabs.CONTACT_LIST));
|
||||
|
||||
|
||||
// Listen to backEvents
|
||||
eventBus.register(BackEvent.class, e -> tabPane.getSelectionModel().select(Tabs.CONTACT_LIST.ordinal()));
|
||||
|
||||
// Listen to received messages
|
||||
eventBus.register(MessageCreationEvent.class, e -> {
|
||||
final var message = e.get();
|
||||
@ -284,22 +304,6 @@ public final class ChatScene implements Restorable {
|
||||
|
||||
eventBus.register(GroupCreationResult.class, e -> Platform.runLater(() -> { newGroupButton.setDisable(!e.get()); }));
|
||||
}
|
||||
|
||||
private AnchorPane createOfflineNote() {
|
||||
AnchorPane anc = new AnchorPane();
|
||||
VBox vBox = new VBox();
|
||||
vBox.setAlignment(Pos.TOP_CENTER);
|
||||
vBox.setPrefWidth(316);
|
||||
Label label = new Label("You have to be online!");
|
||||
label.setPadding(new Insets(50, 0, 5, 0));
|
||||
Button button = new Button("OK");
|
||||
button.setOnAction(e -> eventBus.dispatch(new BackEvent()));
|
||||
vBox.getChildren().add(label);
|
||||
vBox.getChildren().add(button);
|
||||
anc.getChildren().add(vBox);
|
||||
anc.setId("note-background");
|
||||
return anc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all {@code SystemCommands} used in {@code ChatScene}.
|
||||
@ -317,34 +321,6 @@ public final class ChatScene implements Restorable {
|
||||
messageTextAreaCommands.add("DABR", builder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all necessary data via dependency injection-
|
||||
*
|
||||
* @param sceneContext the scene context used to load other scenes
|
||||
* @param localDB the local database form which chats and users are loaded
|
||||
* @param client the client used to request ID generators
|
||||
* @param writeProxy the write proxy used to send messages and other data to
|
||||
* the server
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public void initializeData(SceneContext sceneContext, LocalDB localDB, Client client, WriteProxy writeProxy) {
|
||||
this.sceneContext = sceneContext;
|
||||
this.localDB = localDB;
|
||||
this.client = client;
|
||||
this.writeProxy = writeProxy;
|
||||
|
||||
chats = new FilteredList<>(FXCollections.observableList(localDB.getChats()));
|
||||
chatList.setItems(chats);
|
||||
contactLabel.setText(localDB.getUser().getName());
|
||||
MessageControl.setLocalDB(localDB);
|
||||
MessageControl.setSceneContext(sceneContext);
|
||||
|
||||
if (!client.isOnline()) updateInfoLabel("You are offline", "infoLabel-info");
|
||||
|
||||
recorder = new AudioRecorder();
|
||||
initializeSystemCommandsMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestore() { updateRemainingCharsLabel(); }
|
||||
|
||||
@ -423,10 +399,7 @@ public final class ChatScene implements Restorable {
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
@FXML
|
||||
private void settingsButtonClicked() {
|
||||
sceneContext.load(SceneContext.SceneInfo.SETTINGS_SCENE);
|
||||
sceneContext.<SettingsScene>getController().initializeData(sceneContext, client);
|
||||
}
|
||||
private void settingsButtonClicked() { sceneContext.load(SceneContext.SceneInfo.SETTINGS_SCENE); }
|
||||
|
||||
/**
|
||||
* Actions to perform when the "Add Contact" - Button has been clicked.
|
||||
@ -434,15 +407,10 @@ public final class ChatScene implements Restorable {
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
@FXML
|
||||
private void addContactButtonClicked() {
|
||||
tabPane.getSelectionModel().select(Tabs.CONTACT_SEARCH);
|
||||
}
|
||||
|
||||
private void addContactButtonClicked() { tabPane.getSelectionModel().select(Tabs.CONTACT_SEARCH.ordinal()); }
|
||||
|
||||
@FXML
|
||||
private void groupCreationButtonClicked() {
|
||||
eventBus.dispatch(new LoadGroupCreationEvent(localDB));
|
||||
tabPane.getSelectionModel().select(Tabs.GROUP_CREATION);
|
||||
}
|
||||
private void groupCreationButtonClicked() { tabPane.getSelectionModel().select(Tabs.GROUP_CREATION.ordinal()); }
|
||||
|
||||
@FXML
|
||||
private void voiceButtonClicked() {
|
||||
@ -603,7 +571,7 @@ public final class ChatScene implements Restorable {
|
||||
if (!infoLabel.getText().equals(noMoreMessaging))
|
||||
// Informing the user that he is a f*cking moron and should use Envoy online
|
||||
// because he ran out of messageIDs to use
|
||||
updateInfoLabel(noMoreMessaging, "infoLabel-error");
|
||||
updateInfoLabel(noMoreMessaging, "info-label-error");
|
||||
}
|
||||
}
|
||||
|
||||
@ -648,7 +616,7 @@ public final class ChatScene implements Restorable {
|
||||
postButton.setDisable(true);
|
||||
messageTextArea.setDisable(true);
|
||||
messageTextArea.clear();
|
||||
updateInfoLabel("You need to go online to send more messages", "infoLabel-error");
|
||||
updateInfoLabel("You need to go online to send more messages", "info-label-error");
|
||||
return;
|
||||
}
|
||||
final var text = messageTextArea.getText().strip();
|
||||
|
@ -4,15 +4,14 @@ import static java.util.function.Predicate.not;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
import envoy.client.data.Chat;
|
||||
import envoy.client.data.Context;
|
||||
import envoy.client.data.LocalDB;
|
||||
import envoy.client.event.BackEvent;
|
||||
import envoy.client.event.LoadGroupCreationEvent;
|
||||
import envoy.client.event.SendEvent;
|
||||
import envoy.client.ui.listcell.ContactControl;
|
||||
import envoy.client.ui.listcell.ListCellFactory;
|
||||
@ -43,7 +42,7 @@ public class GroupCreationTab {
|
||||
|
||||
@FXML
|
||||
private Button createButton;
|
||||
|
||||
|
||||
@FXML
|
||||
private Button cancelButton;
|
||||
|
||||
@ -52,42 +51,38 @@ public class GroupCreationTab {
|
||||
|
||||
@FXML
|
||||
private ListView<User> userList;
|
||||
|
||||
|
||||
@FXML
|
||||
private Label errorMessageLabel;
|
||||
|
||||
|
||||
@FXML
|
||||
private Button proceedDupButton;
|
||||
|
||||
private Button proceedDuplicateButton;
|
||||
|
||||
@FXML
|
||||
private Button cancelDupButton;
|
||||
|
||||
private Button cancelDuplicateButton;
|
||||
|
||||
@FXML
|
||||
private HBox errorProceedBox;
|
||||
|
||||
private LocalDB localDB;
|
||||
private String name;
|
||||
|
||||
private final LocalDB localDB = Context.getInstance().getLocalDB();
|
||||
|
||||
private static final EventBus eventBus = EventBus.getInstance();
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
userList.setCellFactory(new ListCellFactory<>(ContactControl::new));
|
||||
userList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||
|
||||
eventBus.register(LoadGroupCreationEvent.class, e -> {
|
||||
createButton.setDisable(true);
|
||||
this.localDB = e.get();
|
||||
userList.getItems().clear();
|
||||
Platform.runLater(() -> userList.getItems()
|
||||
.addAll(localDB.getChats()
|
||||
.stream()
|
||||
.map(Chat::getRecipient)
|
||||
.filter(User.class::isInstance)
|
||||
.filter(not(localDB.getUser()::equals))
|
||||
.map(User.class::cast)
|
||||
.collect(Collectors.toList())));
|
||||
});
|
||||
createButton.setDisable(true);
|
||||
userList.getItems()
|
||||
.addAll(localDB.getChats()
|
||||
.stream()
|
||||
.map(Chat::getRecipient)
|
||||
.filter(User.class::isInstance)
|
||||
.filter(not(localDB.getUser()::equals))
|
||||
.map(User.class::cast)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,9 +91,7 @@ public class GroupCreationTab {
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
@FXML
|
||||
private void userListClicked() {
|
||||
createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank());
|
||||
}
|
||||
private void userListClicked() { createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); }
|
||||
|
||||
/**
|
||||
* Checks, whether the {@code createButton} can be enabled because text is
|
||||
@ -173,7 +166,7 @@ public class GroupCreationTab {
|
||||
setErrorMessageLabelSize(0);
|
||||
setProcessPaneSize(0);
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void proceedOnNameDuplication() {
|
||||
createButton.setDisable(false);
|
||||
@ -184,7 +177,7 @@ public class GroupCreationTab {
|
||||
setProcessPaneSize(0);
|
||||
groupNameField.clear();
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void cancelOnNameDuplication() {
|
||||
createButton.setDisable(false);
|
||||
@ -193,20 +186,20 @@ public class GroupCreationTab {
|
||||
setProcessPaneSize(0);
|
||||
groupNameField.clear();
|
||||
}
|
||||
|
||||
|
||||
private void setErrorMessageLabelSize(int value) {
|
||||
errorMessageLabel.setPrefHeight(value);
|
||||
errorMessageLabel.setMinHeight(value);
|
||||
errorMessageLabel.setMaxHeight(value);
|
||||
}
|
||||
|
||||
|
||||
private void setProcessPaneSize(int value) {
|
||||
proceedDupButton.setPrefHeight(value);
|
||||
proceedDupButton.setMinHeight(value);
|
||||
proceedDupButton.setMaxHeight(value);
|
||||
cancelDupButton.setPrefHeight(value);
|
||||
cancelDupButton.setMinHeight(value);
|
||||
cancelDupButton.setMaxHeight(value);
|
||||
proceedDuplicateButton.setPrefHeight(value);
|
||||
proceedDuplicateButton.setMinHeight(value);
|
||||
proceedDuplicateButton.setMaxHeight(value);
|
||||
cancelDuplicateButton.setPrefHeight(value);
|
||||
cancelDuplicateButton.setMinHeight(value);
|
||||
cancelDuplicateButton.setMaxHeight(value);
|
||||
errorProceedBox.setPrefHeight(value);
|
||||
errorProceedBox.setMinHeight(value);
|
||||
errorProceedBox.setMaxHeight(value);
|
||||
|
@ -1,9 +1,5 @@
|
||||
package envoy.client.ui.controller;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -14,16 +10,12 @@ import javafx.scene.control.*;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.image.ImageView;
|
||||
|
||||
import envoy.client.data.*;
|
||||
import envoy.client.net.Client;
|
||||
import envoy.client.net.WriteProxy;
|
||||
import envoy.client.ui.*;
|
||||
import envoy.client.data.ClientConfig;
|
||||
import envoy.client.ui.IconUtil;
|
||||
import envoy.client.ui.Startup;
|
||||
import envoy.data.LoginCredentials;
|
||||
import envoy.data.User;
|
||||
import envoy.data.User.UserStatus;
|
||||
import envoy.event.EventBus;
|
||||
import envoy.event.HandshakeRejection;
|
||||
import envoy.exception.EnvoyException;
|
||||
import envoy.util.Bounds;
|
||||
import envoy.util.EnvoyLog;
|
||||
|
||||
@ -65,17 +57,11 @@ public final class LoginScene {
|
||||
@FXML
|
||||
private ImageView logo;
|
||||
|
||||
private Client client;
|
||||
private LocalDB localDB;
|
||||
private CacheMap cacheMap;
|
||||
private SceneContext sceneContext;
|
||||
|
||||
private boolean registration = false;
|
||||
|
||||
private static final Logger logger = EnvoyLog.getLogger(LoginScene.class);
|
||||
private static final EventBus eventBus = EventBus.getInstance();
|
||||
private static final ClientConfig config = ClientConfig.getInstance();
|
||||
private static final Settings settings = Settings.getInstance();
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
@ -85,32 +71,9 @@ public final class LoginScene {
|
||||
eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
|
||||
|
||||
logo.setImage(IconUtil.loadIcon("envoy_logo"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the login dialog using the FXML file {@code LoginDialog.fxml}.
|
||||
*
|
||||
* @param client the client used to perform the handshake
|
||||
* @param localDB the local database used for offline login
|
||||
* @param cacheMap the map of all caches needed
|
||||
* @param sceneContext the scene context used to initialize the chat scene
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public void initializeData(Client client, LocalDB localDB, CacheMap cacheMap, SceneContext sceneContext) {
|
||||
this.client = client;
|
||||
this.localDB = localDB;
|
||||
this.cacheMap = cacheMap;
|
||||
this.sceneContext = sceneContext;
|
||||
|
||||
// Prepare handshake
|
||||
localDB.loadIDGenerator();
|
||||
|
||||
// Set initial cursor
|
||||
userTextField.requestFocus();
|
||||
|
||||
// Perform automatic login if configured
|
||||
if (config.hasLoginCredentials())
|
||||
performHandshake(new LoginCredentials(config.getUser(), config.getPassword(), false, Startup.VERSION, loadLastSync(config.getUser())));
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -123,15 +86,12 @@ public final class LoginScene {
|
||||
} else if (!Bounds.isValidContactName(userTextField.getText())) {
|
||||
new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait();
|
||||
userTextField.clear();
|
||||
} else performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText(), registration,
|
||||
Startup.VERSION, loadLastSync(userTextField.getText())));
|
||||
} else Startup.performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText(), registration, Startup.VERSION,
|
||||
Startup.loadLastSync(userTextField.getText())));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void offlineModeButtonPressed() {
|
||||
attemptOfflineMode(new LoginCredentials(userTextField.getText(), passwordField.getText(), false, Startup.VERSION,
|
||||
loadLastSync(userTextField.getText())));
|
||||
}
|
||||
private void offlineModeButtonPressed() { Startup.attemptOfflineMode(userTextField.getText()); }
|
||||
|
||||
@FXML
|
||||
private void registerSwitchPressed() {
|
||||
@ -159,102 +119,4 @@ public final class LoginScene {
|
||||
logger.log(Level.INFO, "The login process has been cancelled. Exiting...");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private Instant loadLastSync(String identifier) {
|
||||
try {
|
||||
localDB.loadUsers();
|
||||
localDB.setUser(localDB.getUsers().get(identifier));
|
||||
localDB.initializeUserStorage();
|
||||
localDB.loadUserData();
|
||||
} catch (final Exception e) {
|
||||
// User storage empty, wrong user name etc. -> default lastSync
|
||||
}
|
||||
return localDB.getLastSync();
|
||||
}
|
||||
|
||||
private void performHandshake(LoginCredentials credentials) {
|
||||
try {
|
||||
client.performHandshake(credentials, cacheMap);
|
||||
if (client.isOnline()) {
|
||||
loadChatScene();
|
||||
client.initReceiver(localDB, cacheMap);
|
||||
}
|
||||
} catch (IOException | InterruptedException | TimeoutException e) {
|
||||
logger.log(Level.INFO, "Could not connect to server. Entering offline mode...");
|
||||
attemptOfflineMode(credentials);
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptOfflineMode(LoginCredentials credentials) {
|
||||
try {
|
||||
// Try entering offline mode
|
||||
localDB.loadUsers();
|
||||
final User clientUser = localDB.getUsers().get(credentials.getIdentifier());
|
||||
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
||||
client.setSender(clientUser);
|
||||
loadChatScene();
|
||||
} catch (final Exception e) {
|
||||
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
||||
logger.log(Level.SEVERE, "Offline mode could not be loaded: ", e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadChatScene() {
|
||||
|
||||
// Set client user in local database
|
||||
localDB.setUser(client.getSender());
|
||||
|
||||
// Initialize chats in local database
|
||||
try {
|
||||
localDB.initializeUserStorage();
|
||||
localDB.loadUserData();
|
||||
} catch (final FileNotFoundException e) {
|
||||
// The local database file has not yet been created, probably first login
|
||||
} catch (final Exception e) {
|
||||
new Alert(AlertType.ERROR, "Error while loading local database: " + e + "\nChats will not be stored locally.").showAndWait();
|
||||
logger.log(Level.WARNING, "Could not load local database: ", e);
|
||||
}
|
||||
|
||||
// Initialize write proxy
|
||||
final var writeProxy = new WriteProxy(client, localDB);
|
||||
|
||||
localDB.synchronize();
|
||||
|
||||
if (client.isOnline()) writeProxy.flushCache();
|
||||
else
|
||||
// Set all contacts to offline mode
|
||||
localDB.getChats()
|
||||
.stream()
|
||||
.map(Chat::getRecipient)
|
||||
.filter(User.class::isInstance)
|
||||
.map(User.class::cast)
|
||||
.forEach(u -> u.setStatus(UserStatus.OFFLINE));
|
||||
|
||||
// Load ChatScene
|
||||
sceneContext.pop();
|
||||
sceneContext.getStage().setMinHeight(400);
|
||||
sceneContext.getStage().setMinWidth(843);
|
||||
sceneContext.load(SceneContext.SceneInfo.CHAT_SCENE);
|
||||
sceneContext.<ChatScene>getController().initializeData(sceneContext, localDB, client, writeProxy);
|
||||
sceneContext.getStage().centerOnScreen();
|
||||
|
||||
if (StatusTrayIcon.isSupported()) {
|
||||
|
||||
// Configure hide on close
|
||||
sceneContext.getStage().setOnCloseRequest(e -> {
|
||||
if (settings.isHideOnClose()) {
|
||||
sceneContext.getStage().setIconified(true);
|
||||
e.consume();
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize status tray icon
|
||||
final var trayIcon = new StatusTrayIcon(sceneContext.getStage());
|
||||
settings.getItems().get("hideOnClose").setChangeHandler(c -> {
|
||||
if ((Boolean) c) trayIcon.show();
|
||||
else trayIcon.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.TitledPane;
|
||||
|
||||
import envoy.client.data.Context;
|
||||
import envoy.client.net.Client;
|
||||
import envoy.client.ui.SceneContext;
|
||||
import envoy.client.ui.listcell.AbstractListCell;
|
||||
@ -26,21 +27,8 @@ public final class SettingsScene {
|
||||
@FXML
|
||||
private TitledPane titledPane;
|
||||
|
||||
private SceneContext sceneContext;
|
||||
|
||||
/**
|
||||
* @param sceneContext enables the user to return to the chat scene
|
||||
* @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
|
||||
*/
|
||||
public void initializeData(SceneContext sceneContext, Client client) {
|
||||
this.sceneContext = sceneContext;
|
||||
settingsList.getItems().add(new GeneralSettingsPane());
|
||||
settingsList.getItems().add(new UserSettingsPane(sceneContext, client.getSender(), client.isOnline()));
|
||||
settingsList.getItems().add(new DownloadSettingsPane(sceneContext));
|
||||
settingsList.getItems().add(new BugReportPane(client.getSender(), client.isOnline()));
|
||||
}
|
||||
private final Client client = Context.getInstance().getClient();
|
||||
private final SceneContext sceneContext = Context.getInstance().getSceneContext();
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
@ -49,6 +37,10 @@ public final class SettingsScene {
|
||||
@Override
|
||||
protected Label renderItem(SettingsPane item) { return new Label(item.getTitle()); }
|
||||
});
|
||||
settingsList.getItems().add(new GeneralSettingsPane());
|
||||
settingsList.getItems().add(new UserSettingsPane(sceneContext, client.getSender(), client.isOnline()));
|
||||
settingsList.getItems().add(new DownloadSettingsPane(sceneContext));
|
||||
settingsList.getItems().add(new BugReportPane(client.getSender(), client.isOnline()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
29
client/src/main/java/envoy/client/ui/controller/Tabs.java
Normal file
29
client/src/main/java/envoy/client/ui/controller/Tabs.java
Normal file
@ -0,0 +1,29 @@
|
||||
package envoy.client.ui.controller;
|
||||
|
||||
/**
|
||||
* Provides options to select different tabs.
|
||||
* <p>
|
||||
* Project: <strong>client</strong><br>
|
||||
* File: <strong>Tabs.java</strong><br>
|
||||
* Created: <strong>30.8.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public enum Tabs {
|
||||
|
||||
/**
|
||||
* Selects the {@code contact list} tab.
|
||||
*/
|
||||
CONTACT_LIST,
|
||||
|
||||
/**
|
||||
* Selects the {@code contact search} tab.
|
||||
*/
|
||||
CONTACT_SEARCH,
|
||||
|
||||
/**
|
||||
* Selects the {@code group creation} tab.
|
||||
*/
|
||||
GROUP_CREATION
|
||||
}
|
@ -19,6 +19,7 @@ import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.FileChooser;
|
||||
|
||||
import envoy.client.data.Context;
|
||||
import envoy.client.data.LocalDB;
|
||||
import envoy.client.data.Settings;
|
||||
import envoy.client.ui.AudioControl;
|
||||
@ -43,11 +44,10 @@ import envoy.util.EnvoyLog;
|
||||
*/
|
||||
public final class MessageControl extends Label {
|
||||
|
||||
private boolean ownMessage;
|
||||
private final boolean ownMessage;
|
||||
|
||||
private static LocalDB localDB;
|
||||
|
||||
private static SceneContext sceneContext;
|
||||
private final LocalDB localDB = Context.getInstance().getLocalDB();
|
||||
private final SceneContext sceneContext = Context.getInstance().getSceneContext();
|
||||
|
||||
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss")
|
||||
.withZone(ZoneId.systemDefault());
|
||||
@ -177,22 +177,10 @@ public final class MessageControl extends Label {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public boolean isOwnMessage() { return ownMessage; }
|
||||
|
||||
/**
|
||||
* @param sceneContext the scene context storing the stage used in Envoy
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public static void setSceneContext(SceneContext sceneContext) { MessageControl.sceneContext = sceneContext; }
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public abstract class OnlyIfOnlineSettingsPane extends SettingsPane {
|
||||
|
||||
if (!online) {
|
||||
final var infoLabel = new Label("You shall not pass!\n(... Unless you would happen to be online)");
|
||||
infoLabel.setId("infoLabel-warning");
|
||||
infoLabel.setId("info-label-warning");
|
||||
infoLabel.setWrapText(true);
|
||||
getChildren().add(infoLabel);
|
||||
setBackground(new Background(new BackgroundFill(Color.grayRgb(100, 0.3), CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
|
@ -1,17 +0,0 @@
|
||||
package envoy.constant;
|
||||
|
||||
/**
|
||||
* Project: <strong>client</strong><br>
|
||||
* File: <strong>Tabs.java</strong><br>
|
||||
* Created: <strong>Aug 30, 2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public class Tabs {
|
||||
private Tabs() {}
|
||||
|
||||
public static int CONTACT_LIST = 0;
|
||||
public static int CONTACT_SEARCH = 1;
|
||||
public static int GROUP_CREATION = 2;
|
||||
}
|
@ -107,19 +107,19 @@
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
#infoLabel-success {
|
||||
#info-label-success {
|
||||
-fx-text-fill: #00FF00;
|
||||
}
|
||||
|
||||
#infoLabel-info {
|
||||
#info-label-info {
|
||||
-fx-text-fill: yellow;
|
||||
}
|
||||
|
||||
#infoLabel-warning {
|
||||
#info-label-warning {
|
||||
-fx-text-fill: orange;
|
||||
}
|
||||
|
||||
#infoLabel-error {
|
||||
#info-label-error {
|
||||
-fx-text-fill: red;
|
||||
}
|
||||
|
||||
@ -136,9 +136,9 @@
|
||||
}
|
||||
|
||||
.tab-pane {
|
||||
-fx-tab-max-height: 0 ;
|
||||
-fx-tab-max-height: 0.0 ;
|
||||
}
|
||||
.tab-pane .tab-header-area {
|
||||
visibility: hidden ;
|
||||
-fx-padding: -20 0 0 0;
|
||||
-fx-padding: -20.0 0.0 0.0 0.0;
|
||||
}
|
||||
|
@ -21,107 +21,146 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<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">
|
||||
<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">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="NEVER" maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" />
|
||||
<ColumnConstraints hgrow="NEVER"
|
||||
maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />
|
||||
<ColumnConstraints hgrow="ALWAYS"
|
||||
maxWidth="1.7976931348623157E308" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="122.00000508626302" minHeight="-Infinity" prefHeight="96.66666158040364" vgrow="NEVER" />
|
||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="50.0" prefHeight="949.3333384195963" vgrow="ALWAYS" />
|
||||
<RowConstraints maxHeight="59.3333740234375" minHeight="-Infinity" prefHeight="22.666748046875" vgrow="NEVER" />
|
||||
<RowConstraints maxHeight="120.0" minHeight="-Infinity" prefHeight="83.333251953125" vgrow="NEVER" />
|
||||
<RowConstraints maxHeight="122.00000508626302"
|
||||
minHeight="-Infinity" prefHeight="96.66666158040364" vgrow="NEVER" />
|
||||
<RowConstraints maxHeight="1.7976931348623157E308"
|
||||
minHeight="50.0" prefHeight="949.3333384195963" vgrow="ALWAYS" />
|
||||
<RowConstraints maxHeight="59.3333740234375"
|
||||
minHeight="-Infinity" prefHeight="22.666748046875" vgrow="NEVER" />
|
||||
<RowConstraints maxHeight="120.0" minHeight="-Infinity"
|
||||
prefHeight="83.333251953125" vgrow="NEVER" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<TabPane fx:id="tabPane" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
|
||||
<tabs>
|
||||
<Tab text="">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0">
|
||||
<children>
|
||||
<VBox fx:id="contactOperations" prefHeight="3000.0" prefWidth="316.0">
|
||||
<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="contact-search-input" 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>
|
||||
<Insets left="12.0" right="12.0" />
|
||||
</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" onAction="#groupCreationButtonClicked" 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="chat-list" fx:id="chatList" focusTraversable="false" onMouseClicked="#chatListClicked" prefWidth="316.0" VBox.vgrow="ALWAYS">
|
||||
<contextMenu>
|
||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||
<items>
|
||||
<MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
|
||||
</items>
|
||||
</ContextMenu>
|
||||
</contextMenu>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
||||
</padding>
|
||||
</ListView>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="contactSearchTab" text="">
|
||||
<content>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="groupCreationTab" text="" />
|
||||
</tabs>
|
||||
<GridPane.margin>
|
||||
<Insets right="1.0" />
|
||||
</GridPane.margin>
|
||||
</TabPane>
|
||||
<TabPane fx:id="tabPane" prefHeight="200.0" prefWidth="200.0"
|
||||
tabClosingPolicy="UNAVAILABLE" GridPane.rowIndex="1"
|
||||
GridPane.rowSpan="2147483647">
|
||||
<tabs>
|
||||
<Tab text="">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0">
|
||||
<children>
|
||||
<VBox fx:id="contactOperations" prefHeight="3000.0"
|
||||
prefWidth="316.0">
|
||||
<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="contact-search-input"
|
||||
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>
|
||||
<Insets left="12.0" right="12.0" />
|
||||
</padding>
|
||||
</TextArea>
|
||||
</graphic>
|
||||
<VBox.margin>
|
||||
<Insets left="10.0" right="10.0" top="3.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<HBox fx:id="contactSpecificOnlineOperations"
|
||||
id="underline" alignment="TOP_CENTER" prefHeight="41.0"
|
||||
prefWidth="296.0" spacing="5.0">
|
||||
<children>
|
||||
<Button fx:id="newContactButton"
|
||||
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 fx:id="newGroupButton"
|
||||
mnemonicParsing="false"
|
||||
onAction="#groupCreationButtonClicked" 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="chat-list" fx:id="chatList"
|
||||
focusTraversable="false" onMouseClicked="#chatListClicked"
|
||||
prefWidth="316.0" VBox.vgrow="ALWAYS">
|
||||
<contextMenu>
|
||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||
<items>
|
||||
<MenuItem fx:id="deleteContactMenuItem"
|
||||
mnemonicParsing="false" onAction="#deleteContact"
|
||||
text="Delete" />
|
||||
</items>
|
||||
</ContextMenu>
|
||||
</contextMenu>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
||||
</padding>
|
||||
</ListView>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="contactSearchTab" text="">
|
||||
<content>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab fx:id="groupCreationTab" text="" />
|
||||
</tabs>
|
||||
<GridPane.margin>
|
||||
<Insets right="1.0" />
|
||||
</GridPane.margin>
|
||||
</TabPane>
|
||||
<HBox id="top-bar" alignment="CENTER_LEFT" prefHeight="100.0">
|
||||
<children>
|
||||
<ImageView id="profile-pic" fx:id="clientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView id="profile-pic" 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="transparent-background" fx:id="contactLabel" prefHeight="27.0" prefWidth="134.0">
|
||||
<Label id="transparent-background" fx:id="contactLabel"
|
||||
prefHeight="27.0" prefWidth="134.0">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
@ -132,10 +171,14 @@
|
||||
<Insets left="10.0" top="5.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<Region id="transparent-background" prefHeight="77.0" prefWidth="115.0" />
|
||||
<VBox id="transparent-background" alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||
<Region id="transparent-background" prefHeight="77.0"
|
||||
prefWidth="115.0" />
|
||||
<VBox id="transparent-background" 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="">
|
||||
<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>
|
||||
@ -156,7 +199,10 @@
|
||||
<Insets bottom="1.0" right="1.0" />
|
||||
</GridPane.margin>
|
||||
</HBox>
|
||||
<ListView id="message-list" fx:id="messageList" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2147483647" GridPane.rowIndex="1" GridPane.rowSpan="2">
|
||||
<ListView id="message-list" fx:id="messageList"
|
||||
focusTraversable="false" GridPane.columnIndex="1"
|
||||
GridPane.columnSpan="2147483647" GridPane.rowIndex="1"
|
||||
GridPane.rowSpan="2">
|
||||
<GridPane.margin>
|
||||
<Insets />
|
||||
</GridPane.margin>
|
||||
@ -164,11 +210,17 @@
|
||||
<Insets bottom="5.0" top="5.0" />
|
||||
</padding>
|
||||
</ListView>
|
||||
<HBox alignment="CENTER" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||
<HBox alignment="CENTER" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="3">
|
||||
<children>
|
||||
<Label id="text-enter-container" alignment="CENTER" minWidth="300.0" prefHeight="100.0" prefWidth="800.0">
|
||||
<Label id="text-enter-container" alignment="CENTER"
|
||||
minWidth="300.0" prefHeight="100.0" prefWidth="800.0">
|
||||
<graphic>
|
||||
<TextArea id="message-enter" fx:id="messageTextArea" disable="true" onInputMethodTextChanged="#messageTextUpdated" onKeyPressed="#checkPostConditions" onKeyTyped="#checkKeyCombination" prefHeight="100.0" prefWidth="1250.0" promptText="Enter Message" wrapText="true">
|
||||
<TextArea id="message-enter" 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>
|
||||
@ -180,30 +232,42 @@
|
||||
</Label>
|
||||
<HBox prefHeight="38.0" prefWidth="100.0" spacing="5.0">
|
||||
<children>
|
||||
<Button id="round-button" fx:id="postButton" defaultButton="true" disable="true" minWidth="40.0" mnemonicParsing="true" onAction="#postMessage" prefHeight="40.0" prefWidth="40.0" text="Post">
|
||||
<Button id="round-button" fx:id="postButton"
|
||||
defaultButton="true" disable="true" minWidth="40.0"
|
||||
mnemonicParsing="true" onAction="#postMessage" prefHeight="40.0"
|
||||
prefWidth="40.0" text="Post">
|
||||
<tooltip>
|
||||
<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" />
|
||||
<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" />
|
||||
</tooltip>
|
||||
<contextMenu>
|
||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#copyAndPostMessage" text="Copy and Send" />
|
||||
<MenuItem mnemonicParsing="false"
|
||||
onAction="#copyAndPostMessage" text="Copy and Send" />
|
||||
</items>
|
||||
</ContextMenu>
|
||||
</contextMenu>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button id="round-button" fx:id="voiceButton" disable="true" minWidth="40.0" onAction="#voiceButtonClicked" prefHeight="40.0" prefWidth="40.0">
|
||||
<Button id="round-button" fx:id="voiceButton"
|
||||
disable="true" minWidth="40.0" onAction="#voiceButtonClicked"
|
||||
prefHeight="40.0" prefWidth="40.0">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Button>
|
||||
<Button id="round-button" fx:id="attachmentButton" disable="true" minWidth="40.0" mnemonicParsing="false" onAction="#attachmentButtonClicked" prefHeight="40.0" prefWidth="40.0">
|
||||
<Button id="round-button" fx:id="attachmentButton"
|
||||
disable="true" minWidth="40.0" mnemonicParsing="false"
|
||||
onAction="#attachmentButtonClicked" prefHeight="40.0"
|
||||
prefWidth="40.0">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
@ -218,9 +282,13 @@
|
||||
<Insets bottom="40.0" left="10.0" right="10.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</HBox>
|
||||
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<HBox prefHeight="100.0" prefWidth="200.0"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<children>
|
||||
<Label id="remaining-chars-label" 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">
|
||||
<Label id="remaining-chars-label" 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>
|
||||
<Insets bottom="5.0" top="5.0" />
|
||||
</padding>
|
||||
@ -228,17 +296,23 @@
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</opaqueInsets>
|
||||
<tooltip>
|
||||
<Tooltip text="Shows how many chars you can still enter in this message" wrapText="true" />
|
||||
<Tooltip
|
||||
text="Shows how many chars you can still enter in this message"
|
||||
wrapText="true" />
|
||||
</tooltip>
|
||||
</Label>
|
||||
<Label fx:id="infoLabel" text="Something happened" textFill="#faa007" visible="false" wrapText="true">
|
||||
<Label fx:id="infoLabel" text="Something happened"
|
||||
textFill="#faa007" visible="false" wrapText="true">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</HBox>
|
||||
<ImageView fx:id="attachmentView" pickOnBounds="true" preserveRatio="true" visible="false" GridPane.columnIndex="1" GridPane.columnSpan="2147483647" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
||||
<ImageView fx:id="attachmentView" pickOnBounds="true"
|
||||
preserveRatio="true" visible="false" GridPane.columnIndex="1"
|
||||
GridPane.columnSpan="2147483647" GridPane.halignment="RIGHT"
|
||||
GridPane.rowIndex="2">
|
||||
<viewport>
|
||||
<Rectangle2D height="20.0" width="20.0" />
|
||||
</viewport>
|
||||
@ -246,14 +320,18 @@
|
||||
<Insets bottom="5.0" right="10.0" top="5.0" />
|
||||
</GridPane.margin>
|
||||
</ImageView>
|
||||
<HBox id="top-bar" alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<HBox id="top-bar" alignment="CENTER_LEFT" prefHeight="100.0"
|
||||
prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<children>
|
||||
<ImageView id="profile-pic" fx:id="recipientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
|
||||
<ImageView id="profile-pic" 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">
|
||||
<VBox alignment="CENTER_LEFT" prefHeight="97.0"
|
||||
prefWidth="316.0">
|
||||
<children>
|
||||
<Label fx:id="topBarContactLabel" text="">
|
||||
<font>
|
||||
@ -266,8 +344,12 @@
|
||||
<Insets left="15.0" />
|
||||
</HBox.margin>
|
||||
</VBox>
|
||||
<Region prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
|
||||
<Button id="round-button" fx:id="messageSearchButton" contentDisplay="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="40.0" prefWidth="40.0" visible="false">
|
||||
<Region prefHeight="200.0" prefWidth="200.0"
|
||||
HBox.hgrow="ALWAYS" />
|
||||
<Button id="round-button" 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>
|
||||
|
@ -40,8 +40,8 @@
|
||||
<Label id="infoLabel-error" fx:id="errorMessageLabel" maxHeight="0.0" minHeight="0.0" prefHeight="0.0" textAlignment="CENTER" textFill="RED" VBox.vgrow="ALWAYS" />
|
||||
<HBox fx:id="errorProceedBox" alignment="TOP_CENTER" maxHeight="0.0" minHeight="0.0" prefHeight="0.0" prefWidth="316.0" spacing="5.0">
|
||||
<children>
|
||||
<Button id="proceed-button" fx:id="proceedDupButton" maxHeight="0.0" minHeight="0.0" mnemonicParsing="false" onAction="#proceedOnNameDuplication" prefHeight="0.0" text="Proceed" />
|
||||
<Button id="proceed-button" fx:id="cancelDupButton" maxHeight="0.0" minHeight="0.0" mnemonicParsing="false" onAction="#cancelOnNameDuplication" prefHeight="0.0" text="Cancel" />
|
||||
<Button id="proceed-button" fx:id="proceedDuplicateButton" maxHeight="0.0" minHeight="0.0" mnemonicParsing="false" onAction="#proceedOnNameDuplication" prefHeight="0.0" text="Proceed" />
|
||||
<Button id="proceed-button" fx:id="cancelDuplicateButton" maxHeight="0.0" minHeight="0.0" mnemonicParsing="false" onAction="#cancelOnNameDuplication" prefHeight="0.0" text="Cancel" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox id="underline" alignment="TOP_CENTER" prefWidth="200.0" spacing="5.0">
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user