diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:14:22 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:14:22 +0000 |
commit | 55e3cf734656634a0469c9ba69f9a550fdae8dfc (patch) | |
tree | e1bed36556f01534a2eb7966b0f13725faa4c582 /pdf-over-gui/src | |
parent | 78fb5e06db37127898c1446102354b097a789f79 (diff) | |
download | pdf-over-55e3cf734656634a0469c9ba69f9a550fdae8dfc.tar.gz pdf-over-55e3cf734656634a0469c9ba69f9a550fdae8dfc.tar.bz2 pdf-over-55e3cf734656634a0469c9ba69f9a550fdae8dfc.zip |
+ 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
Diffstat (limited to 'pdf-over-gui/src')
5 files changed, 25 insertions, 8 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index 98d0d6c2..a4798c28 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -126,7 +126,8 @@ public class MainWindow { * @param ctrl */ public void setTopControl(Control ctrl) { - log.debug("Top control: " + ctrl.toString()); //$NON-NLS-1$ + if(ctrl != null) + log.debug("Top control: " + ctrl.toString()); //$NON-NLS-1$ this.stack.topControl = ctrl; this.doLayout(); } 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; } |