From 55e3cf734656634a0469c9ba69f9a550fdae8dfc Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:14:22 +0000 Subject: + fixed Fixmes on error exit when users cancel document error dialog reset state machine to open status when users cancel an error in signing state reset state machine to BKU selection git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@215 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/workflow/states/BKUSelectionState.java | 6 ++++-- .../pdfover/gui/workflow/states/LocalBKUState.java | 3 ++- .../pdfover/gui/workflow/states/PositioningState.java | 18 +++++++++++++++--- .../gui/workflow/states/PrepareSigningState.java | 3 ++- 4 files changed, 23 insertions(+), 7 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java index b4507e08..797ce925 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java @@ -60,8 +60,10 @@ public class BKUSelectionState extends State { @Override public void run() { Status status = this.stateMachine.getStatus(); - if (!(status.getPreviousState() instanceof BKUSelectionState)) - { + if (!(status.getPreviousState() instanceof BKUSelectionState) && + !(status.getPreviousState() instanceof PositioningState)) { + status.setBKU(BKUs.NONE); + } else if((status.getPreviousState() instanceof PositioningState)) { ConfigProvider config = this.stateMachine.getConfigProvider(); status.setBKU(config.getDefaultBKU()); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java index 46daf8f7..163b17b3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java @@ -175,7 +175,8 @@ public class LocalBKUState extends State { Messages.getString("error.LocalBKU"), //$NON-NLS-1$ ERROR_BUTTONS.RETRY_CANCEL); if (dialog.open() != SWT.RETRY) { - this.stateMachine.exit(); + //this.stateMachine.exit(); + this.setNextState(new BKUSelectionState(this.stateMachine)); return; } this.threadException = null; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 449bb93d..17b1619c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -19,12 +19,15 @@ package at.asit.pdfover.gui.workflow.states; import java.io.IOException; import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.composites.PositioningComposite; +import at.asit.pdfover.gui.controls.ErrorDialog; +import at.asit.pdfover.gui.controls.ErrorDialog.ERROR_BUTTONS; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.signator.Emblem; @@ -94,9 +97,18 @@ public class PositioningState extends State { try { position = this.getPositioningComposite(); } catch (IOException e) { - // TODO Auto-generated catch block - // FIXME - e.printStackTrace(); + // FIXME + this.positionComposite = null; + log.error("Failed to display PDF document", e); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog( + this.stateMachine.getGUIProvider().getMainShell(), + e.getMessage(), ERROR_BUTTONS.RETRY_CANCEL); + if(dialog.open() == SWT.RETRY) { + this.stateMachine.update(); + } else { + this.setNextState(new OpenState(this.stateMachine)); + } + return; } this.stateMachine.getGUIProvider().display(position); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index d5f67f1e..4a097e8f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -166,7 +166,8 @@ public class PrepareSigningState extends State { this.stateMachine.update(); } else { // FIXME: exit? - this.stateMachine.exit(); + //this.stateMachine.exit(); + this.setNextState(new BKUSelectionState(this.stateMachine)); } return; } -- cgit v1.2.3