Merge flifloo into main
This commit is contained in:
parent
57501b7b93
commit
371a1bb0cb
8 changed files with 11 additions and 14 deletions
6
pom.xml
6
pom.xml
|
@ -60,12 +60,6 @@
|
|||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>src/test/</testSourceDirectory>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>resources</targetPath>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
|
@ -31,7 +31,7 @@ public class Client {
|
|||
protected boolean started = false;
|
||||
|
||||
|
||||
public Client(String address, int port, String username, String password) throws Exception {
|
||||
public Client(String address, int port, String username, String password) throws IOException {
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
this.username = username;
|
||||
|
|
|
@ -3,15 +3,17 @@ package fr.univ.lyon1.gui;
|
|||
import fr.univ.lyon1.client.Client;
|
||||
import fr.univ.lyon1.client.ClientReceive;
|
||||
import fr.univ.lyon1.common.Message;
|
||||
import fr.univ.lyon1.common.command.CommandType;
|
||||
import fr.univ.lyon1.gui.handlers.MainHandler;
|
||||
import fr.univ.lyon1.common.command.Command;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ClientGUI extends Client {
|
||||
private final MainHandler gui;
|
||||
|
||||
public ClientGUI(MainHandler handler, String address, int port) throws Exception {
|
||||
public ClientGUI(MainHandler handler, String address, int port) throws IOException {
|
||||
super(address, port, null, null);
|
||||
this.gui = handler;
|
||||
}
|
||||
|
@ -22,13 +24,16 @@ public class ClientGUI extends Client {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
public void run() throws IOException {
|
||||
if (started)
|
||||
return;
|
||||
|
||||
Thread clientReceiveThread = new Thread(new ClientReceive(this, super.socket));
|
||||
clientReceiveThread.start();
|
||||
|
||||
out.writeObject(new Command(CommandType.login, List.of("test", "test"))); // ToDo: Setup login
|
||||
out.flush();
|
||||
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class MainGui extends Application {
|
|||
public void start(Stage stage) {
|
||||
try {
|
||||
new MainHandler().launch(stage);
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
// Launch server configuration
|
||||
try {
|
||||
new ServerConfigurationHandler().launch(stage);
|
||||
|
|
|
@ -54,8 +54,6 @@ public class ConnectGuiController {
|
|||
Dialog.showErrorDialog("Erreur", "Impossible de sauvegarder les informations de connexion au serveur");
|
||||
this.connectButton.setDisable(false);
|
||||
System.out.println("Failed to save file, error: " + e.getMessage());
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("Connection not available");
|
||||
|
|
|
@ -5,5 +5,5 @@ import javafx.stage.Stage;
|
|||
import java.io.IOException;
|
||||
|
||||
public interface Handler {
|
||||
void launch(Stage stage) throws IOException, InterruptedException;
|
||||
void launch(Stage stage) throws IOException;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class MainHandler implements Handler {
|
|||
private ClientGUI client;
|
||||
|
||||
@Override
|
||||
public void launch(Stage stage) throws IOException, InterruptedException {
|
||||
public void launch(Stage stage) throws IOException {
|
||||
@NotNull
|
||||
final ServerConfiguration serverConfiguration = ServerConfiguration.load();
|
||||
this.client = new ClientGUI(this, serverConfiguration.getAddress(), serverConfiguration.getPort());
|
||||
|
|
Reference in a new issue