Organize project into client and lib subprojects
This commit is contained in:
parent
93cf550a9b
commit
b6d02eaaec
75 changed files with 336 additions and 228 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
.gradle
|
||||
**/build/
|
||||
!src/**/build/
|
||||
!client/src/**/build/
|
||||
|
||||
# Ignore sqlite db files
|
||||
/*.db
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="14" />
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
24
.idea/dataSources.xml
Normal file
24
.idea/dataSources.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="clavardator_test" uuid="ef1353b8-2399-4195-b9fc-3ae9b9c61351">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/clavardator_test.db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="clavardator" uuid="9e12684a-a723-44a7-82c6-f07ab8912b44">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/clavardator.db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
<libraries>
|
||||
<library>
|
||||
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.31.1/sqlite-jdbc-3.31.1.jar</url>
|
||||
</library>
|
||||
</libraries>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -9,6 +9,8 @@
|
|||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/client" />
|
||||
<option value="$PROJECT_DIR$/lib" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
|
|
29
.idea/modules/clavardator.main.iml
Normal file
29
.idea/modules/clavardator.main.iml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/../../build/classes/java/main" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../client/src/main">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../client/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../client/src/main/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.jfoenix:jfoenix:9.0.10" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-fxml:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-controls:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-controls:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-graphics:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-graphics:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-base:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-base:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:20.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.xerial:sqlite-jdbc:3.32.3" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.kordamp.ikonli:ikonli-javafx:12.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.kordamp.ikonli:ikonli-fontawesome5-pack:12.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.json:json:20201115" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.kordamp.ikonli:ikonli-core:12.0.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.openjfx:javafx-graphics:mac:11.0.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.openjfx:javafx-graphics:win:11.0.2" level="project" />
|
||||
</component>
|
||||
</module>
|
36
.idea/modules/clavardator.test.iml
Normal file
36
.idea/modules/clavardator.test.iml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output-test url="file://$MODULE_DIR$/../../build/classes/java/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../client/src/test">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../client/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../client/src/test/resources" type="java-test-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="clavardator.main" />
|
||||
<orderEntry type="library" name="Gradle: com.jfoenix:jfoenix:9.0.10" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-fxml:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-controls:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-controls:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-graphics:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-graphics:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-base:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.openjfx:javafx-base:linux:11.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:20.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.xerial:sqlite-jdbc:3.32.3" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.kordamp.ikonli:ikonli-javafx:12.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.kordamp.ikonli:ikonli-fontawesome5-pack:12.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.json:json:20201115" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.junit.jupiter:junit-jupiter-api:5.7.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.kordamp.ikonli:ikonli-core:12.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.junit.platform:junit-platform-commons:1.7.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.openjfx:javafx-graphics:mac:11.0.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.openjfx:javafx-graphics:win:11.0.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.jupiter:junit-jupiter-engine:5.7.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.platform:junit-platform-engine:1.7.0" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java/fr/insa/clavardator/db/DatabaseController.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/client/src/main/java/fr/insa/clavardator/client/db/DatabaseController.java" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="SQLite" />
|
||||
</component>
|
||||
</project>
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
id 'com.github.johnrengelman.shadow' version '6.1.0'
|
||||
}
|
||||
|
||||
group 'fr.insa.clavardator'
|
||||
group 'fr.insa.clavardator.client'
|
||||
version '0.0.1'
|
||||
|
||||
repositories {
|
||||
|
@ -17,6 +17,7 @@ javafx {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':lib')
|
||||
implementation 'org.jetbrains:annotations:20.1.0'
|
||||
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"
|
||||
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
|
||||
|
@ -35,11 +36,11 @@ test {
|
|||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
mainClassName = 'fr.insa.clavardator.Launcher'
|
||||
mainClassName = 'fr.insa.clavardator.client.Launcher'
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': 'fr.insa.clavardator.Launcher'
|
||||
attributes 'Main-Class': 'fr.insa.clavardator.client.Launcher'
|
||||
}
|
||||
from {
|
||||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator;
|
||||
package fr.insa.clavardator.client;
|
||||
|
||||
public class Launcher {
|
||||
public static void main(String[] args) {
|
|
@ -1,8 +1,7 @@
|
|||
package fr.insa.clavardator;
|
||||
package fr.insa.clavardator.client;
|
||||
|
||||
import fr.insa.clavardator.ui.MainController;
|
||||
import fr.insa.clavardator.users.UserList;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.ui.MainController;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
|
@ -1,11 +1,12 @@
|
|||
package fr.insa.clavardator.chat;
|
||||
package fr.insa.clavardator.client.chat;
|
||||
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.db.DatabaseController;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
|
@ -1,6 +1,6 @@
|
|||
package fr.insa.clavardator.config;
|
||||
package fr.insa.clavardator.client.config;
|
||||
|
||||
import fr.insa.clavardator.server.PresenceType;
|
||||
import fr.insa.clavardator.client.server.PresenceType;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package fr.insa.clavardator.config;
|
||||
package fr.insa.clavardator.client.config;
|
||||
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
|
@ -1,11 +1,12 @@
|
|||
package fr.insa.clavardator.db;
|
||||
package fr.insa.clavardator.client.db;
|
||||
|
||||
import fr.insa.clavardator.chat.FileMessage;
|
||||
import fr.insa.clavardator.chat.Message;
|
||||
import fr.insa.clavardator.users.User;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.lib.message.FileMessage;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -314,7 +315,13 @@ public class DatabaseController {
|
|||
public void addMessage(Message message, @Nullable DatabaseController.UpdateCallback callback, ErrorCallback errorCallback) {
|
||||
// Insert the correspondent if not already in the database
|
||||
Log.v(getClass().getSimpleName(), "Inserting correspondent into db... ");
|
||||
addUser(message.getCorrespondent(), () -> {
|
||||
UserInformation correspondent;
|
||||
if (CurrentUser.getInstance().getId() != null && CurrentUser.getInstance().getId().equals(message.getSender().id)) {
|
||||
correspondent = message.getRecipient();
|
||||
} else {
|
||||
correspondent = message.getSender();
|
||||
}
|
||||
addUser(correspondent, () -> {
|
||||
// Handle messages containing a file
|
||||
String filePath = null;
|
||||
if (message instanceof FileMessage) {
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.errors;
|
||||
package fr.insa.clavardator.client.errors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package fr.insa.clavardator.network;
|
||||
package fr.insa.clavardator.client.network;
|
||||
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
|
||||
import static fr.insa.clavardator.network.NetUtil.isLocalAddress;
|
||||
import static fr.insa.clavardator.client.network.NetUtil.isLocalAddress;
|
||||
|
||||
public class NetDiscoverer {
|
||||
private static final short DISCOVERY_PORT = 31593;
|
|
@ -1,6 +1,6 @@
|
|||
package fr.insa.clavardator.network;
|
||||
package fr.insa.clavardator.client.network;
|
||||
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InterfaceAddress;
|
|
@ -1,10 +1,11 @@
|
|||
package fr.insa.clavardator.network;
|
||||
package fr.insa.clavardator.client.network;
|
||||
|
||||
import fr.insa.clavardator.errors.UsernameTakenException;
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.errors.UsernameTakenException;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import fr.insa.clavardator.lib.network.TcpConnection;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
|
@ -1,12 +1,13 @@
|
|||
package fr.insa.clavardator.server;
|
||||
package fr.insa.clavardator.client.server;
|
||||
|
||||
import fr.insa.clavardator.network.TcpConnection;
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.util.ParametrizedCallback;
|
||||
import fr.insa.clavardator.util.SimpleCallback;
|
||||
import fr.insa.clavardator.lib.network.TcpConnection;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import fr.insa.clavardator.lib.util.ParametrizedCallback;
|
||||
import fr.insa.clavardator.lib.util.SimpleCallback;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
@ -26,7 +27,7 @@ import java.util.Arrays;
|
|||
* such as subscribe, unsubscribe, publish, and receive notifications.
|
||||
* <br/>
|
||||
* On the proxy port, the client will be able to send regular
|
||||
* {@link fr.insa.clavardator.chat.Message messages} like on the local network.
|
||||
* {@link Message messages} like on the local network.
|
||||
* The proxy will forward the message to the appropriate recipient using the provided id.
|
||||
*/
|
||||
public class InsaPresence implements Presence {
|
|
@ -1,10 +1,10 @@
|
|||
package fr.insa.clavardator.server;
|
||||
package fr.insa.clavardator.client.server;
|
||||
|
||||
import fr.insa.clavardator.network.TcpConnection;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.ParametrizedCallback;
|
||||
import fr.insa.clavardator.util.SimpleCallback;
|
||||
import fr.insa.clavardator.lib.network.TcpConnection;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.ParametrizedCallback;
|
||||
import fr.insa.clavardator.lib.util.SimpleCallback;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
|||
* Interface exposing public methods necessary for any presence server.
|
||||
*
|
||||
* @implNote Implement this interface when creating your own presence server class,
|
||||
* then update the {@link fr.insa.clavardator.server.PresenceFactory factory}
|
||||
* then update the {@link fr.insa.clavardator.client.server.PresenceFactory factory}
|
||||
* to add your new implementation.
|
||||
*/
|
||||
public interface Presence {
|
||||
|
@ -38,7 +38,7 @@ public interface Presence {
|
|||
/**
|
||||
* Gets a connection to the proxy.
|
||||
* This can be used to initialize a
|
||||
* {@link fr.insa.clavardator.users.PeerUser Peeruser}
|
||||
* {@link fr.insa.clavardator.client.users.PeerUser Peeruser}
|
||||
* and send messages like on a local network.
|
||||
*
|
||||
* @return The server address
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.server;
|
||||
package fr.insa.clavardator.client.server;
|
||||
|
||||
/**
|
||||
* Static factory class used to create concrete presence server implementations.
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.server;
|
||||
package fr.insa.clavardator.client.server;
|
||||
|
||||
public enum PresenceType {
|
||||
INSA,
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.server;
|
||||
package fr.insa.clavardator.client.server;
|
||||
|
||||
public class UnknownPresenceException extends Exception {
|
||||
public UnknownPresenceException() {
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.ui;
|
||||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
/**
|
||||
* Interface used to create callbacks for button press events
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.ui;
|
||||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.ui;
|
||||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
|
@ -1,21 +1,21 @@
|
|||
package fr.insa.clavardator.ui;
|
||||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
import com.jfoenix.controls.JFXSnackbar;
|
||||
import fr.insa.clavardator.config.Config;
|
||||
import fr.insa.clavardator.config.ConfigLoader;
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.server.Presence;
|
||||
import fr.insa.clavardator.server.PresenceFactory;
|
||||
import fr.insa.clavardator.server.PresenceType;
|
||||
import fr.insa.clavardator.server.UnknownPresenceException;
|
||||
import fr.insa.clavardator.ui.chat.ChatController;
|
||||
import fr.insa.clavardator.ui.dialogs.AboutDialogController;
|
||||
import fr.insa.clavardator.ui.dialogs.EditUsernameDialogController;
|
||||
import fr.insa.clavardator.ui.dialogs.SnackbarController;
|
||||
import fr.insa.clavardator.ui.users.UserListController;
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.users.UserList;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.config.Config;
|
||||
import fr.insa.clavardator.client.config.ConfigLoader;
|
||||
import fr.insa.clavardator.client.db.DatabaseController;
|
||||
import fr.insa.clavardator.client.server.Presence;
|
||||
import fr.insa.clavardator.client.server.PresenceFactory;
|
||||
import fr.insa.clavardator.client.server.PresenceType;
|
||||
import fr.insa.clavardator.client.server.UnknownPresenceException;
|
||||
import fr.insa.clavardator.client.ui.chat.ChatController;
|
||||
import fr.insa.clavardator.client.ui.dialogs.AboutDialogController;
|
||||
import fr.insa.clavardator.client.ui.dialogs.EditUsernameDialogController;
|
||||
import fr.insa.clavardator.client.ui.dialogs.SnackbarController;
|
||||
import fr.insa.clavardator.client.ui.users.UserListController;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import fr.insa.clavardator.client.users.UserList;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.ui;
|
||||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
|
@ -1,14 +1,12 @@
|
|||
package fr.insa.clavardator.ui;
|
||||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
|
@ -0,0 +1,7 @@
|
|||
package fr.insa.clavardator.client.ui;
|
||||
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
|
||||
public interface UserSelectedEvent {
|
||||
void onSelected(PeerUser user);
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package fr.insa.clavardator.ui.chat;
|
||||
package fr.insa.clavardator.client.ui.chat;
|
||||
|
||||
import fr.insa.clavardator.chat.ChatHistory;
|
||||
import fr.insa.clavardator.chat.Message;
|
||||
import fr.insa.clavardator.ui.LoadingScreenController;
|
||||
import fr.insa.clavardator.ui.NoSelectionModel;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.chat.ChatHistory;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.client.ui.LoadingScreenController;
|
||||
import fr.insa.clavardator.client.ui.NoSelectionModel;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.fxml.FXML;
|
|
@ -1,10 +1,10 @@
|
|||
package fr.insa.clavardator.ui.chat;
|
||||
package fr.insa.clavardator.client.ui.chat;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXTextField;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
|
@ -1,7 +1,7 @@
|
|||
package fr.insa.clavardator.ui.chat;
|
||||
package fr.insa.clavardator.client.ui.chat;
|
||||
|
||||
import fr.insa.clavardator.ui.users.UserActiveIndicatorController;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.client.ui.users.UserActiveIndicatorController;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
|
@ -9,7 +9,6 @@ import javafx.scene.control.Label;
|
|||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
|
@ -1,7 +1,6 @@
|
|||
package fr.insa.clavardator.ui.chat;
|
||||
package fr.insa.clavardator.client.ui.chat;
|
||||
|
||||
import fr.insa.clavardator.chat.Message;
|
||||
import javafx.application.Platform;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.ListCell;
|
|
@ -1,9 +1,9 @@
|
|||
package fr.insa.clavardator.ui.chat;
|
||||
package fr.insa.clavardator.client.ui.chat;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import fr.insa.clavardator.chat.FileMessage;
|
||||
import fr.insa.clavardator.chat.Message;
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.lib.message.FileMessage;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.ui.dialogs;
|
||||
package fr.insa.clavardator.client.ui.dialogs;
|
||||
|
||||
import com.jfoenix.controls.JFXDialog;
|
||||
import javafx.fxml.FXML;
|
|
@ -1,12 +1,12 @@
|
|||
package fr.insa.clavardator.ui.dialogs;
|
||||
package fr.insa.clavardator.client.ui.dialogs;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXDialog;
|
||||
import com.jfoenix.controls.JFXTextField;
|
||||
import com.jfoenix.validation.base.ValidatorBase;
|
||||
import fr.insa.clavardator.ui.ButtonPressEvent;
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.users.UserList;
|
||||
import fr.insa.clavardator.client.ui.ButtonPressEvent;
|
||||
import fr.insa.clavardator.client.users.CurrentUser;
|
||||
import fr.insa.clavardator.client.users.UserList;
|
||||
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
|
@ -1,4 +1,4 @@
|
|||
package fr.insa.clavardator.ui.dialogs;
|
||||
package fr.insa.clavardator.client.ui.dialogs;
|
||||
|
||||
import com.jfoenix.effects.JFXDepthManager;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -9,7 +9,6 @@ import javafx.scene.layout.HBox;
|
|||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package fr.insa.clavardator.ui.users;
|
||||
package fr.insa.clavardator.client.ui.users;
|
||||
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
|
@ -1,11 +1,11 @@
|
|||
package fr.insa.clavardator.ui.users;
|
||||
package fr.insa.clavardator.client.ui.users;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import fr.insa.clavardator.ui.ButtonPressEvent;
|
||||
import fr.insa.clavardator.ui.UserSelectedEvent;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.users.User;
|
||||
import fr.insa.clavardator.users.UserList;
|
||||
import fr.insa.clavardator.client.ui.ButtonPressEvent;
|
||||
import fr.insa.clavardator.client.ui.UserSelectedEvent;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.client.users.UserList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.ListView;
|
|
@ -1,7 +1,7 @@
|
|||
package fr.insa.clavardator.ui.users;
|
||||
package fr.insa.clavardator.client.ui.users;
|
||||
|
||||
import fr.insa.clavardator.ui.UserSelectedEvent;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.client.ui.UserSelectedEvent;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.ListCell;
|
|
@ -1,8 +1,8 @@
|
|||
package fr.insa.clavardator.ui.users;
|
||||
package fr.insa.clavardator.client.ui.users;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import fr.insa.clavardator.ui.ButtonPressEvent;
|
||||
import fr.insa.clavardator.users.PeerUser;
|
||||
import fr.insa.clavardator.client.ui.ButtonPressEvent;
|
||||
import fr.insa.clavardator.client.users.PeerUser;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
|
@ -1,8 +1,10 @@
|
|||
package fr.insa.clavardator.users;
|
||||
package fr.insa.clavardator.client.users;
|
||||
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.db.DatabaseController;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -33,8 +35,8 @@ public class CurrentUser extends User {
|
|||
final DatabaseController db = new DatabaseController();
|
||||
db.getCurrentUser((user) -> {
|
||||
if (user == null) {
|
||||
id = generateUniqueId();
|
||||
Log.v(getClass().getSimpleName(), "No previous user found, generating id: " + id);
|
||||
setId(generateUniqueId());
|
||||
Log.v(getClass().getSimpleName(), "No previous user found, generating id: " + getId());
|
||||
db.addCurrentUser(
|
||||
new UserInformation(this),
|
||||
() -> {
|
||||
|
@ -43,9 +45,9 @@ public class CurrentUser extends User {
|
|||
},
|
||||
errorCallback);
|
||||
} else {
|
||||
id = user.id;
|
||||
setId(user.id);
|
||||
if (user.getUsername() != null) {
|
||||
Log.v(getClass().getSimpleName(), "Last user found : " + id + " / " + getUsername());
|
||||
Log.v(getClass().getSimpleName(), "Last user found : " + getId() + " / " + getUsername());
|
||||
setUsername(user.getUsername());
|
||||
} else {
|
||||
Log.v(getClass().getSimpleName(), "No username found, asking user");
|
||||
|
@ -75,7 +77,7 @@ public class CurrentUser extends User {
|
|||
public void setState(State state) {
|
||||
Log.v(this.getClass().getSimpleName(),
|
||||
"State changed from " + this.state.toString() + " to " + state.toString());
|
||||
instance.pcs.firePropertyChange("state", this.state, state);
|
||||
instance.getPcs().firePropertyChange("state", this.state, state);
|
||||
this.state = state;
|
||||
}
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
package fr.insa.clavardator.users;
|
||||
package fr.insa.clavardator.client.users;
|
||||
|
||||
import fr.insa.clavardator.chat.ChatHistory;
|
||||
import fr.insa.clavardator.chat.FileMessage;
|
||||
import fr.insa.clavardator.chat.Message;
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.errors.UsernameTakenException;
|
||||
import fr.insa.clavardator.network.TcpConnection;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.chat.ChatHistory;
|
||||
import fr.insa.clavardator.lib.message.FileMessage;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.client.db.DatabaseController;
|
||||
import fr.insa.clavardator.client.errors.UsernameTakenException;
|
||||
import fr.insa.clavardator.lib.network.TcpConnection;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -105,7 +107,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
|||
|
||||
public void init(TcpConnection connection, String id, String username, ErrorCallback errorCallback) {
|
||||
this.connection = connection;
|
||||
this.id = id;
|
||||
this.setId(id);
|
||||
setUsername(username);
|
||||
setState(State.CONNECTED);
|
||||
subscribeToMessages((e) -> {
|
||||
|
@ -124,7 +126,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
|||
private void subscribeToMessages(ErrorCallback errorCallback) {
|
||||
connection.receive(
|
||||
msg -> {
|
||||
Log.v(this.getClass().getSimpleName(), "Received message from " + id);
|
||||
Log.v(this.getClass().getSimpleName(), "Received message from " + getId());
|
||||
if (msg instanceof UserInformation) {
|
||||
assert ((UserInformation) msg).id.equals(getId());
|
||||
final String receivedUsername = ((UserInformation) msg).getUsername();
|
||||
|
@ -135,7 +137,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
|||
setUsername(receivedUsername);
|
||||
}
|
||||
} else if (msg instanceof Message) {
|
||||
assert !((Message) msg).getRecipient().id.equals(id);
|
||||
assert !((Message) msg).getRecipient().id.equals(getId());
|
||||
|
||||
Log.v(this.getClass().getSimpleName(), "Message text: " + ((Message) msg).getText());
|
||||
if (msg instanceof FileMessage) {
|
||||
|
@ -151,7 +153,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
|||
if (e instanceof EOFException) {
|
||||
disconnect();
|
||||
} else {
|
||||
Log.e(this.getClass().getSimpleName(), "Error receiving message from " + id, e);
|
||||
Log.e(this.getClass().getSimpleName(), "Error receiving message from " + getId(), e);
|
||||
errorCallback.onError(e);
|
||||
}
|
||||
});
|
||||
|
@ -161,7 +163,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
|||
* Close the connection and set state to disconnected
|
||||
*/
|
||||
public void disconnect() {
|
||||
Log.v(this.getClass().getSimpleName(), "Disconnecting from user: " + id);
|
||||
Log.v(this.getClass().getSimpleName(), "Disconnecting from user: " + getId());
|
||||
closeConnection();
|
||||
setState(State.DISCONNECTED);
|
||||
}
|
||||
|
@ -201,7 +203,7 @@ public class PeerUser extends User implements Comparable<PeerUser> {
|
|||
* @param state The new state
|
||||
*/
|
||||
protected void setState(State state) {
|
||||
pcs.firePropertyChange("state", this.state, state);
|
||||
getPcs().firePropertyChange("state", this.state, state);
|
||||
this.state = state;
|
||||
}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
package fr.insa.clavardator.users;
|
||||
package fr.insa.clavardator.client.users;
|
||||
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.network.NetDiscoverer;
|
||||
import fr.insa.clavardator.network.PeerHandshake;
|
||||
import fr.insa.clavardator.network.TcpConnection;
|
||||
import fr.insa.clavardator.network.TcpListener;
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
import fr.insa.clavardator.client.db.DatabaseController;
|
||||
import fr.insa.clavardator.client.network.NetDiscoverer;
|
||||
import fr.insa.clavardator.client.network.PeerHandshake;
|
||||
import fr.insa.clavardator.lib.network.TcpConnection;
|
||||
import fr.insa.clavardator.lib.network.TcpListener;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.Log;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -59,7 +61,7 @@ public class UserList {
|
|||
Log.v(getClass().getSimpleName(), "Received new user from presence server");
|
||||
final PeerUser user = new PeerUser();
|
||||
user.init(proxyConnection, userInfo.id, userInfo.getUsername(), null);
|
||||
userHashmap.put(user.id, user);
|
||||
userHashmap.put(user.getId(), user);
|
||||
Platform.runLater(() -> userObservableList.add(user));
|
||||
}
|
||||
}));
|
||||
|
@ -78,7 +80,7 @@ public class UserList {
|
|||
|
||||
public void retrievedPreviousUsers(UserListLoadedCallback onFinish, ErrorCallback errorCallback) {
|
||||
db.getAllUsers(users -> {
|
||||
users.forEach(user -> createNewInactiveUser(user.id, user.getUsername()));
|
||||
users.forEach(user -> createNewInactiveUser(user.getId(), user.getUsername()));
|
||||
onFinish.onLoaded();
|
||||
}, errorCallback);
|
||||
}
|
||||
|
@ -110,7 +112,7 @@ public class UserList {
|
|||
} else {
|
||||
final PeerUser user = new PeerUser();
|
||||
user.init(handshake.getConnection(), userInfo.id, userInfo.getUsername(), null);
|
||||
userHashmap.put(user.id, user);
|
||||
userHashmap.put(user.getId(), user);
|
||||
Platform.runLater(() -> userObservableList.add(user));
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
<?import com.jfoenix.controls.JFXSpinner?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.insa.clavardator.ui.chat.ChatController"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.insa.clavardator.client.ui.chat.ChatController"
|
||||
stylesheets="@../styles.css" styleClass="container">
|
||||
<StackPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
|
||||
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
@ -7,7 +7,7 @@
|
|||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<HBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="fr.insa.clavardator.ui.chat.ChatFooterController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.chat.ChatFooterController"
|
||||
stylesheets="@../styles.css" styleClass="container" alignment="CENTER" spacing="10.0" fx:id="container">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
|
|
@ -6,7 +6,7 @@
|
|||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="fr.insa.clavardator.ui.chat.ChatHeaderController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.chat.ChatHeaderController"
|
||||
stylesheets="@../styles.css" styleClass="container">
|
||||
<HBox alignment="CENTER_LEFT" spacing="5" prefHeight="64">
|
||||
<padding>
|
|
@ -7,7 +7,7 @@
|
|||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<VBox xmlns="http://javafx.com/javafx/11.0.1"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="fr.insa.clavardator.ui.chat.MessageListItemController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.chat.MessageListItemController"
|
||||
stylesheets="@../styles.css"
|
||||
styleClass="inner"
|
||||
fx:id="container"
|
|
@ -9,7 +9,7 @@
|
|||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<JFXDialog xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="fr.insa.clavardator.ui.dialogs.AboutDialogController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.dialogs.AboutDialogController"
|
||||
stylesheets="@../styles.css" fx:id="dialog">
|
||||
<AnchorPane
|
||||
prefWidth="600"
|
|
@ -9,7 +9,7 @@
|
|||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<JFXDialog xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="fr.insa.clavardator.ui.dialogs.EditUsernameDialogController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.dialogs.EditUsernameDialogController"
|
||||
stylesheets="@../styles.css" fx:id="dialog">
|
||||
<AnchorPane
|
||||
prefWidth="600"
|
|
@ -7,7 +7,7 @@
|
|||
<?import javafx.geometry.Insets?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="fr.insa.clavardator.ui.dialogs.SnackbarController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.dialogs.SnackbarController"
|
||||
stylesheets="@../styles.css">
|
||||
<HBox fx:id="container" alignment="CENTER_LEFT" prefHeight="50.0" prefWidth="400" AnchorPane.rightAnchor="0"
|
||||
AnchorPane.leftAnchor="0" AnchorPane.topAnchor="0" AnchorPane.bottomAnchor="100"
|
|
@ -6,7 +6,7 @@
|
|||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="fr.insa.clavardator.ui.ErrorScreenController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.ErrorScreenController"
|
||||
stylesheets="@styles.css"
|
||||
styleClass="container"
|
||||
alignment="CENTER"
|
|
@ -6,7 +6,7 @@
|
|||
<?import javafx.scene.layout.VBox?>
|
||||
<StackPane xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="fr.insa.clavardator.ui.LoadingScreenController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.LoadingScreenController"
|
||||
stylesheets="@styles.css"
|
||||
styleClass="container"
|
||||
fx:id="container">
|
|
@ -5,7 +5,7 @@
|
|||
<?import javafx.scene.layout.*?>
|
||||
<StackPane xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/11.0.1"
|
||||
fx:controller="fr.insa.clavardator.ui.MainController"
|
||||
fx:controller="fr.insa.clavardator.client.ui.MainController"
|
||||
stylesheets="@styles.css"
|
||||
styleClass="container"
|
||||
fx:id="root">
|
|
@ -6,9 +6,9 @@
|
|||
<?import javafx.scene.layout.*?>
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="fr.insa.clavardator.ui.ToolbarController"
|
||||
stylesheets="@styles.css" styleClass="container">
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="fr.insa.clavardator.client.ui.ToolbarController"
|
||||
stylesheets="@styles.css" styleClass="container">
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="64.0" spacing="10">
|
||||
<padding>
|
||||
<Insets left="20" right="20"/>
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
<?import javafx.scene.shape.Circle?>
|
||||
<HBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="fr.insa.clavardator.ui.users.UserActiveIndicatorController"
|
||||
stylesheets="@../styles.css" alignment="CENTER">
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="fr.insa.clavardator.client.ui.users.UserActiveIndicatorController"
|
||||
stylesheets="@../styles.css" alignment="CENTER">
|
||||
<Circle fx:id="circle" radius="5.0" styleClass="active-user-dot"/>
|
||||
</HBox>
|
|
@ -5,7 +5,7 @@
|
|||
<?import javafx.scene.layout.*?>
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.insa.clavardator.ui.users.UserListController"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.insa.clavardator.client.ui.users.UserListController"
|
||||
stylesheets="@../styles.css" styleClass="container">
|
||||
<VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
|
||||
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
@ -4,7 +4,7 @@
|
|||
<?import javafx.scene.layout.*?>
|
||||
<!--suppress JavaFxUnresolvedFxIdReference -->
|
||||
<AnchorPane prefHeight="40.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="fr.insa.clavardator.ui.users.UserListItemController" stylesheets="@../styles.css"
|
||||
fx:controller="fr.insa.clavardator.client.ui.users.UserListItemController" stylesheets="@../styles.css"
|
||||
styleClass="inner">
|
||||
<JFXButton fx:id="button" alignment="CENTER_LEFT" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
|
||||
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0" onAction="#onPress">
|
|
@ -1,8 +1,8 @@
|
|||
package fr.insa.clavardator;
|
||||
|
||||
import fr.insa.clavardator.chat.Message;
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.message.Message;
|
||||
import fr.insa.clavardator.client.db.DatabaseController;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
14
lib/build.gradle
Normal file
14
lib/build.gradle
Normal file
|
@ -0,0 +1,14 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group 'fr.insa.clavardator.lib'
|
||||
version '0.0.1'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.jetbrains:annotations:20.1.0'
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package fr.insa.clavardator.chat;
|
||||
package fr.insa.clavardator.lib.message;
|
||||
|
||||
import fr.insa.clavardator.users.User;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
|
@ -1,6 +1,6 @@
|
|||
package fr.insa.clavardator.chat;
|
||||
package fr.insa.clavardator.lib.message;
|
||||
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
|
@ -1,8 +1,7 @@
|
|||
package fr.insa.clavardator.chat;
|
||||
package fr.insa.clavardator.lib.message;
|
||||
|
||||
import fr.insa.clavardator.users.CurrentUser;
|
||||
import fr.insa.clavardator.users.User;
|
||||
import fr.insa.clavardator.users.UserInformation;
|
||||
import fr.insa.clavardator.lib.users.User;
|
||||
import fr.insa.clavardator.lib.users.UserInformation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -47,14 +46,6 @@ public class Message implements Serializable {
|
|||
return recipient;
|
||||
}
|
||||
|
||||
public UserInformation getCorrespondent() {
|
||||
if (CurrentUser.getInstance().getId() != null && CurrentUser.getInstance().getId().equals(sender.id)) {
|
||||
return recipient;
|
||||
} else {
|
||||
return sender;
|
||||
}
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package fr.insa.clavardator.network;
|
||||
package fr.insa.clavardator.lib.network;
|
||||
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
package fr.insa.clavardator.network;
|
||||
package fr.insa.clavardator.lib.network;
|
||||
|
||||
import fr.insa.clavardator.util.ErrorCallback;
|
||||
import fr.insa.clavardator.lib.util.ErrorCallback;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
import static fr.insa.clavardator.network.TcpConnection.TCP_PORT;
|
||||
import static fr.insa.clavardator.lib.network.TcpConnection.TCP_PORT;
|
||||
|
||||
public class TcpListener {
|
||||
Acceptor acceptor = null;
|
|
@ -1,7 +1,4 @@
|
|||
package fr.insa.clavardator.users;
|
||||
|
||||
import fr.insa.clavardator.db.DatabaseController;
|
||||
import fr.insa.clavardator.util.Log;
|
||||
package fr.insa.clavardator.lib.users;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
|
@ -9,10 +6,10 @@ import java.io.Serializable;
|
|||
|
||||
public class User implements Serializable {
|
||||
private String username;
|
||||
protected String id;
|
||||
private String id;
|
||||
|
||||
// Make this class observable
|
||||
protected final transient PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
private final transient PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
public void addObserver(PropertyChangeListener listener) {
|
||||
pcs.addPropertyChangeListener(listener);
|
||||
}
|
||||
|