From 59e3e4d43db93c9ec06e182fbf36cf08d3ff7cbc Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:25:22 +0000 Subject: Only save document once git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@310 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/workflow/states/OutputState.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index 01c1fa6b..c06d04de 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -26,6 +26,7 @@ import at.asit.pdfover.gui.composites.OutputComposite; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.utils.Messages; +import at.asit.pdfover.gui.workflow.ConfigProvider; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; @@ -48,15 +49,24 @@ public class OutputState extends State { this.outputComposite = this.stateMachine.getGUIProvider() .createComposite(OutputComposite.class, SWT.RESIZE, this); - File tmpDir = new File(this.stateMachine.getConfigProvider().getConfigurationDirectory() + "/tmp"); //$NON-NLS-1$ + ConfigProvider config = this.stateMachine.getConfigProvider(); + Status status = this.stateMachine.getStatus(); + + File tmpDir = new File(config.getConfigurationDirectory() + "/tmp"); //$NON-NLS-1$ if(!tmpDir.exists()) { tmpDir.mkdir(); } - this.outputComposite.setOutputDir(this.stateMachine.getConfigProvider().getDefaultOutputFolder()); + this.outputComposite.setOutputDir(config.getDefaultOutputFolder()); this.outputComposite.setTempDir(tmpDir.getAbsolutePath()); - this.outputComposite.setInputFile(this.stateMachine.getStatus().getDocument()); + this.outputComposite.setInputFile(status.getDocument()); + + this.outputComposite.setSignedDocument(status.getSignResult() + .getSignedDocument()); + + // Save signed document + this.outputComposite.saveDocument(); } return this.outputComposite; @@ -78,11 +88,6 @@ public class OutputState extends State { } OutputComposite outputComposite = this.getOutputComposite(); - outputComposite.setSignedDocument(status.getSignResult() - .getSignedDocument()); - - // Save signed document - outputComposite.saveDocument(); // Display dialog this.stateMachine.getGUIProvider().display(outputComposite); -- cgit v1.2.3