Compare commits
No commits in common. "master" and "View" have entirely different histories.
3
.idea/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="13" project-jdk-type="JavaSDK" />
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/ChatApp-AL-NM.iml" filepath="$PROJECT_DIR$/.idea/ChatApp-AL-NM.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"BaseDeDonnesURL" : "jdbc:mysql://srv-bdens.insa-toulouse.fr:3306/tp_servlet_006?",
|
|
||||||
"BaseDeDonnesLogin" : "tp_servlet_006",
|
|
||||||
"BaseDeDonneesMDP" : "baePh9ei",
|
|
||||||
"ServeurURL" : "https://srv-gei-tomcat.insa-toulouse.fr/Server_AL_NM/"
|
|
||||||
|
|
||||||
}
|
|
BIN
Conception/Class diagram/Class Diagram.png
Normal file
After Width: | Height: | Size: 187 KiB |
BIN
Conception/Class diagram/MVC Class Diagram.png
Normal file
After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 44 KiB |
BIN
Conception/Sequence diagram/Déconnexion.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
Conception/Sequence diagram/Main.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
Conception/Sequence diagram/Modification Pseudonyme.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
Conception/Sequence diagram/Réduction de l'agent.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
Conception/Sequence diagram/Session de clavardage .png
Normal file
After Width: | Height: | Size: 149 KiB |
BIN
Conception/State Machine Diagram/Machine a etat Chatapp.png
Normal file
After Width: | Height: | Size: 199 KiB |
Before Width: | Height: | Size: 563 KiB After Width: | Height: | Size: 563 KiB |
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path=""/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-13">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
<attribute name="module" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="lib" path="mysql-connector-java-8.0.22.jar"/>
|
<classpathentry kind="lib" path="jgoodies-forms-1.8.0.jar" sourcepath="jgoodies-forms-1.8.0-sources.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
38
Implementation/.gitignore
vendored
|
@ -1,37 +1 @@
|
||||||
# Created by https://www.gitignore.io/api/java,gradle
|
/bin/
|
||||||
|
|
||||||
### Java ###
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# BlueJ files
|
|
||||||
*.ctxt
|
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
|
||||||
.mtj.tmp/
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.ear
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
|
|
||||||
|
|
||||||
### Gradle ###
|
|
||||||
.gradle
|
|
||||||
/build/
|
|
||||||
|
|
||||||
# Ignore Gradle GUI config
|
|
||||||
gradle-app.setting
|
|
||||||
|
|
||||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
|
||||||
!gradle-wrapper.jar
|
|
||||||
|
|
||||||
# Cache of project
|
|
||||||
.gradletasknamecache
|
|
||||||
|
|
||||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
|
||||||
# gradle/wrapper/gradle-wrapper.properties
|
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/java,gradle
|
|
||||||
|
|
1
Implementation/bin/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
/bin/
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="src" path="src/main/java"/>
|
|
||||||
<classpathentry kind="lib" path="gradle/wrapper/gradle-wrapper.jar"/>
|
|
||||||
<classpathentry kind="output" path="build/classes/java/main"/>
|
|
||||||
</classpath>
|
|
3
Implementation/chatapp/.idea/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
|
@ -1,10 +0,0 @@
|
||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="chatapp">
|
|
||||||
<output-path>$PROJECT_DIR$/out/artifacts/chatapp</output-path>
|
|
||||||
<root id="archive" name="chatapp.jar">
|
|
||||||
<element id="directory" name="META-INF">
|
|
||||||
<element id="file-copy" path="$PROJECT_DIR$/src/main/resources/META-INF/MANIFEST.MF" />
|
|
||||||
</element>
|
|
||||||
</root>
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
|
@ -1,29 +0,0 @@
|
||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="chatapp:jar">
|
|
||||||
<output-path>$PROJECT_DIR$/out/artifacts/chatapp_jar</output-path>
|
|
||||||
<root id="archive" name="chatapp.jar">
|
|
||||||
<element id="directory" name="META-INF">
|
|
||||||
<element id="file-copy" path="$PROJECT_DIR$/src/resources/META-INF/MANIFEST.MF" />
|
|
||||||
</element>
|
|
||||||
<element id="library" level="project" name="Gradle: com.google.protobuf:protobuf-java:3.11.4" />
|
|
||||||
<element id="library" level="project" name="Gradle: mysql:mysql-connector-java:8.0.22" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.apiguardian:apiguardian-api:1.1.0" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.junit.jupiter:junit-jupiter-api:5.6.0" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.junit.jupiter:junit-jupiter-engine:5.6.0" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.junit.platform:junit-platform-commons:1.6.0" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.junit.platform:junit-platform-engine:1.6.0" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-base:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-base:win:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-controls:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-controls:win:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-fxml:win:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-graphics:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-graphics:linux:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-graphics:mac:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.openjfx:javafx-graphics:win:11.0.2" />
|
|
||||||
<element id="library" level="project" name="Gradle: org.opentest4j:opentest4j:1.2.0" />
|
|
||||||
<element id="library" level="project" name="lib" />
|
|
||||||
<element id="library" level="project" name="mysql-connector-java-8.0.22" />
|
|
||||||
</root>
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="chatapp.main:jar">
|
|
||||||
<output-path>$PROJECT_DIR$/out/artifacts/chatapp_main_jar</output-path>
|
|
||||||
<root id="archive" name="chatapp.main.jar">
|
|
||||||
<element id="module-output" name="chatapp.main" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-controls/11.0.2/6c763707769c18adce406904c771c2ad1fcc370b/javafx-controls-11.0.2-win.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/mysql/mysql-connector-java/8.0.22/ec8bfce16c8bd18d6cb598b1147aa145be1408f/mysql-connector-java-8.0.22.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-graphics/11.0.2/ef4c34f0ca77cd99100b76c2ccf1dce383572bb1/javafx-graphics-11.0.2-linux.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-graphics/11.0.2/e522eb4ea422eceeee207b1c266ba3db19b2343a/javafx-graphics-11.0.2.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.11.4/7ec0925cc3aef0335bbc7d57edfd42b0f86f8267/protobuf-java-3.11.4.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-controls/11.0.2/4ab633cf1eea60f76e2ae9905aedac862da88b08/javafx-controls-11.0.2.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-base/11.0.2/1852e57b8cf9a9b6488c33605bccd5d06ff210e1/javafx-base-11.0.2-win.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-graphics/11.0.2/c1d99ae5bc48e7173f4514a941d27d8f8c972c71/javafx-graphics-11.0.2-mac.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-fxml/11.0.2/b3242e4c031558574de2a1da685bb5fcdbb8a530/javafx-fxml-11.0.2-win.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-base/11.0.2/7fb2e4a8528ec9e434a9ac9ee98b39af79e6dcb8/javafx-base-11.0.2.jar" path-in-jar="/" />
|
|
||||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-graphics/11.0.2/20459ea2cf714942bcbeb78a7f70ba3531dc1a44/javafx-graphics-11.0.2-win.jar" path-in-jar="/" />
|
|
||||||
<element id="artifact" artifact-name="chatapp" />
|
|
||||||
</root>
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<bytecodeTargetLevel target="11" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="central" />
|
|
||||||
<option name="name" value="Maven Central repository" />
|
|
||||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="jboss.community" />
|
|
||||||
<option name="name" value="JBoss Community repository" />
|
|
||||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="MavenRepo" />
|
|
||||||
<option name="name" value="MavenRepo" />
|
|
||||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
|
||||||
</remote-repository>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="lib">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$USER_HOME$/JavaFX/javafx-sdk-11.0.2/lib" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$USER_HOME$/JavaFX/javafx-sdk-11.0.2/lib" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$USER_HOME$/JavaFX/javafx-sdk-11.0.2/lib" recursive="false" />
|
|
||||||
<jarDirectory url="file://$USER_HOME$/JavaFX/javafx-sdk-11.0.2/lib" recursive="false" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="mysql-connector-java-8.0.22">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/Downloads/mysql-connector-java-8.0.22.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="JavadocGenerationManager">
|
|
||||||
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/../../Javadoc" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="13" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/chatapp.iml" filepath="$PROJECT_DIR$/.idea/modules/chatapp.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.linked.project.id="chatapp" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="org.example" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$/../..">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>chatapp</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,56 +0,0 @@
|
||||||
plugins {
|
|
||||||
id 'java'
|
|
||||||
id 'application'
|
|
||||||
id 'com.github.johnrengelman.shadow' version '6.1.0'
|
|
||||||
id 'org.openjfx.javafxplugin' version '0.0.9'
|
|
||||||
id 'org.beryx.jlink' version '2.15.1'
|
|
||||||
}
|
|
||||||
|
|
||||||
group 'org.example'
|
|
||||||
version '1.0-SNAPSHOT'
|
|
||||||
|
|
||||||
sourceCompatibility = 11
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
javafx {
|
|
||||||
version = "11.0.2"
|
|
||||||
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.base']
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
|
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
|
|
||||||
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
|
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
|
||||||
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
|
|
||||||
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"
|
|
||||||
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
|
|
||||||
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:mac"
|
|
||||||
}
|
|
||||||
|
|
||||||
mainClassName = 'chatapp.Launcher'
|
|
||||||
|
|
||||||
jlink {
|
|
||||||
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
|
||||||
launcher {
|
|
||||||
name = 'hellofx'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes "Main-Class": "chatapp.Launcher"
|
|
||||||
}
|
|
||||||
|
|
||||||
from {
|
|
||||||
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: chatapp.Launcher
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.RadioButton?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.control.ToggleGroup?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.ConnexionScreen">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="ChatApp">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="598.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane alignment="CENTER" prefHeight="275.0" prefWidth="448.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="254.19998168945312" minHeight="10.0" prefHeight="111.80001831054688" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="69.39998168945314" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="33.60002441406249" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="27.400000000000034" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="79.39999999999998" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="3" />
|
|
||||||
<Button fx:id="connexionButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#connexion" prefHeight="38.0" prefWidth="453.0" style="-fx-background-color: #b0c926;" text="Connexion" textFill="#3299a8" GridPane.columnSpan="3" GridPane.rowIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="27.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<RadioButton fx:id="remoteButton" mnemonicParsing="false" selected="true" text="Connexion distante" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
|
||||||
<toggleGroup>
|
|
||||||
<ToggleGroup fx:id="lieu" />
|
|
||||||
</toggleGroup>
|
|
||||||
</RadioButton>
|
|
||||||
<RadioButton fx:id="localButton" mnemonicParsing="false" text="Connexion locale" toggleGroup="$lieu" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" prefHeight="0.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.ChangementPseudo">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Changement Pseudo">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane>
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Button fx:id="validationButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#validerPseudo" prefHeight="38.0" prefWidth="287.0" style="-fx-background-color: #b0c926;" text="Valider" textFill="#3299a8" GridPane.columnSpan="2" GridPane.rowIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="27.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Ancien :">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" onAction="#retourMenu" style="-fx-background-color: #b0c926;" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,90 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.TextArea?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.Clavardage">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Session de Clavardage">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane prefHeight="282.0" prefWidth="402.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="44.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="228.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="42.0" vgrow="NEVER" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<GridPane GridPane.rowIndex="2">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="327.0" minWidth="10.0" prefWidth="327.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="156.0" minWidth="10.0" prefWidth="75.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints />
|
|
||||||
<RowConstraints maxHeight="79.0" minHeight="0.0" prefHeight="60.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="AEnvoyer" prefHeight="26.0" prefWidth="447.0" promptText="Enter Text" GridPane.rowIndex="1" />
|
|
||||||
<Button fx:id="EnvoyerButton" mnemonicParsing="false" onAction="#envoyerMessage" prefHeight="27.0" prefWidth="73.0" text="Envoyer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<GridPane prefHeight="34.0" prefWidth="345.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Chat avec : ">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" textAlignment="CENTER" wrappingWidth="133.16357421875" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Button fx:id="plusButton" mnemonicParsing="false" onAction="#ajouterMessagesHistorique" style="-fx-background-color: #b0c926;" text="+" textAlignment="RIGHT" textFill="WHITE" GridPane.columnIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="16.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<TextArea fx:id="ChatText" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,62 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ComboBox?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.DemarrerSession">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Démarrer Session">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane prefHeight="166.0" prefWidth="350.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="135.60001220703126" minHeight="10.0" prefHeight="88.20001220703125" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="201.9999984741211" minHeight="10.0" prefHeight="100.79998016357423" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="201.9999984741211" minHeight="10.0" prefHeight="112.80001983642575" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Choix d'un contact" GridPane.columnSpan="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="26.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<ComboBox fx:id="choixContact" onAction="#demarrerSessionAvec" prefHeight="26.0" prefWidth="355.0" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" onAction="#retourMenu" style="-fx-background-color: #b0c926;" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Menu?>
|
|
||||||
<?import javafx.scene.control.MenuBar?>
|
|
||||||
<?import javafx.scene.control.MenuItem?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<VBox prefHeight="400.0" prefWidth="640.0" style="-fx-background-color: #3299a8;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.View_Menu">
|
|
||||||
<children>
|
|
||||||
<MenuBar prefWidth="640.0" VBox.vgrow="NEVER">
|
|
||||||
<menus>
|
|
||||||
<Menu mnemonicParsing="false" text="Options">
|
|
||||||
<items>
|
|
||||||
<MenuItem fx:id="utilsActifsButton" onAction="#afficherUtilsActifs" mnemonicParsing="false" text="Utilisateurs actifs" />
|
|
||||||
<MenuItem fx:id="demarrerSessionButton" onAction="#demarrerSession" mnemonicParsing="false" text="Démarrer session" />
|
|
||||||
<MenuItem fx:id="changerPseudoButton" onAction="#changerPseudo" mnemonicParsing="false" text="Changer de pseudo" />
|
|
||||||
<MenuItem onAction="#deconnexion" mnemonicParsing="false" text="Déconnexion" />
|
|
||||||
</items>
|
|
||||||
</Menu>
|
|
||||||
</menus>
|
|
||||||
</MenuBar>
|
|
||||||
<AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
|
|
||||||
<children>
|
|
||||||
<GridPane layoutX="154.0" layoutY="119.0" prefHeight="82.0" prefWidth="392.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Bienvenue">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="30.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="30.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
|
@ -1,53 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ScrollPane?>
|
|
||||||
<?import javafx.scene.control.TextArea?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.View_Utilisateurs">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Qui est là?">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<ScrollPane prefHeight="282.0" prefWidth="202.0">
|
|
||||||
<content>
|
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="267.0" prefWidth="200.0">
|
|
||||||
<children>
|
|
||||||
<TextArea fx:id="ListeUtilisateurs" layoutY="12.0" prefHeight="267.2" prefWidth="200.0" style="-fx-background-color: #3299a8;" text="Aucun utilisateur actif" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="13.0" />
|
|
||||||
</font>
|
|
||||||
</TextArea>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</content>
|
|
||||||
</ScrollPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" layoutX="10.0" layoutY="10.0" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" style="-fx-background-color: #b0c926;" onAction="#retourMenu" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children></HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,185 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## chatapp start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/.." >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="chatapp"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and CHATAPP_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/lib/chatapp-1.0-SNAPSHOT.jar:$APP_HOME/lib/json-simple-1.1.1.jar:$APP_HOME/lib/mysql-connector-java-8.0.22.jar:$APP_HOME/lib/javafx-fxml-11.0.2-win.jar:$APP_HOME/lib/javafx-controls-11.0.2-win.jar:$APP_HOME/lib/javafx-controls-11.0.2.jar:$APP_HOME/lib/javafx-graphics-11.0.2-win.jar:$APP_HOME/lib/javafx-graphics-11.0.2-linux.jar:$APP_HOME/lib/javafx-graphics-11.0.2-mac.jar:$APP_HOME/lib/javafx-graphics-11.0.2.jar:$APP_HOME/lib/javafx-base-11.0.2-win.jar:$APP_HOME/lib/javafx-base-11.0.2.jar:$APP_HOME/lib/junit-4.10.jar:$APP_HOME/lib/protobuf-java-3.11.4.jar:$APP_HOME/lib/hamcrest-core-1.1.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="java"
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
ulimit -n $MAX_FD
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Escape application args
|
|
||||||
save () {
|
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
||||||
echo " "
|
|
||||||
}
|
|
||||||
APP_ARGS=`save "$@"`
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $CHATAPP_OPTS -classpath "\"$CLASSPATH\"" chatapp.Launcher "$APP_ARGS"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
|
@ -1,89 +0,0 @@
|
||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem chatapp startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%..
|
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and CHATAPP_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\lib\chatapp-1.0-SNAPSHOT.jar;%APP_HOME%\lib\json-simple-1.1.1.jar;%APP_HOME%\lib\mysql-connector-java-8.0.22.jar;%APP_HOME%\lib\javafx-fxml-11.0.2-win.jar;%APP_HOME%\lib\javafx-controls-11.0.2-win.jar;%APP_HOME%\lib\javafx-controls-11.0.2.jar;%APP_HOME%\lib\javafx-graphics-11.0.2-win.jar;%APP_HOME%\lib\javafx-graphics-11.0.2-linux.jar;%APP_HOME%\lib\javafx-graphics-11.0.2-mac.jar;%APP_HOME%\lib\javafx-graphics-11.0.2.jar;%APP_HOME%\lib\javafx-base-11.0.2-win.jar;%APP_HOME%\lib\javafx-base-11.0.2.jar;%APP_HOME%\lib\junit-4.10.jar;%APP_HOME%\lib\protobuf-java-3.11.4.jar;%APP_HOME%\lib\hamcrest-core-1.1.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute chatapp
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %CHATAPP_OPTS% -classpath "%CLASSPATH%" chatapp.Launcher %*
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable CHATAPP_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%CHATAPP_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
|
@ -1,183 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## chatapp start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/.." >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="chatapp"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and CHATAPP_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/lib/chatapp-1.0-SNAPSHOT-all.jar
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="java"
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
ulimit -n $MAX_FD
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Escape application args
|
|
||||||
save () {
|
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
||||||
echo " "
|
|
||||||
}
|
|
||||||
APP_ARGS=`save "$@"`
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $CHATAPP_OPTS -jar "\"$CLASSPATH\"" "$APP_ARGS"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
|
@ -1,84 +0,0 @@
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem chatapp startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%..
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and CHATAPP_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\lib\chatapp-1.0-SNAPSHOT-all.jar
|
|
||||||
|
|
||||||
@rem Execute chatapp
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %CHATAPP_OPTS% -jar "%CLASSPATH%" %CMD_LINE_ARGS%
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable CHATAPP_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%CHATAPP_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
|
@ -1,40 +0,0 @@
|
||||||
chatapp/Protocol/RunnerEcouteTCP.java
|
|
||||||
chatapp.Protocol.RunnerEcouteTCP
|
|
||||||
chatapp/View/FenetreSession.java
|
|
||||||
chatapp.View.FenetreSession
|
|
||||||
chatapp/Protocol/HttpEchange.java
|
|
||||||
chatapp.Protocol.HttpEchange
|
|
||||||
chatapp/Model/DataBase.java
|
|
||||||
chatapp.Model.DataBase
|
|
||||||
chatapp/View/ChangementPseudo.java
|
|
||||||
chatapp.View.ChangementPseudo
|
|
||||||
chatapp/View/View_Menu.java
|
|
||||||
chatapp.View.View_Menu
|
|
||||||
chatapp/Launcher.java
|
|
||||||
chatapp.Launcher
|
|
||||||
chatapp/Model/ListUtilisateurs.java
|
|
||||||
chatapp.Model.ListUtilisateurs
|
|
||||||
chatapp/View/DemarrerSession.java
|
|
||||||
chatapp.View.DemarrerSession
|
|
||||||
chatapp/Model/MessageHorodate.java
|
|
||||||
chatapp.Model.MessageHorodate
|
|
||||||
chatapp/Main.java
|
|
||||||
chatapp.Main
|
|
||||||
chatapp/View/Clavardage.java
|
|
||||||
chatapp.View.Clavardage
|
|
||||||
chatapp.View.Clavardage$1
|
|
||||||
chatapp/Protocol/SessionClavardage.java
|
|
||||||
chatapp.Protocol.SessionClavardage
|
|
||||||
chatapp/View/ConnexionScreen.java
|
|
||||||
chatapp.View.ConnexionScreen
|
|
||||||
chatapp/View/View_Utilisateurs.java
|
|
||||||
chatapp.View.View_Utilisateurs
|
|
||||||
chatapp/Model/Utilisateur.java
|
|
||||||
chatapp.Model.Utilisateur
|
|
||||||
chatapp/Protocol/UDPEchange.java
|
|
||||||
chatapp.Protocol.RunnerUDP
|
|
||||||
chatapp.Protocol.UDPEchange
|
|
||||||
chatapp/Controller/ChatApp.java
|
|
||||||
chatapp.Controller.ChatApp
|
|
||||||
chatapp/Protocol/RunnerEcouteUDP.java
|
|
||||||
chatapp.Protocol.RunnerEcouteUDP
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: chatapp.Launcher
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: chatapp.Launcher
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
@startuml
|
|
||||||
|
|
||||||
title __CHATAPP's Component Diagram__\n
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
right footer
|
|
||||||
|
|
||||||
|
|
||||||
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
|
|
||||||
For more information about this tool, please contact philippe.mesmeur@gmail.com
|
|
||||||
endfooter
|
|
||||||
|
|
||||||
@enduml
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"BaseDeDonnesURL" : "jdbc:mysql://srv-bdens.insa-toulouse.fr:3306/tp_servlet_006?",
|
|
||||||
"BaseDeDonnesLogin" : "tp_servlet_006",
|
|
||||||
"BaseDeDonneesMDP" : "baePh9ei",
|
|
||||||
"ServeurURL" : "https://srv-gei-tomcat.insa-toulouse.fr/Server_AL_NM/"
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
185
Implementation/chatapp/gradlew
vendored
|
@ -1,185 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## Gradle start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="java"
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
ulimit -n $MAX_FD
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Escape application args
|
|
||||||
save () {
|
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
||||||
echo " "
|
|
||||||
}
|
|
||||||
APP_ARGS=`save "$@"`
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
89
Implementation/chatapp/gradlew.bat
vendored
|
@ -1,89 +0,0 @@
|
||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: chatapp.Launcher
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.RadioButton?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.control.ToggleGroup?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.ConnexionScreen">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="ChatApp">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="598.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane alignment="CENTER" prefHeight="275.0" prefWidth="448.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="254.19998168945312" minHeight="10.0" prefHeight="111.80001831054688" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="69.39998168945314" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="33.60002441406249" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="27.400000000000034" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="79.39999999999998" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="3" />
|
|
||||||
<Button fx:id="connexionButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#connexion" prefHeight="38.0" prefWidth="453.0" style="-fx-background-color: #b0c926;" text="Connexion" textFill="#3299a8" GridPane.columnSpan="3" GridPane.rowIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="27.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<RadioButton fx:id="remoteButton" mnemonicParsing="false" selected="true" text="Connexion distante" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
|
||||||
<toggleGroup>
|
|
||||||
<ToggleGroup fx:id="lieu" />
|
|
||||||
</toggleGroup>
|
|
||||||
</RadioButton>
|
|
||||||
<RadioButton fx:id="localButton" mnemonicParsing="false" text="Connexion locale" toggleGroup="$lieu" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" prefHeight="0.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.ChangementPseudo">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Changement Pseudo">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane>
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Button fx:id="validationButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#validerPseudo" prefHeight="38.0" prefWidth="287.0" style="-fx-background-color: #b0c926;" text="Valider" textFill="#3299a8" GridPane.columnSpan="2" GridPane.rowIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="27.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Ancien :">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" onAction="#retourMenu" style="-fx-background-color: #b0c926;" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,90 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.TextArea?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.Clavardage">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Session de Clavardage">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane prefHeight="282.0" prefWidth="402.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="44.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="228.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="42.0" vgrow="NEVER" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<GridPane GridPane.rowIndex="2">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="327.0" minWidth="10.0" prefWidth="327.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="156.0" minWidth="10.0" prefWidth="75.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints />
|
|
||||||
<RowConstraints maxHeight="79.0" minHeight="0.0" prefHeight="60.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="AEnvoyer" prefHeight="26.0" prefWidth="447.0" promptText="Enter Text" GridPane.rowIndex="1" />
|
|
||||||
<Button fx:id="EnvoyerButton" mnemonicParsing="false" onAction="#envoyerMessage" prefHeight="27.0" prefWidth="73.0" text="Envoyer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<GridPane prefHeight="34.0" prefWidth="345.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Chat avec : ">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" textAlignment="CENTER" wrappingWidth="133.16357421875" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Button fx:id="plusButton" mnemonicParsing="false" onAction="#ajouterMessagesHistorique" style="-fx-background-color: #b0c926;" text="+" textAlignment="RIGHT" textFill="WHITE" GridPane.columnIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="16.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<TextArea fx:id="ChatText" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,62 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ComboBox?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.DemarrerSession">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Démarrer Session">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane prefHeight="166.0" prefWidth="350.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="135.60001220703126" minHeight="10.0" prefHeight="88.20001220703125" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="201.9999984741211" minHeight="10.0" prefHeight="100.79998016357423" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="201.9999984741211" minHeight="10.0" prefHeight="112.80001983642575" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Choix d'un contact" GridPane.columnSpan="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="26.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<ComboBox fx:id="choixContact" onAction="#demarrerSessionAvec" prefHeight="26.0" prefWidth="355.0" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" onAction="#retourMenu" style="-fx-background-color: #b0c926;" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Menu?>
|
|
||||||
<?import javafx.scene.control.MenuBar?>
|
|
||||||
<?import javafx.scene.control.MenuItem?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<VBox prefHeight="400.0" prefWidth="640.0" style="-fx-background-color: #3299a8;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.View_Menu">
|
|
||||||
<children>
|
|
||||||
<MenuBar prefWidth="640.0" VBox.vgrow="NEVER">
|
|
||||||
<menus>
|
|
||||||
<Menu mnemonicParsing="false" text="Options">
|
|
||||||
<items>
|
|
||||||
<MenuItem fx:id="utilsActifsButton" onAction="#afficherUtilsActifs" mnemonicParsing="false" text="Utilisateurs actifs" />
|
|
||||||
<MenuItem fx:id="demarrerSessionButton" onAction="#demarrerSession" mnemonicParsing="false" text="Démarrer session" />
|
|
||||||
<MenuItem fx:id="changerPseudoButton" onAction="#changerPseudo" mnemonicParsing="false" text="Changer de pseudo" />
|
|
||||||
<MenuItem onAction="#deconnexion" mnemonicParsing="false" text="Déconnexion" />
|
|
||||||
</items>
|
|
||||||
</Menu>
|
|
||||||
</menus>
|
|
||||||
</MenuBar>
|
|
||||||
<AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
|
|
||||||
<children>
|
|
||||||
<GridPane layoutX="154.0" layoutY="119.0" prefHeight="82.0" prefWidth="392.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Bienvenue">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="30.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="30.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
|
@ -1,53 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ScrollPane?>
|
|
||||||
<?import javafx.scene.control.TextArea?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.View_Utilisateurs">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Qui est là?">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<ScrollPane prefHeight="282.0" prefWidth="202.0">
|
|
||||||
<content>
|
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="267.0" prefWidth="200.0">
|
|
||||||
<children>
|
|
||||||
<TextArea fx:id="ListeUtilisateurs" layoutY="12.0" prefHeight="267.2" prefWidth="200.0" style="-fx-background-color: #3299a8;" text="Aucun utilisateur actif" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="13.0" />
|
|
||||||
</font>
|
|
||||||
</TextArea>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</content>
|
|
||||||
</ScrollPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" layoutX="10.0" layoutY="10.0" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" style="-fx-background-color: #b0c926;" onAction="#retourMenu" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children></HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,2 +0,0 @@
|
||||||
rootProject.name = 'chatapp'
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: chatapp.Launcher
|
|
||||||
|
|
|
@ -1,474 +0,0 @@
|
||||||
package chatapp.Controller;
|
|
||||||
|
|
||||||
import chatapp.Model.DataBase;
|
|
||||||
import chatapp.Model.ListUtilisateurs;
|
|
||||||
import chatapp.Model.Utilisateur;
|
|
||||||
import chatapp.Protocol.*;
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Controller de l'application. C'est par cette méthode que chaque connexion et chaque session sont entamées.
|
|
||||||
* <br>Les différents attributs sont:
|
|
||||||
* <br> - actifsUsers: qui est la liste des utilisateurs actifs actuellement et connus par l'application
|
|
||||||
* <br> - me: qui est l'instance de la classe Utilisateur représentant l'utilisateur se connectant via cette instance de chatapp
|
|
||||||
* <br> - main: l'application de l'interface graphique qui s'occupe d'instancier chatapp
|
|
||||||
* <br> - runnerEcouteTCP: instance de runnerEcouteTCP, Thread permettant de recevoir des demandes de clavardage
|
|
||||||
* <br> - runnerEcouteUDP: instance de runnerEcouteUDP; Thread permettant de communiquer en UDP pour recevoir les demandes de connexion, deconnexion, changements de pseudo et leurs réponses associées
|
|
||||||
* <br> - connecte: booleen indiquant si l'on est connecté sur le reseau ou non
|
|
||||||
* <br> - db: instance permettant de se connecter à la base de donnees centralisée
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class ChatApp implements PropertyChangeListener {
|
|
||||||
|
|
||||||
/* Liste des utilisateurs actifs */
|
|
||||||
private ListUtilisateurs actifUsers ;
|
|
||||||
|
|
||||||
/* TRUE si l'utilisateur est externe au reseau FALSE s'il est interne */
|
|
||||||
private boolean isExterne;
|
|
||||||
|
|
||||||
private HttpEchange externeEchange;
|
|
||||||
|
|
||||||
/* ChatApp est associe a un utilisateur */
|
|
||||||
private Utilisateur me;
|
|
||||||
|
|
||||||
/* ChatApp est associe a une application qui le lance et que chatapp doit fermer a la fin */
|
|
||||||
private Application main;
|
|
||||||
|
|
||||||
/* Instance de ChatApp */
|
|
||||||
private static ChatApp chatapp = null;
|
|
||||||
|
|
||||||
/* Gérer les multiples connexions en TCP. */
|
|
||||||
private RunnerEcouteTCP runnerEcouteTCP;
|
|
||||||
|
|
||||||
/* Gérer les multiples connexions en UDP. */
|
|
||||||
private RunnerEcouteUDP runnerEcouteUDP;
|
|
||||||
|
|
||||||
/* TRUE si l'utilisateur est connecte au reseau FALSE sinon */
|
|
||||||
private boolean connecte;
|
|
||||||
|
|
||||||
/* Acces a la base de donnée */
|
|
||||||
private DataBase db;
|
|
||||||
|
|
||||||
/* Variable stockant les communications grâce aux IDs des utilisateurs */
|
|
||||||
public ArrayList<String> listeCommunication = new ArrayList<>();
|
|
||||||
|
|
||||||
/* Variable stockant le backslash nécessaire pour creer l'adresse du fichier json */
|
|
||||||
public static String FILE_SEPARATOR = System.getProperty("file.separator");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private JSONObject configJSON;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Getter : Connecte
|
|
||||||
* <br> Permet de savoir si l'on est connecté</p>
|
|
||||||
* @return TRUE si connecté FALSE sinon
|
|
||||||
*/
|
|
||||||
public boolean isConnecte() {
|
|
||||||
return connecte;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Constructeur de l'application de chat</p>
|
|
||||||
* @param pseudo Pseudo de l'utilisateur
|
|
||||||
* @param port Port de communication
|
|
||||||
* @param main L'Application main
|
|
||||||
*/
|
|
||||||
public ChatApp(String pseudo, Integer port, Application main){
|
|
||||||
this.actifUsers = new ListUtilisateurs() ;
|
|
||||||
InetAddress ip = UDPEchange.getCurrentIp(); // Recuperer adresse IP de l'utilisateur
|
|
||||||
this.me = new Utilisateur(pseudo,port,ip);
|
|
||||||
this.actifUsers.addList(getMe());
|
|
||||||
this.main = main;
|
|
||||||
|
|
||||||
this.connecte=false;
|
|
||||||
|
|
||||||
String path = System.getProperty("user.dir")+ FILE_SEPARATOR + "config.json";
|
|
||||||
System.out.println("Path is : "+path);
|
|
||||||
JSONParser jsonP = new JSONParser();
|
|
||||||
try {
|
|
||||||
this.configJSON = (JSONObject) jsonP.parse(new FileReader(path));
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println("Fichier JSON non trouvable");
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
System.out.println("Fichier JSON mal formé");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
this.externeEchange = new HttpEchange(this);
|
|
||||||
this.db= DataBase.getInstance(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Methode permettant de créer qu'une seule instance de chatapp</p>
|
|
||||||
* @param pseudo Le pseudonyme que l'on souhaite donner à l'utilisateur
|
|
||||||
* @param port Le port auquel on souhaite réceptionner les requêtees UDP
|
|
||||||
* @param main Le stage de l'interface graphique qui crée l'instance
|
|
||||||
* @return Une instance de chatapp
|
|
||||||
*/
|
|
||||||
public static synchronized ChatApp getInstance(String pseudo, Integer port, Application main){
|
|
||||||
if (chatapp == null) {
|
|
||||||
chatapp = new ChatApp(pseudo, port, main);
|
|
||||||
}
|
|
||||||
return chatapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Methode permettant de récupérer l'instance de chatapp qui a ete créée au préalable</p>
|
|
||||||
* @return L'instance de chatapp
|
|
||||||
*/
|
|
||||||
public static ChatApp getInstance(){
|
|
||||||
return chatapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Methode appelée pour modifier le pseudo et fait appel a la fonction adequate selon que l'on est en interne ou en externe</p>
|
|
||||||
* @param nouveau Nouveau pseudo avec lequel on souhaite se renommer
|
|
||||||
* @return TRUE si la modification du pseudo a réussi, FALSE sinon
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public boolean modifierPseudo(String nouveau) throws IOException{
|
|
||||||
if(this.isExterne()){
|
|
||||||
return this.modifierPseudoExterne(nouveau);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return modifierPseudoInterne(nouveau);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Modification du pseudo de l'utilisateur en EXTERNE.
|
|
||||||
* <br>Envoie ses informations utilisateurs et son nouveau pseudo au serveur de présence.</p>
|
|
||||||
* @param nouveau Le nouveau pseudo
|
|
||||||
* @return False si modiferPseudo a échoué, True sinon
|
|
||||||
*/
|
|
||||||
private boolean modifierPseudoExterne(String nouveau) {
|
|
||||||
boolean reussi = false;
|
|
||||||
try {
|
|
||||||
if(externeEchange.sendPost("Pseudo " + nouveau)){
|
|
||||||
reussi = true ;
|
|
||||||
this.getMe().setPseudo(nouveau);
|
|
||||||
db.majPseudo(this.me.getId(),nouveau);
|
|
||||||
System.out.println("Changement pseudo accepte, nouvelle liste des utilisateurs actifs:");
|
|
||||||
this.getActifUsers().afficherListeUtilisateurs();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
System.out.println("Echec changement de pseudo");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return reussi;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Modification du pseudo de l'utilisateur en INTERNE
|
|
||||||
* <br> Envoie en broadcast ses informations utilisateurs et son nouveau pseudo</p>
|
|
||||||
* @param nouveau Le Nouveau pseudo
|
|
||||||
* @return False si modiferPseudo a échoué, True sinon
|
|
||||||
*/
|
|
||||||
public Boolean modifierPseudoInterne(String nouveau) throws IOException {
|
|
||||||
// Message que l'on envoie à tous les utilisateurs actifs
|
|
||||||
String broadcastMessage = "Demande Modification Pseudo\n" + this.getMe().toString() + "\n" + nouveau + "\n";
|
|
||||||
UDPEchange.envoiBroadcast(broadcastMessage);
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
/* L'utilisateur doit attendre la reponse de tous les utilisateurs connectes
|
|
||||||
* pour savoir si son pseudo est accepte
|
|
||||||
*/
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (UDPEchange.getPseudoValide()) {
|
|
||||||
System.out.println("Modification pseudo reussi");
|
|
||||||
//Envoi un msg en broadcast a tout les utilisateurs pour les prevenir de son nouveau pseudo//
|
|
||||||
broadcastMessage = "Modification pseudo reussi\n" + this.getMe().toString() + "\n" + nouveau + "\n";
|
|
||||||
UDPEchange.envoiBroadcast(broadcastMessage);
|
|
||||||
//-------Change son propre nom d'utilisateur-------//
|
|
||||||
this.getActifUsers().modifierList(this.getMe().getPseudo(), nouveau);
|
|
||||||
this.getMe().setPseudo(nouveau);
|
|
||||||
db.majPseudo(this.me.getId(),nouveau);
|
|
||||||
System.out.println("Changement pseudo accepte, nouvelle liste des utilisateurs actifs:");
|
|
||||||
this.getActifUsers().afficherListeUtilisateurs();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("Echec Modification pseudo");
|
|
||||||
UDPEchange.setPseudoValide(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Méthode permettant d'appeler la fonction de connexion adequate selon que l'on est en externe ou en interne</p>
|
|
||||||
* @param pseudo Le pseudo avec lequel l'on souhaite se connecter
|
|
||||||
* @return True si la connexion a ete autorisée, false sinon
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public boolean connexion(String pseudo) throws IOException{
|
|
||||||
if(this.isExterne()){
|
|
||||||
try {
|
|
||||||
System.out.println("Demande de connexion distante");
|
|
||||||
return this.connexionExterne(pseudo);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return connexionInterne(pseudo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Méthode appelée lors de la connexion de l'utilisateur en EXTERNE.
|
|
||||||
* <br> Va prévenir le serveur de présence de l'arrivée de l'utilisateur </p>
|
|
||||||
* @param pseudo Le pseudonyme avec lequel l'utilisateur souhaite se connecter
|
|
||||||
* @return False si Connexion a échoué, True sinon
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private boolean connexionExterne(String pseudo) throws IOException, InterruptedException{
|
|
||||||
this.me.setPseudo(pseudo);
|
|
||||||
if(externeEchange.sendPost("Connexion")){
|
|
||||||
this.connecte=true;
|
|
||||||
this.db.ajoutUtilisateurs(this.me.getId(),pseudo);
|
|
||||||
this.db.majUtilisateursActifs(true,this.me.getId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Méthode appelée lors de la connexion de l'utilisateur en INTERNE,
|
|
||||||
* <br> Va prevenir les autres utlisateurs du réseau de l'arrivée de l'utilisateur sur celui-ci</p>
|
|
||||||
* @param pseudo Le pseudonyme avec lequel l'utilisateur souhaite se connecter
|
|
||||||
* @return False si Connexion a échoué, True sinon
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public Boolean connexionInterne(String pseudo) throws IOException {
|
|
||||||
// Message que l'on envoie à tous les utilisateurs actifs
|
|
||||||
this.me.setPseudo(pseudo);
|
|
||||||
String broadcastMessage = "Connexion\n" + this.getMe().toString() ;
|
|
||||||
UDPEchange.envoiBroadcast(broadcastMessage);
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000); // L'utilisateur doit attendre la reponse de tous les utilisateurs connectes
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (UDPEchange.getConnecte()) {
|
|
||||||
System.out.println("Connexion reussie");
|
|
||||||
this.connecte=true;
|
|
||||||
this.db.ajoutUtilisateurs(this.me.getId(),pseudo);
|
|
||||||
this.db.majUtilisateursActifs(true,this.me.getId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("Connexion echoue");
|
|
||||||
UDPEchange.setConnecte(true);
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Lance un thread pour écouter les requêtes TCP
|
|
||||||
* <br> Informe le pcs que chatapp écoute les notifications qu'il envoie</p>
|
|
||||||
*/
|
|
||||||
public void activerEcouteTCP(){
|
|
||||||
this.runnerEcouteTCP = new RunnerEcouteTCP(this);
|
|
||||||
this.runnerEcouteTCP.addPropertyChangeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Démarre une session de clavardage avec l'utilisateur dont le pseudo est entré en parametre</p>
|
|
||||||
* @param pseudo Le pseudo de l'utilisateur avec lequel on souhaite communiquer
|
|
||||||
*/
|
|
||||||
public void demarrerSession(String pseudo){
|
|
||||||
Utilisateur u2 = this.actifUsers.getPseudoList(pseudo);
|
|
||||||
SessionClavardage session = new SessionClavardage(u2,this);
|
|
||||||
runnerEcouteTCP.addSession(session);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Lance le thread pour réceptionner les requetes UDP</p>
|
|
||||||
*/
|
|
||||||
public void activerEcouteUDP(){
|
|
||||||
this.runnerEcouteUDP = new RunnerEcouteUDP(this);
|
|
||||||
this.runnerEcouteUDP.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Méthode appelée lors de la déconnexion de l'utilisateur.
|
|
||||||
* <br>La methode va appeler la fonction adequate selon que l'on est en interne ou en externe</p>
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void deconnexion() throws IOException{
|
|
||||||
if(this.isExterne()){
|
|
||||||
this.deconnexionExterne();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
deconnexionInterne();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Methode appelee lors de la deconnexion en EXTERNE de l'utilisateur.
|
|
||||||
* <br>Il va prévenir le serveur de présence de son depart.</p>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void deconnexionExterne() throws IOException{
|
|
||||||
System.out.println("Deconnexion lancee");
|
|
||||||
boolean deco = false;
|
|
||||||
try {
|
|
||||||
deco = externeEchange.sendPost("Deconnexion");
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if(deco){
|
|
||||||
System.out.print("Deconnexion reussie");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
System.out.println("Deconnexion echouee");
|
|
||||||
}
|
|
||||||
db.majUtilisateursActifs(false,this.me.getId());
|
|
||||||
this.connecte=false;
|
|
||||||
try {
|
|
||||||
main.stop();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Platform.exit();
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Methode appelee lors de la deconnexion en INTERNE de l'utilisateur.
|
|
||||||
* <br>Il va prevenir les utilisateurs du reseau de son depart.</p>
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void deconnexionInterne() throws IOException {
|
|
||||||
// Message que l'on envoie à tous les utilisateurs actifs
|
|
||||||
String broadcastMessage = "Deconnexion\n" + this.getMe().toString() ;
|
|
||||||
UDPEchange.envoiBroadcast(broadcastMessage);
|
|
||||||
db.majUtilisateursActifs(false,this.me.getId());
|
|
||||||
this.connecte=false;
|
|
||||||
try {
|
|
||||||
main.stop();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Platform.exit();
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Chatapp
|
|
||||||
* @return Utilisateur associée a ChatApp
|
|
||||||
*/
|
|
||||||
public Utilisateur getMe() {
|
|
||||||
return me;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : actifUsers (Liste des utilisateurs actifs)
|
|
||||||
* @return Liste des utilisateurs actifs associée a ChatApp
|
|
||||||
*/
|
|
||||||
public ListUtilisateurs getActifUsers() {
|
|
||||||
return actifUsers;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Handler des différents évenements que chatapp écoute</p>
|
|
||||||
* @param evt L'évenement qui a ete indiqué par le pcs
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
switch (evt.getPropertyName()){
|
|
||||||
case "chatCreated" :
|
|
||||||
SessionClavardage session = this.runnerEcouteTCP.getSessionClavardage();
|
|
||||||
session.addPropertyChangeListener(this);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Getter : Main
|
|
||||||
* Permet de récuperer stage de l'interface graphique qui a crée l'instance
|
|
||||||
* </p>
|
|
||||||
* @return Le stage de l'interface graphique qui a crée l'instance
|
|
||||||
*/
|
|
||||||
public Application getMain() {
|
|
||||||
return main;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Getter : BDD
|
|
||||||
* <br> Permet de récuperer la base de donnee associée
|
|
||||||
* </p>
|
|
||||||
* @return La base de donnee associée
|
|
||||||
*/
|
|
||||||
public DataBase getDb(){return this.db;}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Getter : Externe
|
|
||||||
* <br> Permet de savoir si on est en externe ou en interne</p>
|
|
||||||
* @return TRUE si Externe FALSE sinon
|
|
||||||
*/
|
|
||||||
public boolean isExterne() {
|
|
||||||
return isExterne;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Setter : Externe
|
|
||||||
* <br> Permet de définir si on est un utilisateur externe ou non</p>
|
|
||||||
* @param externe TRUE si Externe FALSE sinon
|
|
||||||
*/
|
|
||||||
public void setExterne(boolean externe) {
|
|
||||||
isExterne = externe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Un utilisateur ne peut pas ouvrir plusieurs sessions de clavardage avec le même utilisateur.
|
|
||||||
* <br> Cette methode compare les communications en cours pour retourner une liste d'utilisateurs avec
|
|
||||||
* lesquels les communications sont possibles
|
|
||||||
* </p>
|
|
||||||
* @return Une liste d'utilisateurs avec lesquels il peut communiquer
|
|
||||||
*/
|
|
||||||
public ArrayList<Utilisateur> createListeCommunicationPossible(){
|
|
||||||
ArrayList<Utilisateur> communication = new ArrayList<>();
|
|
||||||
for ( Utilisateur element : this.actifUsers.getActifUsers()){
|
|
||||||
if ( ! this.listeCommunication.contains(element.getId())){
|
|
||||||
communication.add(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return communication;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public JSONObject getConfigJSON() {
|
|
||||||
return configJSON;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
@startuml
|
|
||||||
|
|
||||||
title __CONTROLLER's Class Diagram__\n
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Controller {
|
|
||||||
class chatapp.Controller.ChatApp {
|
|
||||||
+ listeCommunication : ArrayList<String>
|
|
||||||
{static} - chatapp : ChatApp
|
|
||||||
- connecte : boolean
|
|
||||||
- isExterne : boolean
|
|
||||||
- main : Application
|
|
||||||
+ ChatApp()
|
|
||||||
+ activerEcouteTCP()
|
|
||||||
+ activerEcouteUDP()
|
|
||||||
+ connexion()
|
|
||||||
+ connexionInterne()
|
|
||||||
+ createListeCommunicationPossible()
|
|
||||||
+ deconnexion()
|
|
||||||
+ deconnexionInterne()
|
|
||||||
+ demarrerSession()
|
|
||||||
+ getActifUsers()
|
|
||||||
+ getDb()
|
|
||||||
{static} + getInstance()
|
|
||||||
{static} + getInstance()
|
|
||||||
+ getMain()
|
|
||||||
+ getMe()
|
|
||||||
+ isConnecte()
|
|
||||||
+ isExterne()
|
|
||||||
+ modifierPseudo()
|
|
||||||
+ modifierPseudoInterne()
|
|
||||||
+ propertyChange()
|
|
||||||
+ setExterne()
|
|
||||||
- connexionExterne()
|
|
||||||
- deconnexionExterne()
|
|
||||||
- modifierPseudoExterne()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
chatapp.Controller.ChatApp .up.|> java.beans.PropertyChangeListener
|
|
||||||
chatapp.Controller.ChatApp o-- chatapp.Model.ListUtilisateurs : actifUsers
|
|
||||||
chatapp.Controller.ChatApp o-- chatapp.Model.DataBase : db
|
|
||||||
chatapp.Controller.ChatApp o-- chatapp.Protocol.HttpEchange : externeEchange
|
|
||||||
chatapp.Controller.ChatApp o-- chatapp.Model.Utilisateur : me
|
|
||||||
chatapp.Controller.ChatApp o-- chatapp.Protocol.RunnerEcouteTCP : runnerEcouteTCP
|
|
||||||
chatapp.Controller.ChatApp o-- chatapp.Protocol.RunnerEcouteUDP : runnerEcouteUDP
|
|
||||||
|
|
||||||
|
|
||||||
right footer
|
|
||||||
|
|
||||||
|
|
||||||
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
|
|
||||||
For more information about this tool, please contact philippe.mesmeur@gmail.com
|
|
||||||
endfooter
|
|
||||||
|
|
||||||
@enduml
|
|
|
@ -1,7 +0,0 @@
|
||||||
package chatapp;
|
|
||||||
|
|
||||||
public class Launcher {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Main.main(args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
package chatapp;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cette classe extends Application.
|
|
||||||
* <br> Elle va permettre de faire le lien avec JavaFX.
|
|
||||||
*/
|
|
||||||
public class Main extends Application {
|
|
||||||
|
|
||||||
/* Instance de ChatApp */
|
|
||||||
ChatApp chatapp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Permet de lancer la fenetre principale de l'application
|
|
||||||
* @param primaryStage notre fenetre principale
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void start(Stage primaryStage) throws Exception {
|
|
||||||
this.chatapp = ChatApp.getInstance("Null",1234,this);
|
|
||||||
FXMLLoader fichier = new FXMLLoader(getClass().getResource("/fenetres/ConnexionScreen.fxml"));
|
|
||||||
Scene scene1 = new Scene(fichier.load(),600,400);
|
|
||||||
primaryStage.setScene(scene1);
|
|
||||||
primaryStage.setTitle("ChatApp");
|
|
||||||
primaryStage.setMinWidth(600);
|
|
||||||
primaryStage.setMinHeight(400);
|
|
||||||
primaryStage.show();
|
|
||||||
primaryStage.centerOnScreen();
|
|
||||||
chatapp.activerEcouteTCP();
|
|
||||||
chatapp.activerEcouteUDP();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Handler associe a la fermeture de l'application</p>
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void stop() throws Exception {
|
|
||||||
if(chatapp.isConnecte()){
|
|
||||||
chatapp.deconnexion();
|
|
||||||
} else {
|
|
||||||
super.stop();
|
|
||||||
Platform.exit();
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,511 +0,0 @@
|
||||||
package chatapp.Model;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe représentant la Base de données.
|
|
||||||
* Celle-ci stocke la liste des utilisateurs ainsi que les échanges entre eux
|
|
||||||
* </p>
|
|
||||||
* Format de la table Utilisateurs
|
|
||||||
* <br> +--------+-------------+---------+---------------------+
|
|
||||||
* <br> | ID | Pseudo | Actif | Date d'inscription |
|
|
||||||
* <br> +--------+-------------+---------+---------------------+
|
|
||||||
* <br> - Id : Correspond à l'ID de l'utilisateur
|
|
||||||
* <br> - Pseudo : Dernier Pseudo utilisé pour cet ID, va etre remplacé par le pseudo actuel avec majPseudo
|
|
||||||
* <br> - Date d'inscription : Comme son nom l'indique le jour de l'inscription de cet utilisateur
|
|
||||||
* <br> - Actif : Boolean indiquant si l'utilisateur est actif
|
|
||||||
* <br>
|
|
||||||
* <br> Chaque communication entres utilisateurs sera stockée dans une table de la forme
|
|
||||||
* <br> +--------------+--------+---------+--------------+
|
|
||||||
* <br> | Destinataire | Source | Message | Date d'envoi |
|
|
||||||
* <br> +--------------+--------+---------+--------------+
|
|
||||||
* <br> - Destinataire : Id du destinataire du message
|
|
||||||
* <br> - Source : Id de celui qui envoie le message
|
|
||||||
* <br> - Message : Msg envoyé
|
|
||||||
* <br> - Date d'envoi : Date a laquelle Source a envoyé le message à destinataire
|
|
||||||
*/
|
|
||||||
public class DataBase {
|
|
||||||
|
|
||||||
/* URL pour accéder à la BDD */
|
|
||||||
private String dBurl = "jdbc:mysql://srv-bdens.insa-toulouse.fr:3306/tp_servlet_006?" ;
|
|
||||||
|
|
||||||
/* Connection avec la BDD */
|
|
||||||
private Connection connection = null;
|
|
||||||
|
|
||||||
/* Login pour se connecter à la BDD */
|
|
||||||
private String login = "tp_servlet_006";
|
|
||||||
|
|
||||||
/* Mdp pour se connecter à la BDD */
|
|
||||||
private String pswd = "baePh9ei";
|
|
||||||
|
|
||||||
private ChatApp chatapp;
|
|
||||||
|
|
||||||
/* Singleton */
|
|
||||||
private static final DataBase instance = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur de la database
|
|
||||||
* <br> On installe le driver et on établit la connection.
|
|
||||||
*/
|
|
||||||
public DataBase(ChatApp chatapp) {
|
|
||||||
this.chatapp = chatapp;
|
|
||||||
this.login = (String) chatapp.getConfigJSON().get("BaseDeDonnesLogin");
|
|
||||||
this.pswd = (String) chatapp.getConfigJSON().get("BaseDeDonneesMDP");
|
|
||||||
this.dBurl = (String) chatapp.getConfigJSON().get("BaseDeDonnesURL");
|
|
||||||
try {
|
|
||||||
//Besoin d'installer le driver JDBC entre java IDE et le system DBMS pour faire un pont entre les deux
|
|
||||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
|
||||||
System.out.println("Driver Installe");
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec installation Driver");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
//Etablir une connexion , forme : (url, "myLogin", "myPassword");
|
|
||||||
// Nabil : DECOMMENTER CETTE LIGNE
|
|
||||||
//this.connection = DriverManager.getConnection("jdbc:mysql://localhost/POO_AL_NM?allowPublicKeyRetrieval=true&useSSL=false", "root", "1234");
|
|
||||||
// Auriane : DECOMMENTER CETTE LIGNE
|
|
||||||
//this.connection = DriverManager.getConnection("jdbc:mysql://localhost:8889/POO_AL_NM?allowPublicKeyRetrieval=true&useSSL=false", "root", "root");
|
|
||||||
System.out.println(this.dBurl);
|
|
||||||
System.out.println(this.pswd);
|
|
||||||
System.out.println(this.login);
|
|
||||||
this.connection = DriverManager.getConnection(this.dBurl,this.login,this.pswd);
|
|
||||||
System.out.println("Connexion Etablie");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec d'etablissement de la connexion");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de renvoyer une instance de la classe DataBase
|
|
||||||
* @return L'instance du singleton DataBase.
|
|
||||||
*/
|
|
||||||
public static DataBase getInstance(ChatApp chatapp) {
|
|
||||||
synchronized (DataBase.class) {
|
|
||||||
return new DataBase(chatapp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Methode permettant de créer une table pour stocker les messages entre deux utilisateurs
|
|
||||||
* @param iD1 Id du premier utilisateur
|
|
||||||
* @param iD2 Id du second utilisateur
|
|
||||||
*/
|
|
||||||
public void creationTableHistorique(String iD1 , String iD2) {
|
|
||||||
// Pour eviter d'avoir les tables en double
|
|
||||||
String petit;
|
|
||||||
String grand;
|
|
||||||
int comparaison = iD1.compareTo(iD2);
|
|
||||||
if (comparaison < 0) {
|
|
||||||
petit = iD1;
|
|
||||||
grand = iD2 ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
petit = iD2;
|
|
||||||
grand = iD1 ;
|
|
||||||
}
|
|
||||||
String nomTable = "Chat_" + petit + "_" + grand ;
|
|
||||||
String requete = "CREATE TABLE IF NOT EXISTS`" + nomTable +"` (\n" + "`Destinataire` varchar(100) NOT NULL,\n" + " `Source` varchar(100) NOT NULL,\n" + " `Envoi` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n" + " `Message` text NOT NULL\n" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ;";
|
|
||||||
System.out.println(requete);
|
|
||||||
PreparedStatement ps = null ;
|
|
||||||
//Statement est utilisé pour envoyer une requete SQL à la base de donnee
|
|
||||||
try {
|
|
||||||
ps = connection.prepareStatement(requete);
|
|
||||||
System.out.println("Statement cree");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec creation Statement");
|
|
||||||
}
|
|
||||||
//Execute la donnée SQL statement passe en parametre
|
|
||||||
try {
|
|
||||||
assert ps != null;
|
|
||||||
ps.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println(" Echec executeUpdate ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de mettre a jour le pseudo d'un utilisateur en fonction de son ID dans la base de donnee
|
|
||||||
* @param iD Id de l'utilisateur qui vient de changer de pseudo
|
|
||||||
* @param pseudo Nouveau Pseudo de l'utilisateur
|
|
||||||
*/
|
|
||||||
public void majPseudo( String iD , String pseudo) {
|
|
||||||
String requete= "UPDATE `Utilisateurs` SET `Pseudo`=? WHERE id=?";
|
|
||||||
PreparedStatement ps = null ;
|
|
||||||
//Statement est utilisé pour envoyer une requete SQL à la base de donnee
|
|
||||||
try {
|
|
||||||
ps = connection.prepareStatement(requete);
|
|
||||||
ps.setString(1, pseudo); // ? n°1 devient la valeur contenu dans Pseudo
|
|
||||||
ps.setString(2, iD); // ? n°2 devient la valeur contenu dans ID
|
|
||||||
System.out.println("Statement cree");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec creation Statement");
|
|
||||||
}
|
|
||||||
//Execute la donnée SQL statement passe en parametre
|
|
||||||
try {
|
|
||||||
assert ps != null;
|
|
||||||
ps.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println(" Echec executeUpdate ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de mettre a jour le pseudo d'un utilisateur en fonction de son ID dans la base de donnée
|
|
||||||
* @param iDdest Id de l'utilisateur Destinataire du message
|
|
||||||
* @param iDsrc Id de celui qui envoi le message
|
|
||||||
* @param msg Message envoye entre les deux utilisateurs
|
|
||||||
*/
|
|
||||||
public void ajoutHistorique(String iDdest , String iDsrc, String msg) {
|
|
||||||
String petit;
|
|
||||||
String grand;
|
|
||||||
int comparaison = iDdest.compareTo(iDsrc);
|
|
||||||
if (comparaison < 0) {
|
|
||||||
petit = iDdest;
|
|
||||||
grand = iDsrc ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
petit = iDsrc;
|
|
||||||
grand = iDdest ;
|
|
||||||
}
|
|
||||||
String nomTable = "Chat_" + petit + "_" + grand ;
|
|
||||||
String requete= "INSERT INTO `"+ nomTable +"`(`Destinataire`, `Source`, `Message`) VALUES ( ? , ? , ?)";
|
|
||||||
PreparedStatement ps = null ;
|
|
||||||
//Statement est utilisé pour envoyer une requete SQL à la base de donnee
|
|
||||||
try {
|
|
||||||
ps = connection.prepareStatement(requete);
|
|
||||||
ps.setString(1, iDdest); // ? n°1 devient la valeur contenu dans IDdest
|
|
||||||
ps.setString(2, iDsrc); // ? n°2 devient la valeur contenu dans IDsrc
|
|
||||||
ps.setString(3, msg); // ? n°3 devient la valeur contenu dans Msg
|
|
||||||
//La date de l'envoi n'a pas besoin d'être renseigné, elle est automatique
|
|
||||||
System.out.println("Statement cree");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec creation Statement");
|
|
||||||
}
|
|
||||||
//Execute la donnée SQL statement passe en parametre
|
|
||||||
try {
|
|
||||||
assert ps != null;
|
|
||||||
ps.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println(" Echec executeUpdate ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant d'ajouter un utilisateur dans la base de donnée si celui-ci n'existe pas déjà
|
|
||||||
* @param iD Id de l'utilisateur que l'on veut rajouter
|
|
||||||
* @param pseudo Pseudo actuelle de l'utilisateur
|
|
||||||
*/
|
|
||||||
public void ajoutUtilisateurs(String iD , String pseudo ) {
|
|
||||||
if(this.idExiste(iD)){
|
|
||||||
this.majPseudo(iD, pseudo);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// L'utilisateur n'existe pas , on va le rajouter.
|
|
||||||
System.out.println("On rajoute l'utilisateur " + pseudo);
|
|
||||||
String requete = "INSERT INTO `Utilisateurs` (`ID`, `Pseudo`, `Actif`) VALUES ( ? , ? , '1')";
|
|
||||||
PreparedStatement ps = null;
|
|
||||||
//Statement est utilisé pour envoyer une requete SQL à la base de donnee
|
|
||||||
try {
|
|
||||||
ps = connection.prepareStatement(requete);
|
|
||||||
ps.setString(1, iD); // ? n°1 devient la valeur contenu dans ID
|
|
||||||
ps.setString(2, pseudo); // ? n°2 devient la valeur contenu dans Pseudo
|
|
||||||
System.out.println("Statement cree");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec creation Statement");
|
|
||||||
}
|
|
||||||
//Execute la donnée SQL statement passe en parametre
|
|
||||||
try {
|
|
||||||
assert ps != null;
|
|
||||||
ps.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println(" Echec executeUpdate ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de mettre a jour les utilisateurs actuellement actif
|
|
||||||
* @param Id Id de l'utilisateur qui vient de se connecter ou déconnecter
|
|
||||||
* @param Connecte Boolean true si il est connecté , false sinon
|
|
||||||
*/
|
|
||||||
public void majUtilisateursActifs(Boolean Connecte, String Id) {
|
|
||||||
String requete= "UPDATE `Utilisateurs` SET `Actif`=? WHERE id=?";
|
|
||||||
PreparedStatement Ps = null ;
|
|
||||||
int Actif = Connecte ? 1 : 0; // True -> 1 , False -> 0
|
|
||||||
//Statement est utilisé pour envoyer une requete SQL à la base de donnee
|
|
||||||
try {
|
|
||||||
Ps = connection.prepareStatement(requete);
|
|
||||||
Ps.setInt(1, Actif); // ? n°1 devient la valeur contenu dans Actif (1 ou 0)
|
|
||||||
Ps.setString(2, Id); // // ? n°2 devient la valeur contenu dans Id
|
|
||||||
System.out.println("Statement cree");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Echec creation Statement");
|
|
||||||
}
|
|
||||||
//Execute la donnée SQL statement passe en parametre
|
|
||||||
try {
|
|
||||||
assert Ps != null;
|
|
||||||
Ps.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println(" Echec executeUpdate ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de récupérer les N derniers messages envoyés entre 2 utilisateurs
|
|
||||||
* @param iD Utilisateur associé a ChatApp
|
|
||||||
* @param iDdestinataire Celui avec qui correspond ID
|
|
||||||
* @param n Le nombre de messages souhaités
|
|
||||||
* @return Les N derniers Messages
|
|
||||||
*/
|
|
||||||
public String recupNMsg(String iD, String iDdestinataire, int n) {
|
|
||||||
StringBuilder msg = new StringBuilder();
|
|
||||||
String petit;
|
|
||||||
String grand;
|
|
||||||
int comparaison = iD.compareTo(iDdestinataire);
|
|
||||||
if (comparaison < 0) {
|
|
||||||
petit = iD;
|
|
||||||
grand = iDdestinataire;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
petit = iDdestinataire;
|
|
||||||
grand = iD ;
|
|
||||||
}
|
|
||||||
String nomTable = "Chat_" + petit + "_" + grand ;
|
|
||||||
String requete = "SELECT * FROM `"+ nomTable +"`";
|
|
||||||
Statement stmt = null;
|
|
||||||
ResultSet rs = null ;
|
|
||||||
try {
|
|
||||||
stmt = this.connection.createStatement();
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
assert stmt != null;
|
|
||||||
rs = stmt.executeQuery(requete);
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
Integer taille = tailleBDD(nomTable);
|
|
||||||
if(taille < n ){
|
|
||||||
n = taille ;
|
|
||||||
}
|
|
||||||
for(int i = 0 ; i < n; i++){
|
|
||||||
try {
|
|
||||||
assert rs != null;
|
|
||||||
if( rs.next()){
|
|
||||||
String iDSource = rs.getString("Source");
|
|
||||||
String envoi = rs.getTimestamp("Envoi").toString();
|
|
||||||
String message = rs.getString("Message");
|
|
||||||
if (iDSource.equals(iD)) msg.append("Moi (").append(envoi).append(") : ").append(message);
|
|
||||||
else {
|
|
||||||
String pseudoSource = getPseudo(iDSource) ;
|
|
||||||
msg.append(pseudoSource).append(" (").append(envoi).append(") : ").append(message);
|
|
||||||
}
|
|
||||||
msg.append('\n');
|
|
||||||
}
|
|
||||||
// MSG de la forme :
|
|
||||||
// Source (Date) : Texte
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return msg.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de récupérer le pseudo actuel d'un utilisateur en fonction de son ID
|
|
||||||
* @param idSource Id de l'utilsateur dont on veut connaitre le pseudo
|
|
||||||
* @return Pseudo actuel
|
|
||||||
*/
|
|
||||||
private String getPseudo(String idSource) {
|
|
||||||
String pseudo = "" ;
|
|
||||||
String requete= "SELECT * FROM `Utilisateurs` WHERE `ID` LIKE '" + idSource + "'";
|
|
||||||
Statement stmt = null;
|
|
||||||
ResultSet rs = null ;
|
|
||||||
try {
|
|
||||||
stmt = this.connection.createStatement();
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
assert stmt != null;
|
|
||||||
rs = stmt.executeQuery(requete);
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
assert rs != null;
|
|
||||||
if (rs.next()){
|
|
||||||
pseudo = rs.getString("Pseudo") ;
|
|
||||||
}
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
return pseudo ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de récupérer les messages d'une plage de donnée [deb,fin] envoyés entre 2 utilisateurs
|
|
||||||
* @param iD Utilisateur associé a ChatApp
|
|
||||||
* @param iDdestinataire Celui avec qui correspond ID
|
|
||||||
* @param deb On veut les messages à partir de l'indice deb
|
|
||||||
* @param fin On veut les messages jusqu'a l'indice fin
|
|
||||||
* @return Les messages d'une plage de donnée [deb,fin]
|
|
||||||
*/
|
|
||||||
public String recupMsg(String iD, String iDdestinataire, int deb , int fin) {
|
|
||||||
StringBuilder msg = new StringBuilder();
|
|
||||||
String petit;
|
|
||||||
String grand;
|
|
||||||
int comparaison = iD.compareTo(iDdestinataire);
|
|
||||||
if (comparaison < 0) {
|
|
||||||
petit = iD;
|
|
||||||
grand = iDdestinataire;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
petit = iDdestinataire;
|
|
||||||
grand = iD ;
|
|
||||||
}
|
|
||||||
String nomTable = "Chat_" + petit + "_" + grand ;
|
|
||||||
String requete = "SELECT * FROM `"+ nomTable+"`";
|
|
||||||
Statement stmt = null;
|
|
||||||
ResultSet rs = null ;
|
|
||||||
try {
|
|
||||||
stmt = this.connection.createStatement();
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
assert stmt != null;
|
|
||||||
rs = stmt.executeQuery(requete);
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
Integer taille = tailleBDD(nomTable);
|
|
||||||
if(taille < fin ){
|
|
||||||
fin = taille ;
|
|
||||||
}
|
|
||||||
for(int i = 0 ; i < fin; i++){
|
|
||||||
try {
|
|
||||||
assert rs != null;
|
|
||||||
if( rs.next()){
|
|
||||||
String iDSource = rs.getString("Source");
|
|
||||||
String envoi = rs.getTimestamp("Envoi").toString();
|
|
||||||
String message = rs.getString("Message");
|
|
||||||
if (i >= deb) {
|
|
||||||
if (iDSource.equals(iD)) {
|
|
||||||
msg.append("Moi (").append(envoi).append(") : ").append(message);
|
|
||||||
} else {
|
|
||||||
String PseudoSource = getPseudo(iDSource);
|
|
||||||
msg.append(PseudoSource).append(" (").append(envoi).append(") : ").append(message);
|
|
||||||
}
|
|
||||||
msg.append('\n');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return msg.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cette méthode sert à récupérer la taille d'un base de donnée
|
|
||||||
* @param nomTable Nom de la table de donnée dont on veut récuperer le nom
|
|
||||||
* @return Taille de la BDD
|
|
||||||
*/
|
|
||||||
public Integer tailleBDD(String nomTable) {
|
|
||||||
Integer taille = 0 ;
|
|
||||||
String requete = "SELECT * FROM `"+nomTable+ "`";
|
|
||||||
Statement stmt = null;
|
|
||||||
ResultSet rs = null ;
|
|
||||||
try {
|
|
||||||
stmt = this.connection.createStatement();
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
assert stmt != null;
|
|
||||||
rs = stmt.executeQuery(requete);
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
while(true){
|
|
||||||
try {
|
|
||||||
assert rs != null;
|
|
||||||
if (!rs.next()) break;
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
taille++; // on incremente Taille pour chaque solution trouvée
|
|
||||||
}
|
|
||||||
return taille;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Methode permettant de savoir si un utilisateur existe dans la base de donnée 'Utilisateurs'
|
|
||||||
* @param iD On recherche l'utilisateur dont l'ID est ID
|
|
||||||
* @return True si l'utilisateur existe , False sinon
|
|
||||||
*/
|
|
||||||
public boolean idExiste(String iD){
|
|
||||||
boolean existe = false ;
|
|
||||||
// Verification que l'utilisateur n'existe pas
|
|
||||||
String requete = "SELECT * FROM `Utilisateurs` WHERE `ID` LIKE '" + iD +"'";
|
|
||||||
Statement stmt;
|
|
||||||
ResultSet rs = null ;
|
|
||||||
try {
|
|
||||||
stmt = this.connection.createStatement();
|
|
||||||
rs = stmt.executeQuery(requete);
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if(rs.next()){
|
|
||||||
existe = (!rs.equals(null));
|
|
||||||
}
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
return existe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de récupérer le nom de la table où sont stockés les messages de 2 utilisateurs.
|
|
||||||
* @param u1 Un des 2 utilisateurs
|
|
||||||
* @param u2 Le second utilisateur
|
|
||||||
* @return Le nom de la table des historiques
|
|
||||||
*/
|
|
||||||
public String getNomTable(Utilisateur u1, Utilisateur u2){
|
|
||||||
String petit;
|
|
||||||
String grand;
|
|
||||||
int comparaison;
|
|
||||||
comparaison = u1.getId().compareTo(u2.getId());
|
|
||||||
if (comparaison < 0) {
|
|
||||||
petit = u1.getId();
|
|
||||||
grand = u2.getId();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
petit = u2.getId() ;
|
|
||||||
grand = u1.getId() ;
|
|
||||||
}
|
|
||||||
return "Chat_" + petit + "_" + grand ;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,173 +0,0 @@
|
||||||
package chatapp.Model;
|
|
||||||
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe représentant la liste des utilisateurs actifs, stockée localement.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class ListUtilisateurs {
|
|
||||||
|
|
||||||
/* On conserve dans cette liste tout les utilisateurs actuellement actifs */
|
|
||||||
private ArrayList<Utilisateur> actifUsers ;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur : initialise la liste 'actifUsers'
|
|
||||||
*/
|
|
||||||
public ListUtilisateurs() {
|
|
||||||
this.actifUsers = new ArrayList<>() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ajouter des utilisateurs actifs dans l'attribut liste 'actifUsers'
|
|
||||||
* @param u On va rajouter cet utilisateur dans la liste
|
|
||||||
*/
|
|
||||||
public synchronized void addList(Utilisateur u) {
|
|
||||||
if (! this.appartient(u)){
|
|
||||||
this.actifUsers.add(u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupérer un utilisateur à partir de son pseudo.
|
|
||||||
* @param pseudo Pseudo de l'utilisateur que l'on souhaite retrouver
|
|
||||||
* @return L'utilisateur associé à ce pseudo
|
|
||||||
*/
|
|
||||||
public Utilisateur getPseudoList(String pseudo) {
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (elem.getPseudo().equals(pseudo) ) {
|
|
||||||
return elem ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupérer un utilisateur à partir de son addresse IP
|
|
||||||
* @param ip Adresse IP de l'utilisateur que l'on souhaite retrouver
|
|
||||||
* @return L'utilisateur associé à l'adresse IP
|
|
||||||
* @throws Exception No such user with this IP address
|
|
||||||
*/
|
|
||||||
public Utilisateur getIPList(InetAddress ip) throws Exception {
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (elem.getIp().equals(ip) ) {
|
|
||||||
return elem ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new Exception("No such user with this IP address") ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupérer un utilisateur à partir de son ID
|
|
||||||
* @param iD L'ID de l'utilisateur que l'on souhaite retrouver
|
|
||||||
* @return L'utilisateur associé à l'adresse ID
|
|
||||||
* @throws Exception No such user with this ID
|
|
||||||
*/
|
|
||||||
public Utilisateur getIDList(String iD) throws Exception {
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (elem.getId().equals(iD) ) {
|
|
||||||
return elem ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new Exception("No such user with this ID") ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Supprimer de la liste des utilisateurs actifs 'actifUsers' un certain utilisateur
|
|
||||||
* @param u On va supprimer cet utilisateur dans la liste
|
|
||||||
*/
|
|
||||||
public synchronized void supprimerList(Utilisateur u) {
|
|
||||||
boolean Sup = false ;
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (elem.equals(u) ) {
|
|
||||||
this.actifUsers.remove(elem);
|
|
||||||
Sup = true ;
|
|
||||||
this.afficherListeUtilisateurs();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Sup) {
|
|
||||||
System.out.println("Tentative de retirer un objet non contenu dans la liste");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Modifier le pseudo d'un utilisateur dans la liste des utilisateurs actifs 'actifUsers'
|
|
||||||
* @param ancien Pseudo à remplacer
|
|
||||||
* @param nouveau Nouveau pseudo
|
|
||||||
*/
|
|
||||||
public synchronized void modifierList(String ancien , String nouveau) {
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (ancien.equals( elem.getPseudo() ) ) {
|
|
||||||
this.actifUsers.remove(elem);
|
|
||||||
elem.setPseudo(nouveau);
|
|
||||||
this.addList(elem);
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.afficherListeUtilisateurs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de savoir si un utilisateur est contenu dans la liste 'actifUsers'
|
|
||||||
* @param u On souhaite savoir si cet utilisateur appartient a la liste
|
|
||||||
* @return True si il appartient, False sinon
|
|
||||||
*/
|
|
||||||
public Boolean appartient(Utilisateur u) {
|
|
||||||
boolean appartient = false ;
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (elem.getId().equals(u.getId())) {
|
|
||||||
appartient = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("Test appartient : " + appartient);
|
|
||||||
return appartient;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vérifie qu'aucun autre utilisateur ne posséde le meme pseudo
|
|
||||||
* @param pseudo Pseudo dont on veut vérifier l'unicité
|
|
||||||
* @return True si aucun utilisateur de la liste possède ce pseudo, False sinon
|
|
||||||
*/
|
|
||||||
public Boolean verifierUnicite(String pseudo) {
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
if (pseudo.equals( elem.getPseudo() ) ) {
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode affichant la liste des utilisateurs actifs
|
|
||||||
*/
|
|
||||||
public void afficherListeUtilisateurs() {
|
|
||||||
System.out.println ("Liste des utilisateurs actifs : ");
|
|
||||||
StringBuilder Utilisateur = new StringBuilder();
|
|
||||||
for(Utilisateur elem: this.actifUsers)
|
|
||||||
{
|
|
||||||
System.out.println (elem.toString());
|
|
||||||
Utilisateur.append(elem).append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : ActifUsers (liste des utilisateurs actifs)
|
|
||||||
* @return La liste des utilisateurs actifs
|
|
||||||
*/
|
|
||||||
public ArrayList<Utilisateur> getActifUsers(){
|
|
||||||
return this.actifUsers;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,195 +0,0 @@
|
||||||
package chatapp.Model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe représentant les messages envoyés en TCP lors d'une session de clavardage.
|
|
||||||
* <br> Un message Horodaté est composé :
|
|
||||||
* <br> - d'un destintaire,
|
|
||||||
* <br> - d'une source,
|
|
||||||
* <br> - d'un message,
|
|
||||||
* <br> - d'une date d'envoi.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class MessageHorodate implements Serializable {
|
|
||||||
/* Un message est toujours adressé à un destinataire */
|
|
||||||
private Utilisateur destinataire ;
|
|
||||||
|
|
||||||
/* Un message est toujours associé à un utilisateur source */
|
|
||||||
private Utilisateur source ;
|
|
||||||
|
|
||||||
/* La date d'horodatage du message */
|
|
||||||
private Date dateHorodatage ;
|
|
||||||
|
|
||||||
/* Le type d'un messge : 0 = debut de la communication, 1= message de communication, 2 = fin de la communicataion */
|
|
||||||
private int type;
|
|
||||||
|
|
||||||
/* Le corps du message */
|
|
||||||
private String Message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Constructeur , le message va etre horodaté
|
|
||||||
* @param destinataire - Destinataire du message
|
|
||||||
* @param source - Source du message
|
|
||||||
* @param message - Message envoyé
|
|
||||||
* @param type - Le type du message
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public MessageHorodate(Utilisateur destinataire, Utilisateur source, String message, int type) {
|
|
||||||
this.setDestinataire(destinataire) ;
|
|
||||||
this.setSource(source) ;
|
|
||||||
this.setMessage(message) ;
|
|
||||||
this.setDateHorodatage(new Date());
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter: Date d'horodatage
|
|
||||||
* <br> On modifie le date d'horodatage
|
|
||||||
* @param d La nouvelle date d'horodatage
|
|
||||||
*/
|
|
||||||
public void setDate(Date d) {
|
|
||||||
this.setDateHorodatage(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Permet de créer une représentation string du message
|
|
||||||
* @return Les différents attributs de la classe sous forme de string
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
String msg = "";
|
|
||||||
msg += ("Destinataire::" + this.getDestinataire() + "\n") ;
|
|
||||||
msg += ("Source::" + this.getSource()+ "\n") ;
|
|
||||||
msg += ("Type::"+ this.type+ "\n");
|
|
||||||
msg += ("Date::" + this.dateToString() + "\n") ;
|
|
||||||
msg += ("Message::" + this.getMessage() + "\n" );
|
|
||||||
return msg ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Permet de créer une représentation string de la date d'horodatage
|
|
||||||
* @return La date d'horodatage du message en format yyyy/MM/dd HH:mm:ss
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public String dateToString() {
|
|
||||||
DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
||||||
return format.format(this.getDateHorodatage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Permet de re créer un message horodaté à partir d'un string
|
|
||||||
* @param s Le message permettant de re créer un msg horodaté
|
|
||||||
* @return un messageHorodate
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public static MessageHorodate stringToMessageHorodate(String s) {
|
|
||||||
String[] mots = s.split("\n");
|
|
||||||
Utilisateur destinataire = Utilisateur.stringToUtilisateur(mots[0].split("::")[1]);
|
|
||||||
Utilisateur source = Utilisateur.stringToUtilisateur(mots[1].split("::")[1]);
|
|
||||||
int type = Integer.parseInt(mots[2].split("::")[1]);
|
|
||||||
String payload = "";
|
|
||||||
for(int i=4; i< mots.length; i++) {
|
|
||||||
if(mots[i].startsWith("Message::")) {
|
|
||||||
mots[i]=mots[i].split("::")[1];
|
|
||||||
}
|
|
||||||
payload += mots[i]+"\n";
|
|
||||||
}
|
|
||||||
return new MessageHorodate(destinataire, source, payload, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter: Utilisateur Source
|
|
||||||
* @return Utilisateur a l'origine du message
|
|
||||||
*/
|
|
||||||
public Utilisateur getSource() {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter: Utilisateur Source
|
|
||||||
* <br> On modifie l'utilisateur source
|
|
||||||
* @param source Le nouvel utilisateur source
|
|
||||||
*/
|
|
||||||
public void setSource(Utilisateur source) {
|
|
||||||
this.source = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter: Utilisateur Destinataire
|
|
||||||
* @return Utilisateur recevant le message
|
|
||||||
*/
|
|
||||||
public Utilisateur getDestinataire() {
|
|
||||||
return destinataire;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter: Utilisateur Destinataire
|
|
||||||
* <br> On modifie l'utilisateur Destinataire
|
|
||||||
* @param destinataire Le nouveau destinataire
|
|
||||||
*/
|
|
||||||
public void setDestinataire(Utilisateur destinataire) {
|
|
||||||
this.destinataire = destinataire;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter: Message envoye
|
|
||||||
* @return Le message envoye
|
|
||||||
*/
|
|
||||||
public String getMessage() {
|
|
||||||
return Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter: Message envoye
|
|
||||||
* <br> On modifie le message envoyé
|
|
||||||
* @param message Nouveau message
|
|
||||||
*/
|
|
||||||
public void setMessage(String message) {
|
|
||||||
Message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter: 'Type' du message
|
|
||||||
* @return On recupere le Type du message
|
|
||||||
*/
|
|
||||||
public int getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Setter: 'Type' du message horodate
|
|
||||||
* <br> On modifie l'integer 'Type'
|
|
||||||
* @param Type Nouveau type
|
|
||||||
*/
|
|
||||||
public void setType(int Type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter: Date d'horodatage
|
|
||||||
* @return On recupere le date
|
|
||||||
*/
|
|
||||||
public Date getDateHorodatage() {
|
|
||||||
return dateHorodatage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter: Date d'horodatage
|
|
||||||
* <br> On modifie le date.
|
|
||||||
* @param dateHorodatage Nouvelle date d'horodatage
|
|
||||||
*/
|
|
||||||
public void setDateHorodatage(Date dateHorodatage) {
|
|
||||||
this.dateHorodatage = dateHorodatage;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
@startuml
|
|
||||||
|
|
||||||
title __MODEL's Class Diagram__\n
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Model {
|
|
||||||
class chatapp.Model.DataBase {
|
|
||||||
- connection : Connection
|
|
||||||
- dBurl : String
|
|
||||||
{static} - instance : DataBase
|
|
||||||
- login : String
|
|
||||||
- pswd : String
|
|
||||||
+ DataBase()
|
|
||||||
+ ajoutHistorique()
|
|
||||||
+ ajoutUtilisateurs()
|
|
||||||
+ creationTableHistorique()
|
|
||||||
{static} + getInstance()
|
|
||||||
+ getNomTable()
|
|
||||||
+ idExiste()
|
|
||||||
+ majPseudo()
|
|
||||||
+ majUtilisateursActifs()
|
|
||||||
+ recupMsg()
|
|
||||||
+ recupNMsg()
|
|
||||||
+ tailleBDD()
|
|
||||||
- getPseudo()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Model {
|
|
||||||
class chatapp.Model.ListUtilisateurs {
|
|
||||||
- actifUsers : ArrayList<Utilisateur>
|
|
||||||
+ ListUtilisateurs()
|
|
||||||
+ addList()
|
|
||||||
+ afficherListeUtilisateurs()
|
|
||||||
+ appartient()
|
|
||||||
+ getActifUsers()
|
|
||||||
+ getIDList()
|
|
||||||
+ getIPList()
|
|
||||||
+ getPseudoList()
|
|
||||||
+ modifierList()
|
|
||||||
+ supprimerList()
|
|
||||||
+ verifierUnicite()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Model {
|
|
||||||
class chatapp.Model.MessageHorodate {
|
|
||||||
- Message : String
|
|
||||||
- dateHorodatage : Date
|
|
||||||
- type : int
|
|
||||||
+ MessageHorodate()
|
|
||||||
+ dateToString()
|
|
||||||
+ getDateHorodatage()
|
|
||||||
+ getDestinataire()
|
|
||||||
+ getMessage()
|
|
||||||
+ getSource()
|
|
||||||
+ getType()
|
|
||||||
+ setDate()
|
|
||||||
+ setDateHorodatage()
|
|
||||||
+ setDestinataire()
|
|
||||||
+ setMessage()
|
|
||||||
+ setSource()
|
|
||||||
+ setType()
|
|
||||||
{static} + stringToMessageHorodate()
|
|
||||||
+ toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Model {
|
|
||||||
class chatapp.Model.Utilisateur {
|
|
||||||
~ TAILLE_MAX : Integer
|
|
||||||
- id : String
|
|
||||||
- ip : InetAddress
|
|
||||||
- port : Integer
|
|
||||||
- pseudo : String
|
|
||||||
+ Utilisateur()
|
|
||||||
+ Utilisateur()
|
|
||||||
+ equals()
|
|
||||||
+ getId()
|
|
||||||
+ getIp()
|
|
||||||
+ getPort()
|
|
||||||
+ getPseudo()
|
|
||||||
+ setPort()
|
|
||||||
+ setPseudo()
|
|
||||||
{static} + stringToUtilisateur()
|
|
||||||
+ toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
chatapp.Model.MessageHorodate .up.|> java.io.Serializable
|
|
||||||
chatapp.Model.MessageHorodate o-- chatapp.Model.Utilisateur : destinataire
|
|
||||||
chatapp.Model.MessageHorodate o-- chatapp.Model.Utilisateur : source
|
|
||||||
|
|
||||||
|
|
||||||
right footer
|
|
||||||
|
|
||||||
|
|
||||||
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
|
|
||||||
For more information about this tool, please contact philippe.mesmeur@gmail.com
|
|
||||||
endfooter
|
|
||||||
|
|
||||||
@enduml
|
|
|
@ -1,161 +0,0 @@
|
||||||
package chatapp.Model;
|
|
||||||
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant un Utilisateur.
|
|
||||||
* <br> Un Utilisateur est associé avec :
|
|
||||||
* <br> - un pseudo,
|
|
||||||
* <br> - un numéro de port,
|
|
||||||
* <br> - une addresse IP
|
|
||||||
* <br> - un ID.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class Utilisateur {
|
|
||||||
|
|
||||||
/* Un utilisateur possede un pseudo unique */
|
|
||||||
private String pseudo ;
|
|
||||||
|
|
||||||
/* Un port (utilisé lors de nos premiers tests pour tester le broadcast) */
|
|
||||||
private Integer port;
|
|
||||||
|
|
||||||
/* Un utilisateur est associé à une adresse IP */
|
|
||||||
private final InetAddress ip ;
|
|
||||||
|
|
||||||
/* Chaque utilisateur possede un ID unique */
|
|
||||||
private final String id ;
|
|
||||||
|
|
||||||
/* La taille maximum d'un ID */
|
|
||||||
Integer TAILLE_MAX = 10;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur : Utilisateur (3 paramètres)
|
|
||||||
* @param pseudo Le pseudo associé
|
|
||||||
* @param port Le port
|
|
||||||
* @param ip L'adresse IP
|
|
||||||
*/
|
|
||||||
public Utilisateur(String pseudo,Integer port, InetAddress ip ){
|
|
||||||
this.setPseudo(pseudo) ;
|
|
||||||
this.setPort(port);
|
|
||||||
this.ip = ip ;
|
|
||||||
String aux= ip.getHostName() ;
|
|
||||||
if(aux.length() > TAILLE_MAX)
|
|
||||||
aux = aux.substring(0, TAILLE_MAX);
|
|
||||||
this.id = aux ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur : Utilisateur (4 paramètres)
|
|
||||||
* @param pseudo Le pseudo associé
|
|
||||||
* @param port Le port
|
|
||||||
* @param ip L'adresse IP
|
|
||||||
* @param id L'id
|
|
||||||
*/
|
|
||||||
public Utilisateur(String pseudo,Integer port, InetAddress ip , String id){
|
|
||||||
this.setPseudo(pseudo) ;
|
|
||||||
this.setPort(port);
|
|
||||||
this.ip = ip ;
|
|
||||||
this.id = id ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter Pseudo
|
|
||||||
* @return Le pseudo de l'utilisateur
|
|
||||||
*/
|
|
||||||
public String getPseudo() {
|
|
||||||
return pseudo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter Pseudo
|
|
||||||
* @param pseudo Le nouveau pseudo que l'on souhaite
|
|
||||||
*/
|
|
||||||
public void setPseudo(String pseudo) {
|
|
||||||
this.pseudo = pseudo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter Port
|
|
||||||
* @return Le numéro de port de l'utilisateur
|
|
||||||
*/
|
|
||||||
public Integer getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter Port
|
|
||||||
* @param port Le nouveau numéro de port
|
|
||||||
*/
|
|
||||||
public void setPort(Integer port) {
|
|
||||||
this.port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter IP
|
|
||||||
* @return L'adresse IP de l'utilisateur
|
|
||||||
*/
|
|
||||||
public InetAddress getIp() {
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter ID
|
|
||||||
* @return L'ID de l'utilisateur
|
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de convertir un objet Utilisateur en String
|
|
||||||
* <br> Format du string :
|
|
||||||
* <br> pseudo ___ | port ___ | ip ___ | id ___ | ( '___' sont à remplacer par les valeurs réels)
|
|
||||||
* @return L'utilisateur sous forme de String
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
String s = "";
|
|
||||||
s+="pseudo " + this.pseudo + " | ";
|
|
||||||
s+="port " + (this.port).toString() + " | ";
|
|
||||||
s+="ip " + (this.ip).toString() + " | ";
|
|
||||||
s+="id " + (this.id).toString() + " | ";
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de convertir un string en Utilisateur
|
|
||||||
* @param s Le paramètre String a transformé
|
|
||||||
* @return Un utilisateur
|
|
||||||
*/
|
|
||||||
public static Utilisateur stringToUtilisateur(String s) {
|
|
||||||
String name;
|
|
||||||
Integer port = 0;
|
|
||||||
String ip = "" ;
|
|
||||||
String id = "";
|
|
||||||
String mots[] = s.split(" ");
|
|
||||||
name=mots[1];
|
|
||||||
port=Integer.parseInt(mots[4]);
|
|
||||||
ip=mots[7];
|
|
||||||
id=mots[10];
|
|
||||||
Utilisateur user = null;
|
|
||||||
try {
|
|
||||||
user = new Utilisateur(name,port,InetAddress.getByName(ip.split("/")[1]), id);
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de comparer deux utilisateurs entre eux grace à leur ID.
|
|
||||||
* @param u L'utilisateur avec lequel on veut être comparer.
|
|
||||||
* @return True si ils ont le même ID, False sinon.
|
|
||||||
*/
|
|
||||||
public Boolean equals(Utilisateur u) {
|
|
||||||
return this.getId().equals( u.getId() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,165 +0,0 @@
|
||||||
package chatapp.Protocol;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import chatapp.Model.Utilisateur;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.http.HttpClient;
|
|
||||||
import java.net.http.HttpRequest;
|
|
||||||
import java.net.http.HttpResponse;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant les échanges HTTP entre un utilisateur distant et le servlet.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class HttpEchange {
|
|
||||||
|
|
||||||
/* URL de notre serveur de presence */
|
|
||||||
private String url = "http://192.168.1.72:8080/Server_AL_NM/";
|
|
||||||
// private String url = "https://srv-gei-tomcat.insa-toulouse.fr/Server_AL_NM/";
|
|
||||||
//private String url = "https://srv-gei-tomcat.insa-toulouse.fr/Server_AL_NM/";
|
|
||||||
/* True si l'utilisateur peut se connecter avec ce nom d'utilisateur , False sinon */
|
|
||||||
private static boolean connecte = false;
|
|
||||||
|
|
||||||
/* Une instance de chatapp */
|
|
||||||
private ChatApp chatapp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Constructeur de la classe HttpEchange</p>
|
|
||||||
* @param chatapp La methode prend toujours en argument un paramètre chatApp associé à un utilisateur.
|
|
||||||
*/
|
|
||||||
public HttpEchange(ChatApp chatapp){
|
|
||||||
this.chatapp = chatapp;
|
|
||||||
this.url = (String) chatapp.getConfigJSON().get("ServeurURL");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Cette méthode permet de communiquer avec le servlet grâce à des requetes http de type Post.</p>
|
|
||||||
* @param type Le type de message ("Connexion", "Changement de pseudo" , "Deconnexion") ainsi que les parametres associés
|
|
||||||
* @return True ou False selon la réponse a chaque type de message envoyé.
|
|
||||||
* @throws IOException
|
|
||||||
* @throws InterruptedException
|
|
||||||
*/
|
|
||||||
public boolean sendPost(String type) throws IOException, InterruptedException{
|
|
||||||
boolean reussi = false ;
|
|
||||||
/*---------------------------------CONNEXION---------------------------------*/
|
|
||||||
if (type.equals("Connexion")){
|
|
||||||
System.out.println("Tentative de connexion distante");
|
|
||||||
HttpClient client = HttpClient.newHttpClient();
|
|
||||||
String requestBody = "Connexion\n" + this.chatapp.getMe().toString() ;
|
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create(url))
|
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpResponse<String> response = client.send(request,
|
|
||||||
HttpResponse.BodyHandlers.ofString());
|
|
||||||
|
|
||||||
/* Partie réponse du servlet */
|
|
||||||
if(response.body().equals("")){
|
|
||||||
System.out.println("Reponse recue vide");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch (response.body().split("\n")[0]){
|
|
||||||
case "Reponse Connexion":
|
|
||||||
reussi = Boolean.parseBoolean(response.body().split("\n")[1]);
|
|
||||||
System.out.println("Connexion acceptee");
|
|
||||||
int max = response.body().split("\n").length ;
|
|
||||||
if (max > 2 ){
|
|
||||||
for (int i = 2 ; i < max ; i++){
|
|
||||||
String suite = response.body().split("\n")[i];
|
|
||||||
// Le server nous envoie les utilisateurs connectés en local ou à distance
|
|
||||||
if (!suite.equals("")){
|
|
||||||
System.out.println(suite);
|
|
||||||
this.chatapp.getActifUsers().addList(Utilisateur.stringToUtilisateur(suite));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("Erreur dans le format de la réponse reçue");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*---------------------------------DECONNEXION---------------------------------*/
|
|
||||||
else if(type.equals("Deconnexion")){
|
|
||||||
System.out.println("Tentative de deconnexion distante");
|
|
||||||
HttpClient client = HttpClient.newHttpClient();
|
|
||||||
String requestBody = "Deconnexion\n" + this.chatapp.getMe().toString() ;
|
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create(url))
|
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpResponse<String> response = client.send(request,
|
|
||||||
HttpResponse.BodyHandlers.ofString());
|
|
||||||
|
|
||||||
/* Partie réponse du servlet */
|
|
||||||
if(response.body().equals("")){
|
|
||||||
System.out.println("Reponse recue vide");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println(response.body());
|
|
||||||
if(response.body().contains("Deconnexion")){
|
|
||||||
reussi = true;
|
|
||||||
System.out.println("Deconnexion acceptee");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*---------------------------------PSEUDO---------------------------------*/
|
|
||||||
/*---------------------------Le nouveau pseudo----------------------------*/
|
|
||||||
else if(type.contains("Pseudo")){
|
|
||||||
String nouveau = type.split(" ")[1];
|
|
||||||
System.out.println("Tentative de modification de pseudo d'un hote distant");
|
|
||||||
HttpClient client = HttpClient.newHttpClient();
|
|
||||||
String requestBody = "Pseudo\n" + this.chatapp.getMe().toString() + "\n" + nouveau;
|
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create(url))
|
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpResponse<String> response = client.send(request,
|
|
||||||
HttpResponse.BodyHandlers.ofString());
|
|
||||||
|
|
||||||
/* Partie réponse du servlet */
|
|
||||||
if(response.body().equals("")){
|
|
||||||
System.out.println("Reponse recue vide");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println(response.body());
|
|
||||||
switch (response.body().split("\n")[0]) {
|
|
||||||
case "Reponse Pseudo":
|
|
||||||
reussi = Boolean.parseBoolean(response.body().split("\n")[1]);
|
|
||||||
System.out.println("Connexion acceptee");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("Erreur dans le format de la réponse reçue");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
System.out.println("Erreur de type");
|
|
||||||
}
|
|
||||||
return reussi;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Connecte
|
|
||||||
* @return Le boolean connecté (True s'il peut se connecter avec ce nom d'utilisateur , False sinon)
|
|
||||||
*/
|
|
||||||
public static Boolean getConnecte() {
|
|
||||||
return connecte;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : Connecte
|
|
||||||
* @param value La nouvelle valeur du boolean de connexion
|
|
||||||
*/
|
|
||||||
public static void setConnecte(Boolean value) {
|
|
||||||
connecte = value ;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,121 +0,0 @@
|
||||||
@startuml
|
|
||||||
|
|
||||||
title __PROTOCOL's Class Diagram__\n
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Protocol {
|
|
||||||
class chatapp.Protocol.HttpEchange {
|
|
||||||
{static} - connecte : boolean
|
|
||||||
- url : String
|
|
||||||
+ HttpEchange()
|
|
||||||
{static} + getConnecte()
|
|
||||||
+ sendPost()
|
|
||||||
{static} + setConnecte()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Protocol {
|
|
||||||
class chatapp.Protocol.RunnerEcouteTCP {
|
|
||||||
- listeSessions : ArrayList<SessionClavardage>
|
|
||||||
- pcs : PropertyChangeSupport
|
|
||||||
+ RunnerEcouteTCP()
|
|
||||||
+ addPropertyChangeListener()
|
|
||||||
+ addSession()
|
|
||||||
+ ecouteTCP()
|
|
||||||
+ getSessionClavardage()
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Protocol {
|
|
||||||
class chatapp.Protocol.RunnerEcouteUDP {
|
|
||||||
+ RunnerEcouteUDP()
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Protocol {
|
|
||||||
class chatapp.Protocol.RunnerUDP {
|
|
||||||
~ data : DatagramPacket
|
|
||||||
+ RunnerUDP()
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Protocol {
|
|
||||||
class chatapp.Protocol.SessionClavardage {
|
|
||||||
- derniersMsg : ArrayList<MessageHorodate>
|
|
||||||
- in : ObjectInputStream
|
|
||||||
- link : Socket
|
|
||||||
- out : ObjectOutputStream
|
|
||||||
- pcs : PropertyChangeSupport
|
|
||||||
+ SessionClavardage()
|
|
||||||
+ SessionClavardage()
|
|
||||||
+ addPropertyChangeListener()
|
|
||||||
+ arretSession()
|
|
||||||
+ envoiMsg()
|
|
||||||
+ getApp()
|
|
||||||
+ getDernierMsg()
|
|
||||||
+ getIn()
|
|
||||||
+ getOut()
|
|
||||||
+ getU2()
|
|
||||||
+ initierSession()
|
|
||||||
+ run()
|
|
||||||
+ setApp()
|
|
||||||
+ setIn()
|
|
||||||
+ setLink()
|
|
||||||
+ setOut()
|
|
||||||
+ setU2()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace Protocol {
|
|
||||||
class chatapp.Protocol.UDPEchange {
|
|
||||||
{static} - Connecte : Boolean
|
|
||||||
{static} - PseudoValide : Boolean
|
|
||||||
{static} + ecouteUDP()
|
|
||||||
{static} + envoiBroadcast()
|
|
||||||
{static} + envoiUnicast()
|
|
||||||
{static} + getConnecte()
|
|
||||||
{static} + getCurrentIp()
|
|
||||||
{static} + getPseudoValide()
|
|
||||||
{static} + setConnecte()
|
|
||||||
{static} + setPseudoValide()
|
|
||||||
{static} ~ listAllBroadcastAddresses()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
chatapp.Protocol.HttpEchange o-- chatapp.Controller.ChatApp : chatapp
|
|
||||||
chatapp.Protocol.RunnerEcouteTCP o-- chatapp.Controller.ChatApp : app
|
|
||||||
chatapp.Protocol.RunnerEcouteUDP o-- chatapp.Controller.ChatApp : app
|
|
||||||
chatapp.Protocol.RunnerUDP .up.|> java.lang.Runnable
|
|
||||||
chatapp.Protocol.RunnerUDP o-- chatapp.Controller.ChatApp : app
|
|
||||||
chatapp.Protocol.SessionClavardage o-- chatapp.Controller.ChatApp : app
|
|
||||||
chatapp.Protocol.SessionClavardage o-- chatapp.Model.Utilisateur : u2
|
|
||||||
|
|
||||||
|
|
||||||
right footer
|
|
||||||
|
|
||||||
|
|
||||||
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
|
|
||||||
For more information about this tool, please contact philippe.mesmeur@gmail.com
|
|
||||||
endfooter
|
|
||||||
|
|
||||||
@enduml
|
|
|
@ -1,95 +0,0 @@
|
||||||
package chatapp.Protocol;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.beans.PropertyChangeSupport;
|
|
||||||
import java.net.ServerSocket;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe permettant de gérer les multiples connexions en TCP.
|
|
||||||
* <br> Extend la classe Thread.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class RunnerEcouteTCP extends Thread {
|
|
||||||
/* Une instance de ChaAapp */
|
|
||||||
public ChatApp app ;
|
|
||||||
|
|
||||||
private PropertyChangeSupport pcs;
|
|
||||||
|
|
||||||
/* on conserve les sessions actives dans un attribut liste */
|
|
||||||
private ArrayList<SessionClavardage> listeSessions = new ArrayList<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur
|
|
||||||
* @param app Un RunnerEcouteTCP est toujours associé a une application de Chat
|
|
||||||
*/
|
|
||||||
public RunnerEcouteTCP(ChatApp app) {
|
|
||||||
this.app = app ;
|
|
||||||
this.pcs = new PropertyChangeSupport(this);
|
|
||||||
this.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Permet aux classes qui appellent cette methode de connecter un PropertyChangeListener au PropertyChangeSupport
|
|
||||||
* @param pcl Le propertyChangeListener qui va ecouter les evenements du propertyChangeSupport associe
|
|
||||||
*/
|
|
||||||
public void addPropertyChangeListener(PropertyChangeListener pcl) {
|
|
||||||
this.pcs.addPropertyChangeListener("NouvelleSession",pcl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Methode pour qu'un objet de la classe ChatApp soit constamment en a l'écoute de potentielles connexions
|
|
||||||
* @param app L'utilisateur en ecoute de potentielles communications
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public void ecouteTCP(ChatApp app) {
|
|
||||||
ServerSocket ss;
|
|
||||||
System.out.println("Ecoute TCP activee");
|
|
||||||
try {
|
|
||||||
ss = new ServerSocket(5000); // On ecoute sur le port 5000
|
|
||||||
System.out.println("Socket d'ecoute cree");
|
|
||||||
while(true) { // Ecoute en boucle
|
|
||||||
System.out.println("Attente Session de clavardage");
|
|
||||||
Socket link = ss.accept(); // Blocante
|
|
||||||
SessionClavardage session = new SessionClavardage(link,app);
|
|
||||||
this.listeSessions.add(session);
|
|
||||||
pcs.firePropertyChange("NouvelleSession",false,true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant d'ajouter une session active dans la liste 'ListeSessions'
|
|
||||||
* @param session Session Active que l'on souhaite rajouter
|
|
||||||
*/
|
|
||||||
public void addSession(SessionClavardage session){
|
|
||||||
this.listeSessions.add(session);
|
|
||||||
pcs.firePropertyChange("NouvelleSession",false,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode permettant de recupérer la derniere session de clavardage créée dans 'ListeSessions'
|
|
||||||
* @return Premiere Session Active
|
|
||||||
*/
|
|
||||||
public SessionClavardage getSessionClavardage() {
|
|
||||||
return(this.listeSessions.remove(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode qui vient écraser la méthode run de la classe Thread.
|
|
||||||
* La méthode 'ecouteTCP' est appelé.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ecouteTCP(this.app);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package chatapp.Protocol;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe permettant de gérer les multiples connexions en UDP.
|
|
||||||
* <br> Extend la classe Thread.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class RunnerEcouteUDP extends Thread {
|
|
||||||
ChatApp app ;
|
|
||||||
/**
|
|
||||||
* Constructeur
|
|
||||||
* @param app Un RunnerEcouteUDP est toujours associé à une application de Chat
|
|
||||||
*/
|
|
||||||
public RunnerEcouteUDP(ChatApp app) {
|
|
||||||
this.app = app ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Méthode qui vient ecraser la méthode run de la classe Thread.
|
|
||||||
* <br> La méthode 'ecouteUDP' est appelé.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
UDPEchange.ecouteUDP(app);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,288 +0,0 @@
|
||||||
package chatapp.Protocol;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import chatapp.Model.MessageHorodate;
|
|
||||||
import chatapp.Model.Utilisateur;
|
|
||||||
import chatapp.View.FenetreSession;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.beans.PropertyChangeSupport;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe représentant une session de clavardage.
|
|
||||||
* <br> La classe hérite de la classe Thread et dispose de 2 constructeurs selon que l'on initie une demande de session ou que l'on recoit une demande.
|
|
||||||
* <br> Elle possède en attribut:
|
|
||||||
* <br> - link : la socket associée à la session de clavardage
|
|
||||||
* <br> - app : L'instance de chatapp
|
|
||||||
* <br> - u2: l'utilisateur avec lequel on communique
|
|
||||||
* <br> - out: le flux de donnees sortant
|
|
||||||
* <br> - in: le flux de donnees entrant
|
|
||||||
* <br> - pcs: Le PropertyChangeSupport permettant d'envoyer les notifications de MessageRecu et de FindeSession
|
|
||||||
* <br> - derniersMsg: la liste temporaire des derniers messages recus
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class SessionClavardage extends Thread {
|
|
||||||
|
|
||||||
/* la socket associée à la session de clavardage */
|
|
||||||
private Socket link;
|
|
||||||
|
|
||||||
/* L'instance de chatapp */
|
|
||||||
private ChatApp app;
|
|
||||||
|
|
||||||
/* l'utilisateur avec lequel on communique */
|
|
||||||
private Utilisateur u2;
|
|
||||||
|
|
||||||
/* le flux de donnees sortant */
|
|
||||||
private ObjectOutputStream out;
|
|
||||||
|
|
||||||
/* le flux de donnees entrant */
|
|
||||||
private ObjectInputStream in;
|
|
||||||
|
|
||||||
/* Le PropertyChangeSupport permettant d'envoyer les notifications de MessageRecu et de FindeSession */
|
|
||||||
private PropertyChangeSupport pcs;
|
|
||||||
|
|
||||||
/* On met temporairement les derniers msgs pour éviter les pb de synchro inter-threads */
|
|
||||||
private ArrayList<MessageHorodate> derniersMsg;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Ce constructeur crée une session de clavardage quand on recoit une requete</p>
|
|
||||||
* @param link La socket associee a la requete TCP que l'on a recu
|
|
||||||
* @param app L'instance de chatapp
|
|
||||||
*/
|
|
||||||
public SessionClavardage(Socket link, ChatApp app) {
|
|
||||||
this.setLink(link);
|
|
||||||
this.setApp(app);
|
|
||||||
try {
|
|
||||||
this.setOut(new ObjectOutputStream(link.getOutputStream()));
|
|
||||||
this.setIn(new ObjectInputStream(link.getInputStream()));
|
|
||||||
}catch(Exception e) {
|
|
||||||
e.getStackTrace();
|
|
||||||
}
|
|
||||||
this.derniersMsg = new ArrayList<>();
|
|
||||||
this.pcs = new PropertyChangeSupport(this);
|
|
||||||
this.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Le constructeur associe a l'envoi d'une requete TCP, lorsque que l'on veut initier une session de clavardage avec un utilisateur connecte</p>
|
|
||||||
* @param u2 L'utilisateur avec qui l'on souhaite démarrer une session de clavardage
|
|
||||||
* @param app L'instance de chataap associee
|
|
||||||
*/
|
|
||||||
public SessionClavardage(Utilisateur u2, ChatApp app) {
|
|
||||||
this.setU2(u2);
|
|
||||||
this.setApp(app);
|
|
||||||
try {
|
|
||||||
Socket s = new Socket(u2.getIp(),5000);
|
|
||||||
this.setOut(new ObjectOutputStream(s.getOutputStream()));
|
|
||||||
this.setIn(new ObjectInputStream(s.getInputStream()));
|
|
||||||
this.setLink(s);
|
|
||||||
} catch (IOException e) {
|
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
this.derniersMsg = new ArrayList<>();
|
|
||||||
this.pcs = new PropertyChangeSupport(this);
|
|
||||||
this.start();
|
|
||||||
this.initierSession();
|
|
||||||
Platform.runLater( () ->
|
|
||||||
new FenetreSession(this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Permet aux PropertyChangeListener de s'abonner aux notifications des evenements
|
|
||||||
* @param pcl Le PropertyListener qui souhaite s'abonner sur ce PropertyChangeSupport
|
|
||||||
*/
|
|
||||||
public void addPropertyChangeListener(PropertyChangeListener pcl){
|
|
||||||
this.pcs.addPropertyChangeListener("MessageRecu",pcl);
|
|
||||||
this.pcs.addPropertyChangeListener("FinDeLaSession",pcl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Methode permettant d'arreter cette session de clavardage et de prevenir l'autre utilisateur de la fin de la session</p>
|
|
||||||
*/
|
|
||||||
public void arretSession() {
|
|
||||||
MessageHorodate msgh = new MessageHorodate(getU2(),getApp().getMe(),".",2);
|
|
||||||
try {
|
|
||||||
getOut().writeObject(msgh.toString());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
try {
|
|
||||||
link.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Methode permettant d'initier une session de clavardage et de prevenir l'autre utilisateur du debut de la session</p>
|
|
||||||
*/
|
|
||||||
public void initierSession(){
|
|
||||||
String isExterne = "false";
|
|
||||||
if(this.app.isExterne()){
|
|
||||||
isExterne="true"; // on indiquera dans le message si l'on est externe ou interne
|
|
||||||
}
|
|
||||||
System.out.println("Ajout d'un utilisateur dans communication");
|
|
||||||
app.listeCommunication.add(getU2().getId());
|
|
||||||
System.out.println(app.listeCommunication.size());
|
|
||||||
MessageHorodate msgh = new MessageHorodate(getU2(),getApp().getMe(),isExterne,3);
|
|
||||||
try {
|
|
||||||
getOut().writeObject(msgh.toString());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Methode transformant prenant un string pour le transmettre sous la forme d'un message horodate a l'utilisateur distant
|
|
||||||
* @param msg Le texte du message à envoyer
|
|
||||||
*/
|
|
||||||
public void envoiMsg(String msg) {
|
|
||||||
MessageHorodate msgh = new MessageHorodate(getU2(),getApp().getMe(),msg,1);
|
|
||||||
try {
|
|
||||||
getOut().writeObject(msgh.toString());
|
|
||||||
app.getDb().ajoutHistorique(u2.getId(), app.getMe().getId(),msg);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Methode permettant de recuperer le dernier message recu qui a ete mis dans la liste des messages recus.
|
|
||||||
* <br> Utilisée par l'interface graphique qui a ete avertie grace au PropertyChangeSupport</p>
|
|
||||||
* @return Le dernier message horodate recu
|
|
||||||
*/
|
|
||||||
public MessageHorodate getDernierMsg() {
|
|
||||||
return this.derniersMsg.remove(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Methode lancee par le thread, permet de receptionner les messages horodates recus et d'agir en conséquence selon le type de message recu</p>
|
|
||||||
*/
|
|
||||||
public void run() {
|
|
||||||
String plaintext;
|
|
||||||
MessageHorodate msg = null;
|
|
||||||
System.out.println("Session demarre");
|
|
||||||
app.getDb().creationTableHistorique(app.getMe().getId(), u2.getId());
|
|
||||||
while(true) {
|
|
||||||
try {
|
|
||||||
plaintext = (String) getIn().readObject();
|
|
||||||
System.out.println("Message reçu");
|
|
||||||
msg = MessageHorodate.stringToMessageHorodate(plaintext);
|
|
||||||
System.out.println(msg.getMessage());
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
pcs.firePropertyChange("FinDeLaSession", false, true);
|
|
||||||
app.listeCommunication.remove(u2.getId());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(msg.getType() == 2) {
|
|
||||||
pcs.firePropertyChange("FinDeLaSession", false, true);
|
|
||||||
try {
|
|
||||||
link.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
app.listeCommunication.remove(u2.getId());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if(msg.getType() == 3) {
|
|
||||||
System.out.println("Session Initiee");
|
|
||||||
this.u2 = msg.getSource() ;
|
|
||||||
app.listeCommunication.add(u2.getId());
|
|
||||||
Platform.runLater( () ->
|
|
||||||
new FenetreSession(this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
derniersMsg.add(msg);
|
|
||||||
pcs.firePropertyChange("MessageRecu",false,true);}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Out
|
|
||||||
* @return Le flux d'ecriture des messages sortant
|
|
||||||
*/
|
|
||||||
public ObjectOutputStream getOut() {
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : Out
|
|
||||||
* @param out Le flux d'ecriture des messages sortant
|
|
||||||
*/
|
|
||||||
public void setOut(ObjectOutputStream out) {
|
|
||||||
this.out = out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : In
|
|
||||||
* @return Le flux de lecture des messages entrant
|
|
||||||
*/
|
|
||||||
public ObjectInputStream getIn() {
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : In
|
|
||||||
* @param in Le flux de lecture des messages entrant
|
|
||||||
*/
|
|
||||||
public void setIn(ObjectInputStream in) {
|
|
||||||
this.in = in;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : Link
|
|
||||||
* @param link La Socket asscciee a la connexion TCP et donc a la session
|
|
||||||
*/
|
|
||||||
public void setLink(Socket link) {
|
|
||||||
this.link = link;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : chatApp
|
|
||||||
* @return L'instance de chatApp
|
|
||||||
*/
|
|
||||||
public ChatApp getApp() {
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : chatApp
|
|
||||||
* @param app L'instance de chatApp
|
|
||||||
*/
|
|
||||||
public void setApp(ChatApp app) {
|
|
||||||
this.app = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Utilisateur 2
|
|
||||||
* @return L'utilisateur avec lequel on communique
|
|
||||||
*/
|
|
||||||
public Utilisateur getU2() {
|
|
||||||
return u2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : Utilisateur 2
|
|
||||||
* @param u2 L'utilisateur avec lequel on communique
|
|
||||||
*/
|
|
||||||
public void setU2(Utilisateur u2) {
|
|
||||||
this.u2 = u2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,399 +0,0 @@
|
||||||
package chatapp.Protocol;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import java.net.DatagramPacket;
|
|
||||||
import java.net.DatagramSocket;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
import chatapp.Controller.*;
|
|
||||||
import chatapp.Model.*;
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant les échanges UDP entre utilisateurs.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class UDPEchange {
|
|
||||||
|
|
||||||
/* True si l'utilisateur peut se connecter avec ce nom d'utilisateur , False sinon */
|
|
||||||
private static Boolean Connecte = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Connecte
|
|
||||||
* @return Le boolean connecte (True s'il peut se connecter avec ce nom d'utilisateur , False sinon)
|
|
||||||
*/
|
|
||||||
public static Boolean getConnecte() {
|
|
||||||
return Connecte;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : Connecte
|
|
||||||
* @param value La nouvelle valeur du boolean de connexion
|
|
||||||
*/
|
|
||||||
public static void setConnecte(Boolean value) {
|
|
||||||
Connecte = value ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Boolean PseudoValide = true;
|
|
||||||
// True si l'utilisateur a (ou demande) un pseudo valide , False sinon
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Pseudo Valide
|
|
||||||
* @return Le boolean PseudoValide (True s'il peut utiliser ce pseudo , False sinon)
|
|
||||||
*/
|
|
||||||
public static Boolean getPseudoValide() {
|
|
||||||
return PseudoValide;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : PseudoValise
|
|
||||||
* @param value La nouvelle valeur du boolean concernant le pseudo valide
|
|
||||||
*/
|
|
||||||
public static void setPseudoValide(Boolean value) {
|
|
||||||
PseudoValide = value ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**<p>
|
|
||||||
* Getter : Ip
|
|
||||||
* <br>Permet de recuperer l'adresse de l'hote sur le reseau au format IPv4.
|
|
||||||
* <br> Si plusieurs adresses sont disponibles (plusieurs cartes réseaux), choisit la premiere trouvée
|
|
||||||
* </p>
|
|
||||||
* @return L'adresse IP au format IPv4
|
|
||||||
*/
|
|
||||||
public static InetAddress getCurrentIp() {
|
|
||||||
try {
|
|
||||||
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface
|
|
||||||
.getNetworkInterfaces();
|
|
||||||
while (networkInterfaces.hasMoreElements()) {
|
|
||||||
NetworkInterface ni = (NetworkInterface) networkInterfaces
|
|
||||||
.nextElement();
|
|
||||||
Enumeration<InetAddress> nias = ni.getInetAddresses();
|
|
||||||
while(nias.hasMoreElements()) {
|
|
||||||
InetAddress ia= (InetAddress) nias.nextElement();
|
|
||||||
if (!ia.isLinkLocalAddress()
|
|
||||||
&& !ia.isLoopbackAddress()
|
|
||||||
&& ia instanceof Inet4Address) {
|
|
||||||
return ia;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("unable to get current IP " + e.getMessage());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Méthode permettant d'envoyer un message à tout les utilisateurs à l'aide du protocole UDP
|
|
||||||
* </p>
|
|
||||||
* @param broadcastMessage Message à transmettre aux utilisateurs
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public static void envoiBroadcast(String broadcastMessage) throws IOException {
|
|
||||||
int port = 1234 ;
|
|
||||||
// Envoie en broadcast à tous les utilisateurs
|
|
||||||
for (InetAddress broadcastAddr : listAllBroadcastAddresses()) {
|
|
||||||
DatagramSocket socket = new DatagramSocket();
|
|
||||||
socket.setBroadcast(true);
|
|
||||||
byte[]buffer = broadcastMessage.getBytes();
|
|
||||||
DatagramPacket packet = new DatagramPacket( buffer, buffer.length, broadcastAddr,port);
|
|
||||||
socket.send(packet);
|
|
||||||
socket.close();
|
|
||||||
System.out.println("Broadcast sent with address " + broadcastAddr.toString());
|
|
||||||
System.out.println("***********Message envoye***********");
|
|
||||||
System.out.println("Dest Ip: " + broadcastAddr.toString());
|
|
||||||
System.out.println("Dest port: " + String.valueOf(port));
|
|
||||||
System.out.println("Contenu: ");
|
|
||||||
System.out.println(broadcastMessage);
|
|
||||||
System.out.println("************************************");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Methode permettant la reception de messages d'utilisateurs à l'aide du protocole UDP
|
|
||||||
* </p>
|
|
||||||
* @param app L'application de chat de l'utilisateur qui receptionne le message
|
|
||||||
*/
|
|
||||||
public static void ecouteUDP(ChatApp app) {
|
|
||||||
DatagramSocket socket = null;
|
|
||||||
ExecutorService exec = Executors.newFixedThreadPool(1000);
|
|
||||||
try {
|
|
||||||
socket = new DatagramSocket(1234);
|
|
||||||
} catch (SocketException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
byte buffer[] = new byte[1024];
|
|
||||||
System.out.println("Ecoute sur le port: 1234");
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
DatagramPacket data = new DatagramPacket(buffer,buffer.length);
|
|
||||||
try {
|
|
||||||
socket.receive(data);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// Un thread est lance à chaque reception d'un message
|
|
||||||
System.out.println("Message recu!");
|
|
||||||
exec.submit(new RunnerUDP(data,app));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Méthode permettant d'envoyer un message a utilisateur en particulier
|
|
||||||
* a l'aide du protocole UDP
|
|
||||||
* </p>
|
|
||||||
* @param address L'adresse IP de l'utilisateur
|
|
||||||
* @param message Message message à transmettre a l'utilisateur
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public static void envoiUnicast( InetAddress address , String message ) throws IOException {
|
|
||||||
if (ChatApp.getInstance().isConnecte()){
|
|
||||||
DatagramSocket socket = new DatagramSocket();
|
|
||||||
byte[]buffer = message.getBytes();
|
|
||||||
DatagramPacket packet = new DatagramPacket( buffer, buffer.length, address, 1234 );
|
|
||||||
socket.send(packet);
|
|
||||||
socket.close();
|
|
||||||
System.out.println("***********Message envoye***********");
|
|
||||||
System.out.println("Dest Ip: " + address.toString());
|
|
||||||
System.out.println("Dest port: " + String.valueOf(1234));
|
|
||||||
System.out.println("Contenu: ");
|
|
||||||
System.out.println(message);
|
|
||||||
System.out.println("************************************");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Methode permettant de recuperer la liste des adresses de broadcast, chacune associer à une interface de la machine
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
static List<InetAddress> listAllBroadcastAddresses() throws SocketException {
|
|
||||||
List<InetAddress> broadcastList = new ArrayList<>();
|
|
||||||
Enumeration<NetworkInterface> interfaces
|
|
||||||
= NetworkInterface.getNetworkInterfaces();
|
|
||||||
while (interfaces.hasMoreElements()) {
|
|
||||||
NetworkInterface networkInterface = interfaces.nextElement();
|
|
||||||
|
|
||||||
if (networkInterface.isLoopback() || !networkInterface.isUp()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
networkInterface.getInterfaceAddresses().stream()
|
|
||||||
.map(a -> a.getBroadcast())
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.forEach(broadcastList::add);
|
|
||||||
}
|
|
||||||
return broadcastList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe implementant l'interface Runnable.
|
|
||||||
* <br> Contient les traitements a executer dans un thread lancer par des méthodes de la class UDPEchange
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
class RunnerUDP implements Runnable {
|
|
||||||
final DatagramPacket data ;
|
|
||||||
ChatApp app ;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur RunnerUDP
|
|
||||||
* @param data Un datagramPacket
|
|
||||||
* @param app Instance de chatapp
|
|
||||||
*/
|
|
||||||
public RunnerUDP(DatagramPacket data, ChatApp app) {
|
|
||||||
this.data= data;
|
|
||||||
this.app = app ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Methode qui redefinie les traitements qui seront executes dans le thread:
|
|
||||||
* <br> Met à jour la liste des utilisateurs actifs
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
System.out.println("Thread started");
|
|
||||||
String received = new String(data.getData(), 0, data.getLength());
|
|
||||||
System.out.println("***********Message recu***********");
|
|
||||||
System.out.println(received);
|
|
||||||
System.out.println("**********************************");
|
|
||||||
String Type = received.split("\n")[0];
|
|
||||||
|
|
||||||
//****************************************************************************************************
|
|
||||||
//****************************************************************************************************
|
|
||||||
//****************************************Demande de connexion****************************************
|
|
||||||
//****************************************************************************************************
|
|
||||||
//****************************************
|
|
||||||
if (Type.equals("Connexion")) { // un utilisateur vient d'arriver sur le reseau
|
|
||||||
System.out.println("Reception d'une demande de connexion");
|
|
||||||
Utilisateur u = Utilisateur.stringToUtilisateur(received.split("\n")[1]);
|
|
||||||
if (! u.equals(this.app.getMe())) { // On envoit en broadcast mais on ne souhaite pas recevoir de message de nous même
|
|
||||||
String reponse = "Reponse Connexion\n";
|
|
||||||
if (!( app.getActifUsers() ).verifierUnicite(u.getPseudo())) {
|
|
||||||
System.out.println("Pseudo deja present dans la liste");
|
|
||||||
reponse += "false\n";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!u.getPseudo().equals("root")){
|
|
||||||
System.out.println("Ajout d'un nouvel utilisateur dans la liste des Utilisateurs");
|
|
||||||
( app.getActifUsers() ).addList(u);
|
|
||||||
reponse += "true\n";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
System.out.println("Non ajout de root dans la liste");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reponse += app.getMe().toString();
|
|
||||||
|
|
||||||
try {
|
|
||||||
UDPEchange.envoiUnicast(u.getIp(),reponse);
|
|
||||||
}catch(IOException e)
|
|
||||||
{
|
|
||||||
System.out.println("Echec de l'envoi du message");
|
|
||||||
}
|
|
||||||
|
|
||||||
( app.getActifUsers() ).afficherListeUtilisateurs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//*******************************************************************************************************
|
|
||||||
//*******************************************************************************************************
|
|
||||||
//****************************************Reponse d'une connexion****************************************
|
|
||||||
//*******************************************************************************************************
|
|
||||||
//*******************************************************************************************************
|
|
||||||
|
|
||||||
if (Type.equals("Reponse Connexion")) { // Un utilisateur te repond suite à ta demande de connexion
|
|
||||||
if((received.split("\n")[1]).equals("true")) {
|
|
||||||
Utilisateur u = Utilisateur.stringToUtilisateur(received.split("\n")[2]);
|
|
||||||
if(!u.getPseudo().equals("root")) { // on ajoute jamais root c'est le server
|
|
||||||
app.getActifUsers().addList(u);
|
|
||||||
app.getActifUsers().afficherListeUtilisateurs();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
System.out.println("Le serveur nous a repondu");
|
|
||||||
int max = received.split("\n").length ;
|
|
||||||
if (max > 3 ){
|
|
||||||
for (int i = 3 ; i < max ; i++){
|
|
||||||
String suite = received.split("\n")[i];
|
|
||||||
// Le server nous envoie les utilisateurs connectés en local ou à distance
|
|
||||||
if (!suite.equals("")){
|
|
||||||
app.getActifUsers().addList(Utilisateur.stringToUtilisateur(suite));
|
|
||||||
System.out.println("root m'a transmis les infos de l'utilisateur " +Utilisateur.stringToUtilisateur(suite).toString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
System.out.println("Pseudo deja pris");
|
|
||||||
UDPEchange.setConnecte(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//*******************************************************************************************************************
|
|
||||||
//*******************************************************************************************************************
|
|
||||||
//****************************************Demande de modification d'un pseudo****************************************
|
|
||||||
//*******************************************************************************************************************
|
|
||||||
//*******************************************************************************************************************
|
|
||||||
|
|
||||||
if (Type.equals("Demande Modification Pseudo")) {
|
|
||||||
Utilisateur source = Utilisateur.stringToUtilisateur(received.split("\n")[1]);
|
|
||||||
if (! source.equals(this.app.getMe())) { // On envoit en broadcast mais on ne souhaite pas recevoir de message de nous même
|
|
||||||
String nouveau = received.split("\n")[2] ;
|
|
||||||
String message = "";
|
|
||||||
if(( app.getActifUsers() ).verifierUnicite(nouveau)) {
|
|
||||||
message = "Bon Choix Pseudo\n" + nouveau ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
message = "Mauvais Choix Pseudo\n" ;
|
|
||||||
}
|
|
||||||
System.out.println(message);
|
|
||||||
try {
|
|
||||||
UDPEchange.envoiUnicast(source.getIp(),message);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//************************************************************************************************************
|
|
||||||
//************************************************************************************************************
|
|
||||||
//**************************************** Modification pseudo reussi ****************************************
|
|
||||||
//************************************************************************************************************
|
|
||||||
//************************************************************************************************************
|
|
||||||
|
|
||||||
if (Type.equals("Modification pseudo reussi")) {
|
|
||||||
Utilisateur source = Utilisateur.stringToUtilisateur(received.split("\n")[1]);
|
|
||||||
if (! source.equals(this.app.getMe())) { // On envoit en broadcast mais on ne souhaite pas recevoir de message de nous même
|
|
||||||
String nouveau = received.split("\n")[2] ;
|
|
||||||
System.out.println("Je rentre ici");
|
|
||||||
if(app.getActifUsers().appartient(source)) { // On verifie d'abord que Source appartient bien a la liste des utilisateurs actifs
|
|
||||||
System.out.println(source.getPseudo() + " va etre changer en : " + nouveau);
|
|
||||||
app.getActifUsers().modifierList(source.getPseudo(), nouveau);
|
|
||||||
} else {
|
|
||||||
System.out.println(source.getPseudo() + " va etre ajouter en : " + nouveau);
|
|
||||||
// Suite a une perte d'un message lors d'une connexion l'utilisateur Source n'apparait pas dans la liste
|
|
||||||
source.setPseudo(nouveau);
|
|
||||||
app.getActifUsers().addList(source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//****************************************Mauvais choix d'un pseudo****************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
if (Type.equals("Mauvais Choix Pseudo")) {
|
|
||||||
System.out.println("Ce choix de pseudo est déjà pris il te faut en choisir un autre");
|
|
||||||
UDPEchange.setPseudoValide(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//******************************************************************************************************************
|
|
||||||
//******************************************************************************************************************
|
|
||||||
//****************************************Bon choix d'un pseudo*****************************************************
|
|
||||||
//******************************************************************************************************************
|
|
||||||
//******************************************************************************************************************
|
|
||||||
|
|
||||||
if (Type.equals("Bon Choix Pseudo")) {
|
|
||||||
// Il n'y a rien a faire ici
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//****************************************Demande d'une deconnexion****************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
|
|
||||||
if (Type.equals("Deconnexion")) {
|
|
||||||
( app.getActifUsers() ).supprimerList(Utilisateur.stringToUtilisateur(received.split("\n")[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*******************************Connexion d'un utilisateur externe****************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
//*********************************************************************************************************
|
|
||||||
if (Type.equals("Connexion Externe")) {
|
|
||||||
Utilisateur nouveau = Utilisateur.stringToUtilisateur(received.split("\n")[1]);
|
|
||||||
app.getActifUsers().addList(nouveau);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
|
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.text.Text;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant l'interface graphique permettant de changer de pseudo
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class ChangementPseudo {
|
|
||||||
|
|
||||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
|
||||||
private ResourceBundle resources;
|
|
||||||
|
|
||||||
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
|
||||||
private URL location;
|
|
||||||
|
|
||||||
@FXML // fx:id="validationButton"
|
|
||||||
private Button validationButton; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="pseudonyme"
|
|
||||||
private TextField pseudonyme; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="pseudonyme1"
|
|
||||||
private Text pseudonyme1; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="MenuButton"
|
|
||||||
private Button MenuButton; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
/* Une instance de chatApp */
|
|
||||||
private ChatApp chatApp;
|
|
||||||
private int MaxLength=10;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
/**
|
|
||||||
* <p> Handler permettant de retourner au menu principal sur pression du MenuButton</p>
|
|
||||||
* @param event L'utilisateur vient d'appuyer sur le bouton Retour au menu
|
|
||||||
*/
|
|
||||||
void retourMenu(ActionEvent event) {
|
|
||||||
System.out.println("Retour au menu principal");
|
|
||||||
Stage stage = (Stage) MenuButton.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_Menu.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
/**
|
|
||||||
* <p> Handler permettant de lancer la verrification de l'unicite du ppseudo sur pression du validtionButton</p>
|
|
||||||
* @param event L'utilisateur vient d'appuyer sur le bouton Valider pseudo
|
|
||||||
*/
|
|
||||||
void validerPseudo(ActionEvent event) {
|
|
||||||
boolean pseudoOK = false;
|
|
||||||
if (pseudonyme.getText().length() > MaxLength) {
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Connexion");
|
|
||||||
// Header Text: null
|
|
||||||
alert.setHeaderText(null);
|
|
||||||
alert.setContentText("Echec de Connexion: le pseudo entre fait plus de " + MaxLength + " caracteres");
|
|
||||||
alert.showAndWait();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
pseudoOK = chatApp.modifierPseudo(pseudonyme.getText());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (pseudoOK) {
|
|
||||||
this.retourMenu(null);
|
|
||||||
} else {
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Changement pseudo");
|
|
||||||
// Header Text: null
|
|
||||||
alert.setHeaderText(null);
|
|
||||||
alert.setContentText("Echec de Connexion: le pseudo " + pseudonyme.getText() + " est deja pris");
|
|
||||||
alert.showAndWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Initialization de la classe ChangementPseudo et permet d'initialiser les parametres</p>
|
|
||||||
*/
|
|
||||||
@FXML // This method is called by the FXMLLoader when initialization is complete
|
|
||||||
void initialize() {
|
|
||||||
chatApp = ChatApp.getInstance();
|
|
||||||
pseudonyme1.setText(chatApp.getMe().getPseudo());
|
|
||||||
this.validationButton.setDefaultButton(true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,152 +0,0 @@
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import chatapp.Model.MessageHorodate;
|
|
||||||
import chatapp.Model.Utilisateur;
|
|
||||||
import chatapp.Protocol.SessionClavardage;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.Initializable;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.TextArea;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.text.Text;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant l'interface graphique permettant de clavarder avec un utilisateur.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class Clavardage implements Initializable, PropertyChangeListener {
|
|
||||||
@FXML //fx:id="plusButton"
|
|
||||||
public Button plusButton;
|
|
||||||
|
|
||||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
|
||||||
private ResourceBundle resources;
|
|
||||||
|
|
||||||
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
|
||||||
private URL location;
|
|
||||||
|
|
||||||
@FXML // fx:id="AEnvoyer"
|
|
||||||
private TextField AEnvoyer; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="EnvoyerButton"
|
|
||||||
private Button EnvoyerButton; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="pseudonyme1"
|
|
||||||
private Text pseudonyme1; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="ChatText"
|
|
||||||
private TextArea ChatText; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="MenuButton"
|
|
||||||
|
|
||||||
/* L'utilisateur destinataire */
|
|
||||||
private Utilisateur u2;
|
|
||||||
|
|
||||||
/* Une session de clavardage */
|
|
||||||
private SessionClavardage session;
|
|
||||||
|
|
||||||
/* Le nom de la table dans la BDD stockant l'historique des messages */
|
|
||||||
private String nomTable;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
/**
|
|
||||||
* <p>Handler gerant l'envoi du message contenu dans le TextField AEnvoyer et sur pression du bouton EnvoyerButton</p>
|
|
||||||
* @param event L'utilisateur vient d'appuyer sur le bouton Envoyer
|
|
||||||
*/
|
|
||||||
void envoyerMessage(ActionEvent event) {
|
|
||||||
String msg = AEnvoyer.getText();
|
|
||||||
AEnvoyer.clear();
|
|
||||||
if(!msg.equals("")) {
|
|
||||||
session.envoiMsg(msg);
|
|
||||||
Date d = new Date();
|
|
||||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:0");
|
|
||||||
msg = "Moi (" + format.format(d).toString() + ") : " + msg + "\n";
|
|
||||||
ChatText.appendText(msg);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter : Session
|
|
||||||
* @param session La session a associer a la classe
|
|
||||||
*/
|
|
||||||
public void setSession(SessionClavardage session) {
|
|
||||||
this.session = session;
|
|
||||||
this.session.addPropertyChangeListener(this);
|
|
||||||
this.u2=session.getU2();
|
|
||||||
this.pseudonyme1.setText(u2.getPseudo());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Handler des differents evenements auxquels s'est abonne le PropertyChangeListener
|
|
||||||
* <br> La classe est informee lorsque la session recoit un message ou lorsque la session se termine </p>
|
|
||||||
* @param evt L'evenement informe par le pcs
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
switch (evt.getPropertyName()){
|
|
||||||
case "MessageRecu" :
|
|
||||||
MessageHorodate msgh = session.getDernierMsg();
|
|
||||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:0");
|
|
||||||
Date d = new Date();
|
|
||||||
String msg = u2.getPseudo();
|
|
||||||
msg += " ("+ format.format(d).toString() +") ";
|
|
||||||
msg+=": "+msgh.getMessage();
|
|
||||||
ChatText.appendText(msg);
|
|
||||||
break;
|
|
||||||
case "FinDeLaSession" :
|
|
||||||
this.session.arretSession();
|
|
||||||
Platform.runLater(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Stage stage = (Stage) AEnvoyer.getScene().getWindow();
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter : Session
|
|
||||||
* @return La session de Clavardage
|
|
||||||
*/
|
|
||||||
public SessionClavardage getSession(){
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Permet d'initialiser les differents parametres de la classe
|
|
||||||
* @param location
|
|
||||||
* @param resources
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
|
||||||
EnvoyerButton.setDefaultButton(true);
|
|
||||||
this.ChatText.setEditable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Permet de recupérer plus de messages stoces dans la database en appuyant sur le bouton plusButton</p>
|
|
||||||
* @param actionEvent L'utilisateur a appuye sur le bouton plus pour obtenir tout l'utilisateur
|
|
||||||
*/
|
|
||||||
public void ajouterMessagesHistorique(ActionEvent actionEvent) {
|
|
||||||
this.nomTable = this.session.getApp().getDb().getNomTable(u2,this.session.getApp().getMe());
|
|
||||||
String historique = this.session.getApp().getDb().recupNMsg(session.getApp().getMe().getId(),this.u2.getId(), this.session.getApp().getDb().tailleBDD(nomTable));
|
|
||||||
ChatText.clear();
|
|
||||||
ChatText.insertText(0,historique);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,103 +0,0 @@
|
||||||
|
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.RadioButton;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant l'interface graphique permettant de se connecter.
|
|
||||||
* L'utilisateur rentre un pseudo et choisit une connexion distante ou locale.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class ConnexionScreen {
|
|
||||||
|
|
||||||
/* Bouton de connexion */
|
|
||||||
public Button connexionButton;
|
|
||||||
|
|
||||||
/* Zone de texte où inserer le pseudonyme souhaité */
|
|
||||||
public TextField pseudonyme;
|
|
||||||
|
|
||||||
/* RadioButton : l'utilisateur est distant */
|
|
||||||
public RadioButton remoteButton;
|
|
||||||
|
|
||||||
/* RadioButton : l'utilisateur est local */
|
|
||||||
public RadioButton localButton;
|
|
||||||
|
|
||||||
private int MaxLength = 10;
|
|
||||||
|
|
||||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
|
||||||
private ResourceBundle resources;
|
|
||||||
|
|
||||||
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
|
||||||
private URL location;
|
|
||||||
|
|
||||||
@FXML // This method is called by the FXMLLoader when initialization is complete
|
|
||||||
void initialize() {
|
|
||||||
connexionButton.setDefaultButton(true); // Appuyer sur entrée equivaut a cliquer sur le bouton de connexion
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Handler permettant de lancer la connexion avec le pseudonyme contenu dans le TextField pseudonyme en appuyant sur le connexionButton
|
|
||||||
* </p>
|
|
||||||
* @param actionEvent L'utilisateur vient d'appuyer sur le bouton connexion
|
|
||||||
*/
|
|
||||||
public void connexion(ActionEvent actionEvent) {
|
|
||||||
Boolean connexion = false;
|
|
||||||
if (this.localButton.isSelected()) {
|
|
||||||
// PARTIE CONNEXION LOCALE
|
|
||||||
ChatApp.getInstance().setExterne(false);
|
|
||||||
} else {
|
|
||||||
// PARTIE CONNEXION DISTANTE
|
|
||||||
ChatApp.getInstance().setExterne(true);
|
|
||||||
}
|
|
||||||
if (pseudonyme.getText().length() > MaxLength) {
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Connexion");
|
|
||||||
// Header Text: null
|
|
||||||
alert.setHeaderText(null);
|
|
||||||
alert.setContentText("Echec de Connexion: le pseudo entre fait plus de " + MaxLength + " caracteres");
|
|
||||||
alert.showAndWait();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
connexion = ChatApp.getInstance().connexion(pseudonyme.getText());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (!connexion) {
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Connexion");
|
|
||||||
// Header Text: null
|
|
||||||
alert.setHeaderText(null);
|
|
||||||
alert.setContentText("Echec de Connexion: le pseudo " + pseudonyme.getText() + " est deja pris");
|
|
||||||
alert.showAndWait();
|
|
||||||
} else {
|
|
||||||
Stage stage = (Stage) connexionButton.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_Menu.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
/**
|
|
||||||
* Sample Skeleton for 'View_Demarrer_Session.fxml' Controller Class
|
|
||||||
*/
|
|
||||||
|
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import chatapp.Model.ListUtilisateurs;
|
|
||||||
import chatapp.Model.Utilisateur;
|
|
||||||
import chatapp.Protocol.RunnerEcouteTCP;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant l'interface graphique permettant de choisir un utilisateur avec qui clavarder.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class DemarrerSession {
|
|
||||||
|
|
||||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
|
||||||
private ResourceBundle resources;
|
|
||||||
|
|
||||||
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
|
||||||
private URL location;
|
|
||||||
|
|
||||||
@FXML // fx:id="choixContact"
|
|
||||||
private ComboBox<String> choixContact; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
@FXML // fx:id="MenuButton"
|
|
||||||
private Button MenuButton; // Value injected by FXMLLoader
|
|
||||||
|
|
||||||
/* Instance de chatApp */
|
|
||||||
private ChatApp chatApp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Handler permettant de demarrer une session de clavardage avec le contact choisi dans la comboBox choixContaact</p>
|
|
||||||
* @param event L'utilisateur vient de selectionner un utilisateur
|
|
||||||
*/
|
|
||||||
@FXML
|
|
||||||
void demarrerSessionAvec(ActionEvent event) { chatApp.demarrerSession(choixContact.getValue()); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Handler permettant de retourner au menu principal sur pression du MenuButton</p>
|
|
||||||
* @param event L'utilisateur vient d'appuyer sur le bouton Retour au menu
|
|
||||||
*/
|
|
||||||
@FXML
|
|
||||||
void retourMenu(ActionEvent event) {
|
|
||||||
Stage stage = (Stage) MenuButton.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_Menu.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Initialization de la classe ChangementPseudo et permet d'initialiser les parametres</p>
|
|
||||||
*/
|
|
||||||
@FXML // This method is called by the FXMLLoader when initialization is complete
|
|
||||||
void initialize() {
|
|
||||||
this.chatApp = ChatApp.getInstance();
|
|
||||||
ArrayList<Utilisateur> Com = chatApp.createListeCommunicationPossible();
|
|
||||||
for(Utilisateur u : Com ){
|
|
||||||
choixContact.getItems().add(u.getPseudo());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
import chatapp.Protocol.SessionClavardage;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe permettant d'ouvrir une nouvelle fenetre afin de clavarder avec un utilisateur.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class FenetreSession extends Stage {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Permet l'ouverture de la fenetre associee a la session de clavardage</p>
|
|
||||||
* @param session Un objet FenetreSession est attribué avec un objet de type SessionClavardage
|
|
||||||
*/
|
|
||||||
public FenetreSession(SessionClavardage session) {
|
|
||||||
FXMLLoader fichier = new FXMLLoader(getClass().getResource("/fenetres/View_Clavardage.fxml"));
|
|
||||||
try{
|
|
||||||
Parent rootchat = fichier.load();
|
|
||||||
Clavardage controller = fichier.getController();
|
|
||||||
controller.setSession(session);
|
|
||||||
Scene scene1;
|
|
||||||
scene1 = new Scene(rootchat,600,400);
|
|
||||||
this.setScene(scene1);
|
|
||||||
this.setTitle("Session avec "+session.getU2().getPseudo());
|
|
||||||
this.setMinWidth(600);
|
|
||||||
this.setMinHeight(400);
|
|
||||||
this.show();
|
|
||||||
this.centerOnScreen();
|
|
||||||
this.setOnCloseRequest(we -> session.arretSession());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,134 +0,0 @@
|
||||||
@startuml
|
|
||||||
|
|
||||||
title __VIEW's Class Diagram__\n
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.ChangementPseudo {
|
|
||||||
- MenuButton : Button
|
|
||||||
- location : URL
|
|
||||||
- pseudonyme : TextField
|
|
||||||
- pseudonyme1 : Text
|
|
||||||
- resources : ResourceBundle
|
|
||||||
- validationButton : Button
|
|
||||||
~ initialize()
|
|
||||||
~ retourMenu()
|
|
||||||
~ validerPseudo()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.Clavardage {
|
|
||||||
+ plusButton : Button
|
|
||||||
- AEnvoyer : TextField
|
|
||||||
- ChatText : TextArea
|
|
||||||
- EnvoyerButton : Button
|
|
||||||
- location : URL
|
|
||||||
- nomTable : String
|
|
||||||
- pseudonyme1 : Text
|
|
||||||
- resources : ResourceBundle
|
|
||||||
+ ajouterMessagesHistorique()
|
|
||||||
+ getSession()
|
|
||||||
+ initialize()
|
|
||||||
+ propertyChange()
|
|
||||||
+ setSession()
|
|
||||||
~ envoyerMessage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.ConnexionScreen {
|
|
||||||
+ connexionButton : Button
|
|
||||||
+ localButton : RadioButton
|
|
||||||
+ pseudonyme : TextField
|
|
||||||
+ remoteButton : RadioButton
|
|
||||||
- location : URL
|
|
||||||
- resources : ResourceBundle
|
|
||||||
+ connexion()
|
|
||||||
~ initialize()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.DemarrerSession {
|
|
||||||
- MenuButton : Button
|
|
||||||
- choixContact : ComboBox<String>
|
|
||||||
- location : URL
|
|
||||||
- resources : ResourceBundle
|
|
||||||
~ demarrerSessionAvec()
|
|
||||||
~ initialize()
|
|
||||||
~ retourMenu()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.FenetreSession {
|
|
||||||
+ FenetreSession()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.View_Menu {
|
|
||||||
+ changerPseudoButton : MenuItem
|
|
||||||
+ demarrerSessionButton : MenuItem
|
|
||||||
+ pseudonyme : Text
|
|
||||||
+ utilsActifsButton : MenuItem
|
|
||||||
- location : URL
|
|
||||||
- resources : ResourceBundle
|
|
||||||
+ afficherUtilsActifs()
|
|
||||||
+ changerPseudo()
|
|
||||||
+ deconnexion()
|
|
||||||
+ demarrerSession()
|
|
||||||
~ initialize()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
namespace View {
|
|
||||||
class chatapp.View.View_Utilisateurs {
|
|
||||||
+ ListeUtilisateurs : TextArea
|
|
||||||
+ MenuButton : Button
|
|
||||||
- location : URL
|
|
||||||
- resources : ResourceBundle
|
|
||||||
+ retourMenu()
|
|
||||||
~ initialize()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
chatapp.View.ChangementPseudo o-- chatapp.Controller.ChatApp : chatApp
|
|
||||||
chatapp.View.Clavardage .up.|> java.beans.PropertyChangeListener
|
|
||||||
chatapp.View.Clavardage .up.|> javafx.fxml.Initializable
|
|
||||||
chatapp.View.Clavardage o-- chatapp.Protocol.SessionClavardage : session
|
|
||||||
chatapp.View.Clavardage o-- chatapp.Model.Utilisateur : u2
|
|
||||||
chatapp.View.DemarrerSession o-- chatapp.Controller.ChatApp : chatApp
|
|
||||||
chatapp.View.FenetreSession -up-|> javafx.stage.Stage
|
|
||||||
chatapp.View.View_Menu o-- chatapp.Controller.ChatApp : chatapp
|
|
||||||
|
|
||||||
|
|
||||||
right footer
|
|
||||||
|
|
||||||
|
|
||||||
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
|
|
||||||
For more information about this tool, please contact philippe.mesmeur@gmail.com
|
|
||||||
endfooter
|
|
||||||
|
|
||||||
@enduml
|
|
|
@ -1,118 +0,0 @@
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.MenuItem;
|
|
||||||
import javafx.scene.text.Text;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant la page d'accueil. Elle est composé d'un menu en haut a gauche.
|
|
||||||
* Au centre un petit message "Bienvenue" suivi du pseudo de l'utilisateur est affiché.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class View_Menu {
|
|
||||||
|
|
||||||
/* Le pseudo de l'utilisateur */
|
|
||||||
public Text pseudonyme;
|
|
||||||
|
|
||||||
/* Choix dans la bar de menu : Connaitre les utilisateurs actifs */
|
|
||||||
public MenuItem utilsActifsButton;
|
|
||||||
|
|
||||||
/* Choix dans la bar de menu : Demarrer une session de clavardage */
|
|
||||||
public MenuItem demarrerSessionButton;
|
|
||||||
|
|
||||||
/* Choix dans la bar de menu : Changer de pseudo */
|
|
||||||
public MenuItem changerPseudoButton;
|
|
||||||
|
|
||||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
|
||||||
private ResourceBundle resources;
|
|
||||||
|
|
||||||
/* Une instance de chatApp */
|
|
||||||
private ChatApp chatapp;
|
|
||||||
|
|
||||||
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
|
||||||
private URL location;
|
|
||||||
|
|
||||||
@FXML // This method is called by the FXMLLoader when initialization is complete
|
|
||||||
void initialize() {
|
|
||||||
this.chatapp = ChatApp.getInstance();
|
|
||||||
this.pseudonyme.setText(this.chatapp.getMe().getPseudo());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Handler permettant d'aller a la scene View_Utilisateurs pour afficher la liste des utilisateurs actifs</p>
|
|
||||||
* @param actionEvent L'utilisateur a choisit l'option afficher utilisateurs actifs dans le menu
|
|
||||||
*/
|
|
||||||
public void afficherUtilsActifs(ActionEvent actionEvent) {
|
|
||||||
Stage stage = (Stage) pseudonyme.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_Utilisateurs.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Handler permettant d'aller a la scene Demarrer_Session pour choisir un utilisateur avec qui clavarder
|
|
||||||
* @param actionEvent L'utilisateur a choisit l'option de demarrer une session de clavardage dans le menu
|
|
||||||
*/
|
|
||||||
public void demarrerSession(ActionEvent actionEvent) {
|
|
||||||
Stage stage = (Stage) pseudonyme.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_Demarrer_Session.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Handler permettant d'aller a la scene View_ChangementPseudo pour changer son pseudonyme
|
|
||||||
* @param actionEvent L'utilisateur a choisit l'option changer de pseudo
|
|
||||||
*/
|
|
||||||
public void changerPseudo(ActionEvent actionEvent) {
|
|
||||||
Stage stage = (Stage) pseudonyme.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_ChangementPseudo.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Handler permettant de se deconnecter et fermer l'application
|
|
||||||
* @param actionEvent L'utilisateur a choisit l'option Deconnexion dans le menu
|
|
||||||
*/
|
|
||||||
public void deconnexion(ActionEvent actionEvent) {
|
|
||||||
try {
|
|
||||||
chatapp.deconnexion();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
package chatapp.View;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
import chatapp.Controller.ChatApp;
|
|
||||||
import chatapp.Model.ListUtilisateurs;
|
|
||||||
import chatapp.Model.Utilisateur;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.TextArea;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Classe representant l'interface graphique permettant d'afficher les utilisateurs actifs
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class View_Utilisateurs {
|
|
||||||
|
|
||||||
/* La zone d'affichage des utilisateurs actifs */
|
|
||||||
public TextArea ListeUtilisateurs;
|
|
||||||
|
|
||||||
/* Bouton de retour au menu */
|
|
||||||
public Button MenuButton;
|
|
||||||
|
|
||||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
|
||||||
private ResourceBundle resources;
|
|
||||||
|
|
||||||
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
|
||||||
private URL location;
|
|
||||||
|
|
||||||
@FXML // This method is called by the FXMLLoader when initialization is complete
|
|
||||||
void initialize() {
|
|
||||||
ListUtilisateurs utilisateurs = ChatApp.getInstance().getActifUsers();
|
|
||||||
ListeUtilisateurs.setText("");
|
|
||||||
for(Utilisateur elem : utilisateurs.getActifUsers()) {
|
|
||||||
ListeUtilisateurs.appendText( " - " +elem.getPseudo() + '\n');
|
|
||||||
}
|
|
||||||
ListeUtilisateurs.setEditable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p> Handler permettant de retourner au menu principal sur pression du MenuButton</p>
|
|
||||||
* @param actionEvent L'utilisateur vient d'appuyer sur le bouton Retour au menu
|
|
||||||
*/
|
|
||||||
public void retourMenu(ActionEvent actionEvent) {
|
|
||||||
Stage stage = (Stage) MenuButton.getScene().getWindow();
|
|
||||||
Parent root = null;
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(getClass().getResource("/fenetres/View_Menu.fxml"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
Scene scene = new Scene(root);
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
@startuml
|
|
||||||
|
|
||||||
title __CHATAPP's Class Diagram__\n
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
class chatapp.Launcher {
|
|
||||||
{static} + main()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace chatapp {
|
|
||||||
class chatapp.Main {
|
|
||||||
{static} + main()
|
|
||||||
+ start()
|
|
||||||
+ stop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
chatapp.Main -up-|> javafx.application.Application
|
|
||||||
chatapp.Main o-- chatapp.Controller.ChatApp : chatapp
|
|
||||||
|
|
||||||
|
|
||||||
right footer
|
|
||||||
|
|
||||||
|
|
||||||
PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
|
|
||||||
For more information about this tool, please contact philippe.mesmeur@gmail.com
|
|
||||||
endfooter
|
|
||||||
|
|
||||||
@enduml
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: chatapp.Launcher
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.RadioButton?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.control.ToggleGroup?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.ConnexionScreen">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="ChatApp">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="598.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane alignment="CENTER" prefHeight="275.0" prefWidth="448.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="254.19998168945312" minHeight="10.0" prefHeight="111.80001831054688" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="69.39998168945314" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="33.60002441406249" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="27.400000000000034" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="79.39999999999998" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="3" />
|
|
||||||
<Button fx:id="connexionButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#connexion" prefHeight="38.0" prefWidth="453.0" style="-fx-background-color: #b0c926;" text="Connexion" textFill="#3299a8" GridPane.columnSpan="3" GridPane.rowIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="27.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<RadioButton fx:id="remoteButton" mnemonicParsing="false" selected="true" text="Connexion distante" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
|
||||||
<toggleGroup>
|
|
||||||
<ToggleGroup fx:id="lieu" />
|
|
||||||
</toggleGroup>
|
|
||||||
</RadioButton>
|
|
||||||
<RadioButton fx:id="localButton" mnemonicParsing="false" text="Connexion locale" toggleGroup="$lieu" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" prefHeight="0.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.ChangementPseudo">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Changement Pseudo">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane>
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Button fx:id="validationButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#validerPseudo" prefHeight="38.0" prefWidth="287.0" style="-fx-background-color: #b0c926;" text="Valider" textFill="#3299a8" GridPane.columnSpan="2" GridPane.rowIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="27.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Ancien :">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" onAction="#retourMenu" style="-fx-background-color: #b0c926;" text="Retour au menu" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="18.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,90 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.TextArea?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="chatapp.View.Clavardage">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="600.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Session de Clavardage">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="48.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
|
||||||
<children>
|
|
||||||
<GridPane prefHeight="282.0" prefWidth="402.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="44.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="228.0" vgrow="NEVER" />
|
|
||||||
<RowConstraints maxHeight="257.0" minHeight="10.0" prefHeight="42.0" vgrow="NEVER" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<GridPane GridPane.rowIndex="2">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="327.0" minWidth="10.0" prefWidth="327.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="156.0" minWidth="10.0" prefWidth="75.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints />
|
|
||||||
<RowConstraints maxHeight="79.0" minHeight="0.0" prefHeight="60.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="AEnvoyer" prefHeight="26.0" prefWidth="447.0" promptText="Enter Text" GridPane.rowIndex="1" />
|
|
||||||
<Button fx:id="EnvoyerButton" mnemonicParsing="false" onAction="#envoyerMessage" prefHeight="27.0" prefWidth="73.0" text="Envoyer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<GridPane prefHeight="34.0" prefWidth="345.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Chat avec : ">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" textAlignment="CENTER" wrappingWidth="133.16357421875" GridPane.columnIndex="1">
|
|
||||||
<font>
|
|
||||||
<Font size="19.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Button fx:id="plusButton" mnemonicParsing="false" onAction="#ajouterMessagesHistorique" style="-fx-background-color: #b0c926;" text="+" textAlignment="RIGHT" textFill="WHITE" GridPane.columnIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="OCR A Extended" size="16.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<TextArea fx:id="ChatText" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|