From 6d3b9d99b0e708d2516caf0f098c58c8a9585114 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:54:34 +0000 Subject: Mobile BKU first working (currently set to work with test mobile BKU from A-Trust git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@31 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/workflow/states/ErrorState.java | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java index e444fbf9..47485a0c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java @@ -37,8 +37,15 @@ public class ErrorState extends State { private Exception exception; - private boolean userInformed = false; + private State recoverState = null; + /** + * @param recoverState the recoverState to set + */ + public void setRecoverState(State recoverState) { + this.recoverState = recoverState; + } + /** * SLF4J Logger instance **/ @@ -62,22 +69,24 @@ public class ErrorState extends State { public void run() { Status status = this.stateMachine.getStatus(); - if(this.errorComposite != null) { - this.userInformed = this.errorComposite.isUserOk(); - } + ErrorComposite errorComposite = this.getComposite(); - if(this.exception != null && !this.userInformed) { + if(this.exception != null && !errorComposite.isUserOk()) { // Display Exception .... - ErrorComposite errorComposite = this.getComposite(); this.errorComposite.setException(this.exception); - this.userInformed = this.errorComposite.isUserOk(); - this.stateMachine.getGUIProvider().display(errorComposite); + return; } - // TODO: Think should we do this? (possible infinity loop with exception ...) - this.setNextState(status.getPreviousState()); + // User was informed! + if(this.recoverState != null) { + // see if we can recover! + this.setNextState(this.recoverState); + } else { + // we cannot recover exit! + this.stateMachine.exit(); + } } /* (non-Javadoc) -- cgit v1.2.3