From 0596b077bdb07db40ebb067cdcda749f14cf6a9c Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:38:54 +0000 Subject: 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 --- .../gui/cliarguments/SkipFinishArgument.java | 46 ++++++++++++++++++++++ .../pdfover/gui/composites/OutputComposite.java | 8 ++++ .../workflow/config/ConfigOverlayManipulator.java | 6 +++ .../gui/workflow/config/ConfigProvider.java | 14 +++++-- .../gui/workflow/config/ConfigProviderImpl.java | 16 ++++++++ .../workflow/config/ConfigurationContainer.java | 12 ++++++ .../config/ConfigurationContainerImpl.java | 19 +++++++++ .../pdfover/gui/workflow/states/OutputState.java | 4 ++ .../workflow/states/PrepareConfigurationState.java | 1 + .../at/asit/pdfover/gui/messages.properties | 1 + .../at/asit/pdfover/gui/messages_de.properties | 1 + 11 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java (limited to 'pdf-over-gui/src/main') 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 @@ -72,6 +72,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; diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index 7557948f..6fa3f705 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -33,6 +33,7 @@ argument.help.output=Sets the output folder or file to use. Example: -o argument.help.password=Sets the password to use for mobile CCE. Example: -p argument.help.proxyhost=Sets the proxy host to use. Example: -proxy argument.help.proxyport=Sets the proxy port to use. Example: -proxyport +argument.help.skipfinish=Enables skipping of the "Finish" dialog (if successfully saved) argument.info.help=The following options are available: argument.invalid.bku=CCE argument invalid! Usage: argument.invalid.config=Configuration file argument invalid! Usage: diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index 15f8b9c8..f255a349 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -33,6 +33,7 @@ argument.help.output=W argument.help.password=Wählt das Passwort für die Handy-BKU. Bsp.: -p argument.help.proxyhost=Wählt den Proxy-Server. Bsp.: -proxy argument.help.proxyport=Wählt den Proxy-Server-Port. Bsp.: -proxyport +argument.help.skipfinish=Aktiviert das Überspringen des "Fertig"-Dialogs (falls Speichern erfolgreich) argument.info.help=Die folgenden Optionen sind verfügbar: argument.invalid.bku=BKU-Auswahl ungültig! Verwendung: argument.invalid.config=Konfigurationsdatei ungültig! Verwendung: -- cgit v1.2.3