mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2025-07-19 00:09:25 +00:00
[VRAC] Corrections de bug #1/?
Bug détectés restants : - MainFrame pas mise à jour avec le compte utilisateur connecté lorsqu'on switch dessus depuis la StartFrame - Le serveur renvoie REFUSED_QUERY lorsqu'on tente de se déconnecter
This commit is contained in:
@ -58,9 +58,12 @@ public class Main extends Application{
|
||||
}
|
||||
|
||||
private IStartupFrameModelListener getStartupFrameListener(Stage primaryStage, Scene sceneToDisplay){
|
||||
return () -> trySwitchScene(primaryStage, sceneToDisplay, true);
|
||||
return () -> {
|
||||
Platform.runLater(()->trySwitchScene(primaryStage, sceneToDisplay, true));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private IMainFrameModelListener getMainFrameListener(Stage primaryStage, Scene sceneToDisplay){
|
||||
return () -> trySwitchScene(primaryStage, sceneToDisplay, false);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class StartupFrameController implements IStartupFrameModelListener {
|
||||
view.getAccountUsernameTextFieldContent(),
|
||||
view.getAccountPasswordTextFieldContent()
|
||||
);
|
||||
}catch(NullPointerException | IllegalArgumentException e){
|
||||
}catch(Exception e){
|
||||
view.displayError(GUIStringTool.getExceptionFormatter().render(e));
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.pqt.client.gui.startup_frame;
|
||||
|
||||
import com.pqt.client.gui.startup_frame.listeners.procedure.IStartupProcedureEventFirerer;
|
||||
import com.pqt.client.gui.startup_frame.listeners.procedure.IStartupProcedureListener;
|
||||
import com.pqt.client.gui.startup_frame.listeners.procedure.SimpleStartupProcedureEventFirerer;
|
||||
import com.pqt.client.module.account.AccountService;
|
||||
import com.pqt.client.module.account.listeners.AccountListenerAdapter;
|
||||
import com.pqt.client.module.account.listeners.IAccountListener;
|
||||
@ -22,6 +23,7 @@ class StartupProcedureHandler {
|
||||
StartupProcedureHandler(NetworkService networkService, AccountService accountService) {
|
||||
this.networkService = networkService;
|
||||
this.accountService = accountService;
|
||||
firerer = new SimpleStartupProcedureEventFirerer();
|
||||
}
|
||||
|
||||
StartupProcedureHandler init(String host, Integer port, String username, String password){
|
||||
@ -39,13 +41,13 @@ class StartupProcedureHandler {
|
||||
|
||||
private void testConnection(){
|
||||
networkService.addListener(getPingListener());
|
||||
networkService.setActiveServer(host, port);
|
||||
networkService.sendPQTPing(host, port);
|
||||
}
|
||||
|
||||
private void useRequestedServer(){
|
||||
//Server found
|
||||
firerer.fireServerFoundEvent(host, port);
|
||||
networkService.setActiveServer(host, port);
|
||||
accountService.addListener(getUpdateAccountListListener());
|
||||
accountService.refreshAccounts();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pqt.client.module.connection.senders;
|
||||
|
||||
import com.pqt.client.module.connection.listeners.IConnectionListener;
|
||||
import com.sun.javafx.binding.StringFormatter;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
@ -14,7 +15,10 @@ public class HttpTextSender implements ITextSender{
|
||||
@Override
|
||||
public void send(String url, String text, IConnectionListener listener) {
|
||||
try {
|
||||
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
|
||||
String trueURL = String.format("http://%s?message=%s", url, text);
|
||||
|
||||
|
||||
HttpURLConnection con = (HttpURLConnection) new URL(trueURL).openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
con.setRequestProperty("Content-Type", "application/json");
|
||||
con.setConnectTimeout(5000);
|
||||
|
@ -73,7 +73,9 @@ public class NetworkService {
|
||||
}
|
||||
|
||||
public void setActiveServer(String host, Integer port){
|
||||
connectionService.setServerUrl(String.format("%s:%s", host, port));
|
||||
//TODO changer le nom de context de la webapp
|
||||
String webAppContext = "pqt-server";
|
||||
connectionService.setServerUrl(String.format("%s:%s/%s", host, port, webAppContext));
|
||||
}
|
||||
|
||||
private void sendConfigRequest(String host, Integer port){
|
||||
|
Reference in New Issue
Block a user