diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:38:54 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:38:54 +0000 |
commit | 0596b077bdb07db40ebb067cdcda749f14cf6a9c (patch) | |
tree | 114416a1c88cc05bb04288873b1ccdd4b2998f39 /pdf-over-gui/src/main/java/at/asit | |
parent | 2747a16945d5f89b9b029681a0d98393dd238c74 (diff) | |
download | pdf-over-0596b077bdb07db40ebb067cdcda749f14cf6a9c.tar.gz pdf-over-0596b077bdb07db40ebb067cdcda749f14cf6a9c.tar.bz2 pdf-over-0596b077bdb07db40ebb067cdcda749f14cf6a9c.zip |
Add CL argument to skip finish dialog
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@433 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
9 files changed, 122 insertions, 4 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java new file mode 100644 index 00000000..44e35f87 --- /dev/null +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.gui.cliarguments; + +import at.asit.pdfover.gui.exceptions.InitializationException; + +/** + * CLI Argument to set the BKU to use + */ +public class SkipFinishArgument extends Argument { + /** + * Constructor + */ + public SkipFinishArgument() { + super(new String[] { "-s" }, "argument.help.skipfinish"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.cliarguments.CLIArgument#handleArgument(java.lang + * .String[], int, at.asit.pdfover.gui.workflow.StateMachine, + * at.asit.pdfover.gui.cliarguments.ArgumentHandler) + */ + @Override + public int handleArgument(String[] args, int argOffset, + ArgumentHandler handler) + throws InitializationException { + getConfiguration().setSkipFinishOverlay(true); + return argOffset; + } +} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index a6f24c9e..5725bf6e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -196,6 +196,14 @@ public class OutputComposite extends StateComposite { this.signedDocument = signedDocument; } + /** + * Return whether the last save was successful + * @return whether the last save was successful + */ + public boolean getSaveSuccessful() { + return !this.saveFailed; + } + private void enableSaveButton(boolean doEnable) { this.btn_save.setEnabled(doEnable); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java index 3b50e5af..952116ec 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java @@ -73,6 +73,12 @@ public interface ConfigOverlayManipulator { public void setDefaultSignaturePositionOverlay(SignaturePosition position); /** + * Sets whether to skip the finish screen + * @param skipFinish whether to skip the finish screen + */ + public void setSkipFinishOverlay(boolean skipFinish); + + /** * Sets the configuration file * @param configurationFile */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index bfa5ce15..1adf39e4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -34,6 +34,13 @@ public interface ConfigProvider { */ public static final String SIGN_POS_REGEX = "(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?);p=(\\d))|(auto)|(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?))"; //$NON-NLS-1$ + + /** + * Loads the configuration from a configuration file + * @param configSource the configuration file + * @throws IOException + */ + public void loadConfiguration(InputStream configSource) throws IOException; /** * Gets the configuration file @@ -138,9 +145,8 @@ public interface ConfigProvider { public Point getMainWindowSize(); /** - * Loads the configuration from a configuration file - * @param configSource the configuration file - * @throws IOException + * Gets whether to skip the finish screen + * @return whether to skip the finish screen */ - public void loadConfiguration(InputStream configSource) throws IOException; + public boolean getSkipFinish(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index ac1ab7fa..3225c92d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -920,4 +920,20 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, public Point getMainWindowSize() { return this.configuration.getMainWindowSize(); } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getSkipFinish() + */ + @Override + public boolean getSkipFinish() { + return this.configurationOverlay.getSkipFinish(); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setSkipFinishOverlay(boolean) + */ + @Override + public void setSkipFinishOverlay(boolean skipFinish) { + this.configurationOverlay.setSkipFinish(skipFinish); + } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index faf6b9fb..383f5e9b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -218,4 +218,16 @@ public interface ConfigurationContainer { * @param size the main window size */ public void setMainWindowSize(Point size); + + /** + * Gets whether to skip the finish screen + * @return whether to skip the finish screen + */ + public boolean getSkipFinish(); + + /** + * Sets whether to skip the finish screen + * @param skipFinish whether to skip the finish screen + */ + public void setSkipFinish(boolean skipFinish); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java index 8088eaa9..d878f59e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java @@ -97,6 +97,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** Holds the default signature position */ protected SignaturePosition defaultSignaturePosition = null; + /** Whether to skip the output state */ + protected boolean skipFinish = false; + /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() */ @@ -399,4 +402,20 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { public void setMainWindowSize(Point size) { this.mainWindowSize = size; } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getSkipFinish() + */ + @Override + public boolean getSkipFinish() { + return this.skipFinish; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setSkipFinish(boolean) + */ + @Override + public void setSkipFinish(boolean skipFinish) { + this.skipFinish = skipFinish; + } } 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 967d255e..df9d1a39 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 @@ -67,6 +67,10 @@ public class OutputState extends State { // Save signed document this.outputComposite.saveDocument(); + + if (config.getSkipFinish() && this.outputComposite.getSaveSuccessful()) { + this.stateMachine.exit(); + } } return this.outputComposite; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index ae81ce7b..2107e50b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -40,6 +40,7 @@ import at.asit.pdfover.gui.cliarguments.PasswordArgument; import at.asit.pdfover.gui.cliarguments.PhoneNumberArgument; import at.asit.pdfover.gui.cliarguments.ProxyHostArgument; import at.asit.pdfover.gui.cliarguments.ProxyPortArgument; +import at.asit.pdfover.gui.cliarguments.SkipFinishArgument; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.exceptions.InitializationException; |