mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-11-25 10:34:15 +00:00
[CLIENT] Issue #9 : ajout d'un retour quand la connexion échoue suite à autre chose qu'une exception interne
This commit is contained in:
parent
1ba5025a2e
commit
b6f0db01a9
@ -50,7 +50,17 @@ public class FrameManager {
|
||||
}
|
||||
|
||||
private IStartupFrameModelListener getStartupFrameListener(){
|
||||
return () -> Platform.runLater(()->trySwitchScene(stage, mainFrameScene, true));
|
||||
return new IStartupFrameModelListener() {
|
||||
@Override
|
||||
public void onStartupValidated() {
|
||||
Platform.runLater(() -> trySwitchScene(stage, mainFrameScene, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartupFailed() {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,14 @@ public class StartupFrameController implements IStartupFrameModelListener {
|
||||
|
||||
@Override
|
||||
public void onStartupValidated() {
|
||||
view.clearErrorField();
|
||||
view.clearPasswordField();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartupFailed() {
|
||||
view.clearErrorField();
|
||||
view.displayError("Echec de la connexion");
|
||||
view.clearPasswordField();
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ public class StartupFrameModel {
|
||||
public void onStartupProcedureFinishedEvent(boolean success) {
|
||||
if(success)
|
||||
firerer.fireStartupValidated();
|
||||
|
||||
else
|
||||
firerer.fireStartupFailed();
|
||||
startupProcessBegan = false;
|
||||
}
|
||||
})
|
||||
|
@ -122,4 +122,8 @@ public class StartupFrameView implements IFXComponent{
|
||||
public void displayError(String errorMsg) {
|
||||
infoText.setText(errorMsg);
|
||||
}
|
||||
|
||||
public void clearErrorField() {
|
||||
infoText.setText("");
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.pqt.client.gui.frames.startup_frame.listeners.frame;
|
||||
|
||||
public interface IStartupFrameModelEventFirerer {
|
||||
void fireStartupValidated();
|
||||
void fireStartupFailed();
|
||||
|
||||
void addListener(IStartupFrameModelListener l);
|
||||
void removeListener(IStartupFrameModelListener l);
|
||||
|
@ -4,4 +4,5 @@ import java.util.EventListener;
|
||||
|
||||
public interface IStartupFrameModelListener extends EventListener {
|
||||
void onStartupValidated();
|
||||
void onStartupFailed();
|
||||
}
|
||||
|
@ -17,6 +17,12 @@ public class SimpleStartupFrameModelEventFirerer implements IStartupFrameModelEv
|
||||
.forEach(IStartupFrameModelListener::onStartupValidated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireStartupFailed() {
|
||||
Arrays.stream(listenerList.getListeners(IStartupFrameModelListener.class))
|
||||
.forEach(IStartupFrameModelListener::onStartupFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IStartupFrameModelListener l) {
|
||||
listenerList.add(IStartupFrameModelListener.class, l);
|
||||
|
Loading…
Reference in New Issue
Block a user