diff options
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; |