summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:58:27 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:58:27 +0000
commit96a1a5c9d04238c63247794ad9c76e5a2001b8d0 (patch)
treec0b05f0378e84e53a73cdfb62612a7d3e6ecb40a
parentb8b015d3fa3b58cb5e70b4cd2ad1b8fe2a424af9 (diff)
downloadpdf-over-96a1a5c9d04238c63247794ad9c76e5a2001b8d0.tar.gz
pdf-over-96a1a5c9d04238c63247794ad9c76e5a2001b8d0.tar.bz2
pdf-over-96a1a5c9d04238c63247794ad9c76e5a2001b8d0.zip
Moved Mobile BKU URL to configuration file
Extracted localizable Strings git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@61 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
-rw-r--r--pdf-over-gui/PDFOver.config2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java29
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java50
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java80
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java47
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java28
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java45
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java12
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java13
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooLongException.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooShortException.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/messages.properties109
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java23
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java22
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java15
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java2
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java23
43 files changed, 486 insertions, 219 deletions
diff --git a/pdf-over-gui/PDFOver.config b/pdf-over-gui/PDFOver.config
index aa7a6cb7..e631560a 100644
--- a/pdf-over-gui/PDFOver.config
+++ b/pdf-over-gui/PDFOver.config
@@ -1,5 +1,5 @@
#Configuration file was generated!
-#Mon Sep 10 10:09:04 CEST 2012
+#Tue Sep 11 11:14:23 CEST 2012
OUTPUT_FOLDER=/home/andy/PDF
PROXY_PORT=-1
EMBLEM=/home/andy/fitzek_andreas_l.jpg
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
index 23b14d4c..82bfd2a0 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
@@ -42,6 +42,15 @@ public class DeveloperMain {
// Set PDF-AS log4j configuration:
//System.setProperty("log4j.configuration", "log4j.properties");
+ StringBuilder sb = new StringBuilder();
+
+ for(int i = 0; i < args.length; i++) {
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(args[i]);
+ }
+
+ log.debug("Executing arguments are: " + sb.toString()); //$NON-NLS-1$
+
StateMachineImpl stateMachine = new StateMachineImpl(args);
log.debug("Starting stateMachine ..."); //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
index 1637da75..43762b13 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
@@ -19,6 +19,8 @@ package at.asit.pdfover.gui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
+
/**
* Main entry point for production
*/
@@ -27,15 +29,18 @@ public class Main {
/**
* SFL4J Logger instance
**/
- @SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(Main.class);
/**
* @param args
*/
public static void main(String[] args) {
- // TODO Auto-generated method stub
+ StateMachineImpl stateMachine = new StateMachineImpl(args);
+ log.debug("Starting stateMachine ..."); //$NON-NLS-1$
+
+ stateMachine.start();
+ log.debug("Ended stateMachine ..."); //$NON-NLS-1$
}
}
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 8a9c217d..1086992b 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
@@ -21,7 +21,6 @@ import java.util.EnumMap;
import java.util.Map;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
@@ -59,7 +58,6 @@ public class MainWindow {
static final Logger log = LoggerFactory.getLogger(MainWindow.class);
private Shell shell;
- private CLabel lbl_status;
private Composite container;
private StackLayout stack;
StateMachine stateMachine;
@@ -117,18 +115,6 @@ public class MainWindow {
}
/**
- * Set current status (may be removed in production release)
- *
- * @param value
- */
- public void setStatus(String value) {
- if (this.getShell().isDisposed()) {
- return;
- }
- this.lbl_status.setText("[DEBUG]: Current workflow state: " + value); //$NON-NLS-1$
- }
-
- /**
* Sets top level composite for stack layout
*
* @param ctrl
@@ -252,8 +238,8 @@ public class MainWindow {
fd_btn_open.top = new FormAttachment(0);
fd_btn_open.left = new FormAttachment(0, 45);
this.btn_open.setLayoutData(fd_btn_open);
- this.btn_open.setText(Messages.getString("main.open")); //$NON-NLS-1$
- this.btn_open.setToolTipText(Messages.getString("main.open")); //$NON-NLS-1$
+ this.btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$
+ this.btn_open.setToolTipText(Messages.getString("common.open")); //$NON-NLS-1$
this.btn_open.addMouseListener(new MouseListener() {
@Override
@@ -327,22 +313,13 @@ public class MainWindow {
this.container = new Composite(getShell(), SWT.RESIZE);
FormData fd_composite_1 = new FormData();
- fd_composite_1.bottom = new FormAttachment(100, -25);
+ fd_composite_1.bottom = new FormAttachment(100, -5);
fd_composite_1.right = new FormAttachment(100, -5);
fd_composite_1.top = new FormAttachment(0, 50);
fd_composite_1.left = new FormAttachment(0, 5);
this.container.setLayoutData(fd_composite_1);
this.stack = new StackLayout();
this.container.setLayout(this.stack);
-
- this.lbl_status = new CLabel(getShell(), SWT.NONE);
- FormData fd_lblNewLabel = new FormData();
- fd_lblNewLabel.right = new FormAttachment(100, -5);
- fd_lblNewLabel.bottom = new FormAttachment(100, -5);
- fd_lblNewLabel.top = new FormAttachment(100, -20);
- fd_lblNewLabel.left = new FormAttachment(0, 5);
- this.lbl_status.setLayoutData(fd_lblNewLabel);
- this.lbl_status.setText("DEBUG LABEL!!"); //$NON-NLS-1$
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java
index f43b636c..badf37da 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java
@@ -39,71 +39,81 @@ public class ArgumentHandler {
.getLogger(ArgumentHandler.class);
private Map<String, CLIArgument> cliArguments = new HashMap<String, CLIArgument>();
-
+
private StateMachine stateMachine = null;
-
+
private boolean requiredExit = false;
-
+
/**
* Constructor
- * @param stateMachine
+ *
+ * @param stateMachine
*/
public ArgumentHandler(StateMachine stateMachine) {
this.stateMachine = stateMachine;
}
-
+
/**
* Gets available Arguments
+ *
* @return the list of available arguments
*/
public Set<CLIArgument> getArguments() {
return new HashSet<CLIArgument>(this.cliArguments.values());
}
-
+
/**
* Adds a CLIArgument to the handler
*
* @param arg
*/
public void addCLIArgument(CLIArgument arg) {
- if(arg == null) {
+ if (arg == null) {
return;
}
-
+
String[] commandOptions = arg.getCommandOptions();
-
- if(commandOptions == null) {
+
+ if (commandOptions == null) {
return;
}
-
- for(int i = 0; i < commandOptions.length; i++)
- {
+
+ for (int i = 0; i < commandOptions.length; i++) {
this.cliArguments.put(commandOptions[i], arg);
}
}
-
+
/**
* Handle CLI Arguments
*
* @param args
- * @throws InitializationException
+ * @throws InitializationException
*/
public void handleArguments(String[] args) throws InitializationException {
- for(int i = 0; i < args.length; i++) {
- if(this.cliArguments.containsKey(args[i])) {
- this.cliArguments.get(args[i]).handleArgument(args, i, this.stateMachine, this);
+
+ for (int i = 0; i < args.length; i++) {
+ if (this.cliArguments.containsKey(args[i])) {
+ i = this.cliArguments.get(args[i]).handleArgument(args, i,
+ this.stateMachine, this);
+ } else {
+ // Assume we got the document we want to sign
+ if (this.cliArguments.containsKey("-i")) { //$NON-NLS-1$
+ i = this.cliArguments.get("-i").handleArgument(args, i-1, //$NON-NLS-1$
+ this.stateMachine, this);
+ }
}
}
}
-
+
/**
* Set by an cli argument if it wants the program to exit
+ *
* @param requireExit
*/
public void setRequireExit(boolean requireExit) {
this.requiredExit = requireExit;
}
-
+
/**
* Checks if one argument required the program to exit again
*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java
index 5c039c83..3117780e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java
@@ -15,6 +15,7 @@
*/
package at.asit.pdfover.gui.cliarguments;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -29,7 +30,7 @@ public class BKUArgument extends CLIArgument {
*/
public BKUArgument() {
super(
- new String[] { "-b" }, "Select the BKU to use values are: LOCAL, MOBILE (example: -b <option>"); //$NON-NLS-1$
+ new String[] { "-b" }, Messages.getString("argument.help.bku")); //$NON-NLS-1$ //$NON-NLS-2$
}
/*
@@ -57,11 +58,11 @@ public class BKUArgument extends CLIArgument {
}
} catch (Exception ex) {
throw new InitializationException(
- "BKU Argument invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.bku") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "BKU Argument invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.bku") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
index d08ce7c6..417b85cb 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
@@ -19,10 +19,10 @@ package at.asit.pdfover.gui.cliarguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
-import at.asit.pdfover.gui.workflow.states.mobilebku.ATrustHelper;
/**
*
@@ -38,7 +38,7 @@ public class ConfigFileArgument extends CLIArgument {
* Constructor
*/
public ConfigFileArgument() {
- super(new String[] {"-c"}, "Defines which configuration file to use. Example: -c <config file>"); //$NON-NLS-1$
+ super(new String[] {"-c"}, Messages.getString("argument.help.config")); //$NON-NLS-1$ //$NON-NLS-2$
}
/* (non-Javadoc)
@@ -62,11 +62,11 @@ public class ConfigFileArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Configuration File Argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Configuration File Argument invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.config") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Configuration File invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.config") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java
index 1b7260c1..a89bef78 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java
@@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -34,7 +35,7 @@ public class EmblemArgument extends CLIArgument {
* Constructor
*/
public EmblemArgument() {
- super(new String[] {"-e"}, "Sets the emblem file to use for the signature. Example: -e <emblem file>"); //$NON-NLS-1$
+ super(new String[] {"-e"}, Messages.getString("argument.help.emblem")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -70,11 +71,11 @@ public class EmblemArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Emblem argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Emblem invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.emblem") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Emblem argument invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.emblem") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java
index 8087807c..bd015984 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java
@@ -19,6 +19,7 @@ package at.asit.pdfover.gui.cliarguments;
import java.util.Iterator;
import java.util.Set;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -31,7 +32,7 @@ public class HelpArgument extends CLIArgument {
* Constructor
*/
public HelpArgument() {
- super(new String[] {"-h", "-?" }, "shows this help message"); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-h", "-?" }, Messages.getString("argument.help.help")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/* (non-Javadoc)
@@ -45,7 +46,7 @@ public class HelpArgument extends CLIArgument {
Iterator<CLIArgument> argumentIterator = arguments.iterator();
- System.out.println("The following options are available"); //$NON-NLS-1$
+ System.out.println(Messages.getString("argument.info.help")); //$NON-NLS-1$
while(argumentIterator.hasNext()) {
CLIArgument agrument = argumentIterator.next();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java
new file mode 100644
index 00000000..9152a6fd
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+// Imports
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.gui.Messages;
+import at.asit.pdfover.gui.exceptions.InitializationException;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.Status;
+
+/**
+ *
+ */
+public class InputDocumentArgument extends CLIArgument {
+ /**
+ * Constructor
+ */
+ public InputDocumentArgument() {
+ super(new String[] {"-i"}, Messages.getString("argument.help.input")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(InputDocumentArgument.class);
+
+ /* (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,
+ StateMachine stateMachine, ArgumentHandler handler)
+ throws InitializationException {
+ try {
+ if (args.length > argOffset + 1) {
+
+ String signatureDocument = args[argOffset + 1];
+
+ File signatureDocumentFile = new File(signatureDocument);
+
+ if(!signatureDocumentFile.exists()) {
+ throw new FileNotFoundException(signatureDocument);
+ }
+
+ Status status = stateMachine.getStatus();
+ status.setDocument(signatureDocumentFile);
+
+ return argOffset + 1;
+ }
+ } catch (Exception ex) {
+ log.error("Document to sign argument invalid!", ex); //$NON-NLS-1$
+ throw new InitializationException(
+ Messages.getString("argument.invalid.input") + this.getHelpText(), ex); //$NON-NLS-1$
+ }
+
+ throw new InitializationException(
+ Messages.getString("argument.invalid.input") + this.getHelpText(), null); //$NON-NLS-1$
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java
index 5aea45bf..60ef8c59 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java
@@ -23,8 +23,8 @@ import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
-import at.asit.pdfover.gui.exceptions.InvalidPortException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -36,7 +36,7 @@ public class OutputFolderArgument extends CLIArgument {
* Constructor
*/
public OutputFolderArgument() {
- super(new String[] {"-o"}, "Sets the output folder to use. Example: -o <folder>"); //$NON-NLS-1$
+ super(new String[] {"-o"}, Messages.getString("argument.help.output")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -64,7 +64,7 @@ public class OutputFolderArgument extends CLIArgument {
}
if(!outputFolderDir.isDirectory()) {
- throw new IOException(outputFolderDir + " is not a directory");
+ throw new IOException(outputFolderDir + Messages.getString("argument.error.output")); //$NON-NLS-1$
}
ConfigManipulator configManipulator = stateMachine.getConfigManipulator();
@@ -76,11 +76,11 @@ public class OutputFolderArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Output folder argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Output folder argument invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.output") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Output folder argument invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.output") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java
index ab239c88..c30e6748 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java
@@ -19,6 +19,7 @@ package at.asit.pdfover.gui.cliarguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -32,7 +33,7 @@ public class PasswordArgument extends CLIArgument {
* Constructor
*/
public PasswordArgument() {
- super(new String[] {"-p"}, "Sets the password to use for mobile bku. Example: -p <password>"); //$NON-NLS-1$
+ super(new String[] {"-p"}, Messages.getString("argument.help.password")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -64,11 +65,11 @@ public class PasswordArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Mobile BKU password argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Mobile BKU password invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.password") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Mobile BKU password argument invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.password") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java
index 6d344c42..a9c14d18 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java
@@ -19,6 +19,7 @@ package at.asit.pdfover.gui.cliarguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -32,7 +33,7 @@ public class PhoneNumberArgument extends CLIArgument {
* Constructor
*/
public PhoneNumberArgument() {
- super(new String[] {"-n" }, "Sets the telephone number to use for mobile bku. Example: -n <number>"); //$NON-NLS-1$
+ super(new String[] {"-n" }, Messages.getString("argument.help.number")); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -67,11 +68,11 @@ public class PhoneNumberArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Phone Number Argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Phone Number Argument invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.number") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Phone Number invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.number") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java
index cb6ce596..da7945a6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java
@@ -16,12 +16,10 @@
package at.asit.pdfover.gui.cliarguments;
// Imports
-import java.io.File;
-import java.io.FileNotFoundException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -34,7 +32,7 @@ public class ProxyHostArgument extends CLIArgument {
* Constructor
*/
public ProxyHostArgument() {
- super(new String[] {"-proxy"}, "Sets the proxy host to use. Example: -proxy <hostname/IP>"); //$NON-NLS-1$
+ super(new String[] {"-proxy"}, Messages.getString("argument.help.proxyhost")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -64,11 +62,11 @@ public class ProxyHostArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Proxy host argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Proxy host invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.proxyhost") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Proxy host argument invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.proxyhost") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java
index aa0d5d81..51ef7554 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java
@@ -19,6 +19,7 @@ package at.asit.pdfover.gui.cliarguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.exceptions.InvalidPortException;
import at.asit.pdfover.gui.workflow.ConfigManipulator;
@@ -32,7 +33,7 @@ public class ProxyPortArgument extends CLIArgument {
* Constructor
*/
public ProxyPortArgument() {
- super(new String[] {"-proxyport"}, "Sets the proxy port to use. Example: -proxyport <port>"); //$NON-NLS-1$
+ super(new String[] {"-proxyport"}, Messages.getString("argument.help.proxyport")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -68,11 +69,11 @@ public class ProxyPortArgument extends CLIArgument {
} catch (Exception ex) {
log.error("Proxy port argument invalid!", ex); //$NON-NLS-1$
throw new InitializationException(
- "Proxy port argument invalid! Use: " + this.getHelpText(), ex);
+ Messages.getString("argument.invalid.proxyport") + this.getHelpText(), ex); //$NON-NLS-1$
}
throw new InitializationException(
- "Proxy port argument invalid! Use: " + this.getHelpText(), null);
+ Messages.getString("argument.invalid.proxyport") + this.getHelpText(), null); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
index 11f0914d..2c25bd61 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
@@ -21,6 +21,7 @@ import org.eclipse.swt.widgets.TabItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.ConfigurationContainer;
import at.asit.pdfover.gui.workflow.states.State;
@@ -50,6 +51,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
* @param parent
* @param style
* @param state
+ * @param container
*/
public AdvancedConfigurationComposite(Composite parent, int style,
State state, ConfigurationContainer container) {
@@ -65,7 +67,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
tabFolder.setLayoutData(fd_tabFolder);
TabItem simpleTabItem = new TabItem(tabFolder, SWT.NULL);
- simpleTabItem.setText("Simple");
+ simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$
this.simpleComposite = new SimpleConfigurationComposite(tabFolder,
SWT.NONE, state, container);
@@ -73,7 +75,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
simpleTabItem.setControl(this.simpleComposite);
TabItem advancedTabItem = new TabItem(tabFolder, SWT.NULL);
- advancedTabItem.setText("Advanced");
+ advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$
Composite advancedComposite = new Composite(tabFolder, SWT.NONE);
@@ -81,7 +83,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
advancedComposite.setLayout(new FormLayout());
Group grpSignaturPosition = new Group(advancedComposite, SWT.NONE);
- grpSignaturPosition.setText("Signatur Position");
+ grpSignaturPosition.setText(Messages.getString("advanced_config.AutoPosition_Title")); //$NON-NLS-1$
grpSignaturPosition.setLayout(new FormLayout());
FormData fd_grpSignaturPosition = new FormData();
fd_grpSignaturPosition.top = new FormAttachment(0, 5);
@@ -98,7 +100,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
fd_btnAutomatischePositionierung.left = new FormAttachment(0, 5);
this.btnAutomatischePositionierung
.setLayoutData(fd_btnAutomatischePositionierung);
- this.btnAutomatischePositionierung.setText("Automatische Positionierung");
+ this.btnAutomatischePositionierung.setText(Messages.getString("advanced_config.AutoPosition")); //$NON-NLS-1$
this.btnAutomatischePositionierung.addSelectionListener(new SelectionListener() {
@@ -115,7 +117,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
});
Group grpBkuAuswahl = new Group(advancedComposite, SWT.NONE);
- grpBkuAuswahl.setText("BKU Selection");
+ grpBkuAuswahl.setText(Messages.getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$
grpBkuAuswahl.setLayout(new FormLayout());
FormData fd_grpBkuAuswahl = new FormData();
fd_grpBkuAuswahl.top = new FormAttachment(33, 5);
@@ -134,9 +136,9 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
this.bkuStrings = new String[blen];
- // TODO: Implement translation into user language for ENUM Values!!
for (int i = 0; i < blen; i++) {
- this.bkuStrings[i] = BKUs.values()[i].toString();
+ String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$
+ this.bkuStrings[i] = Messages.getString(lookup);
}
this.cmbBKUAuswahl.setItems(this.bkuStrings);
@@ -161,7 +163,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
});
Group grpSpeicherort = new Group(advancedComposite, SWT.NONE);
- grpSpeicherort.setText("Outputfolder");
+ grpSpeicherort.setText(Messages.getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$
grpSpeicherort.setLayout(new FormLayout());
FormData fd_grpSpeicherort = new FormData();
fd_grpSpeicherort.top = new FormAttachment(66, 5);
@@ -175,7 +177,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
fd_lblDefaultOutputFolder.top = new FormAttachment(0, 5);
fd_lblDefaultOutputFolder.left = new FormAttachment(0, 5);
lblDefaultOutputFolder.setLayoutData(fd_lblDefaultOutputFolder);
- lblDefaultOutputFolder.setText("Default output folder:");
+ lblDefaultOutputFolder.setText(Messages.getString("advanced_config.OutputFolder")); //$NON-NLS-1$
this.txtOutputFolder = new Text(grpSpeicherort, SWT.BORDER);
FormData fd_text = new FormData();
@@ -203,7 +205,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
fd_btnBrowse.top = new FormAttachment(lblDefaultOutputFolder, 5);
fd_btnBrowse.right = new FormAttachment(100, -5);
btnBrowse.setLayoutData(fd_btnBrowse);
- btnBrowse.setText("browse");
+ btnBrowse.setText(Messages.getString("common.browse")); //$NON-NLS-1$
btnBrowse.addSelectionListener(new SelectionListener() {
@@ -218,10 +220,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
.getText());
// Change the title bar text
- dlg.setText("Select Output folder");
+ dlg.setText(Messages.getString("advanced_config.OutputFolder.Dialog_Title")); //$NON-NLS-1$
// Customizable message displayed in the dialog
- dlg.setMessage("Select a directory");
+ dlg.setMessage(Messages.getString("advanced_config.OutputFolder.Dialog")); //$NON-NLS-1$
// Calling open() will open and run the dialog.
// It will return the selected directory, or
@@ -247,8 +249,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
}
int getBKUElementIndex(BKUs bku) {
- // TODO: Translate to user language!
- String bkuName = bku.toString();
+ String lookup = "BKU." + bku.toString(); //$NON-NLS-1$
+ String bkuName = Messages.getString(lookup);
for(int i = 0; i < this.bkuStrings.length; i++) {
if(this.bkuStrings[i].equals(bkuName)) {
@@ -269,15 +271,28 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
void performBKUSelectionChanged(String selected) {
try {
- BKUs bkuvalue = BKUs.valueOf(selected);
+ BKUs bkuvalue = resolvBKU(selected);
this.performBKUSelectionChanged(bkuvalue);
} catch (Exception ex) {
log.error("Failed to parse BKU value: " + selected, ex); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Invalid BKU selection. Please check.", ex, false);
+ ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, Messages.getString("error.InvalidBKU"), ex, false); //$NON-NLS-1$
dialog.open();
}
}
+ BKUs resolvBKU(String localizedBKU) {
+ int blen = BKUs.values().length;
+
+ for (int i = 0; i < blen; i++) {
+ String lookup = "BKU." + BKUs.values()[i].toString(); //$NON-NLS-1$
+ if(Messages.getString(lookup).equals(localizedBKU)) {
+ return BKUs.values()[i];
+ }
+ }
+
+ return BKUs.NONE;
+ }
+
void performPositionSelection(boolean automatic) {
log.debug("Selected Position: " + automatic); //$NON-NLS-1$
this.configurationContainer.setAutomaticPosition(automatic);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java
index 19b3f46c..dc8640de 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java
@@ -29,6 +29,7 @@ import org.eclipse.swt.widgets.Composite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.BKUs;
@@ -110,7 +111,7 @@ public class BKUSelectionComposite extends StateComposite {
Button btn_mobile = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_mobile.setText("MOBILE");
+ btn_mobile.setText(Messages.getString("bku_selection.mobile")); //$NON-NLS-1$
//Point mobile_size = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT);
FormData fd_btn_mobile = new FormData();
//fd_btn_mobile.left = new FormAttachment(40, 0);
@@ -120,12 +121,12 @@ public class BKUSelectionComposite extends StateComposite {
btn_mobile.setLayoutData(fd_btn_mobile);
btn_mobile.addSelectionListener(new MobileSelectionListener());
- Image mobile = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/handy.gif")));
+ Image mobile = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/handy.gif"))); //$NON-NLS-1$
btn_mobile.setImage(mobile);
Button btn_card = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_card.setText("CARD");
+ btn_card.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$
//Point card_size = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT);
FormData fd_btn_card = new FormData();
fd_btn_card.left = new FormAttachment(50, 5);
@@ -135,7 +136,7 @@ public class BKUSelectionComposite extends StateComposite {
btn_card.setLayoutData(fd_btn_card);
btn_card.addSelectionListener(new LocalSelectionListener());
- Image karte = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/karte.gif")));
+ Image karte = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/karte.gif"))); //$NON-NLS-1$
btn_card.setImage(karte);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
index bb6d47a5..abd2edb0 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
@@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Control;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
@@ -72,7 +73,7 @@ public class ConfigurationComposite extends StateComposite {
ConfigurationComposite.this.style,
ConfigurationComposite.this.state,
ConfigurationComposite.this.configurationContainer);
- ConfigurationComposite.this.btnAdvanced.setText("Simple");
+ ConfigurationComposite.this.btnAdvanced.setText(Messages.getString("config.Simple")); //$NON-NLS-1$
} else {
// switch to simple
ConfigurationComposite.this.configComposite.dispose();
@@ -81,7 +82,7 @@ public class ConfigurationComposite extends StateComposite {
ConfigurationComposite.this.style,
ConfigurationComposite.this.state,
ConfigurationComposite.this.configurationContainer);
- ConfigurationComposite.this.btnAdvanced.setText("Advanced");
+ ConfigurationComposite.this.btnAdvanced.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$
}
ConfigurationComposite.this.configComposite.loadConfiguration();
@@ -247,14 +248,14 @@ public class ConfigurationComposite extends StateComposite {
}
}
});
- btnSpeichern.setText("Speichern");
+ btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$
Button btnAbbrechen = new Button(this, SWT.NONE);
FormData fd_btnAbrechen = new FormData();
fd_btnAbrechen.left = new FormAttachment(btnSpeichern, 10);
fd_btnAbrechen.bottom = new FormAttachment(100, -5);
btnAbbrechen.setLayoutData(fd_btnAbrechen);
- btnAbbrechen.setText("Abbrechen");
+ btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$
btnAbbrechen.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -268,7 +269,7 @@ public class ConfigurationComposite extends StateComposite {
fd_btnAdvanced.right = new FormAttachment(100, -5);
fd_btnAdvanced.bottom = new FormAttachment(100, -5);
this.btnAdvanced.setLayoutData(fd_btnAdvanced);
- this.btnAdvanced.setText("Advanced");
+ this.btnAdvanced.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$
this.btnAdvanced
.addSelectionListener(new ConfigurationModeSelectionListener());
@@ -308,7 +309,7 @@ public class ConfigurationComposite extends StateComposite {
ErrorDialog dialog = new ErrorDialog(
getShell(),
SWT.NONE,
- "Invalid settings are still present. Please check your input.",
+ Messages.getString("error.InvalidSettings"), //$NON-NLS-1$
e, false);
dialog.open();
return false;
@@ -325,7 +326,7 @@ public class ConfigurationComposite extends StateComposite {
} catch (IOException e) {
log.error("Failed to save configuration to file!", e); //$NON-NLS-1$
ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE,
- "Failed to save configuration file!", e, true);
+ Messages.getString("error.FailedToSaveSettings"), e, true); //$NON-NLS-1$
redo = dialog.open();
//return false;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
index 8146a02d..1784988a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
@@ -27,7 +27,6 @@ import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
@@ -44,6 +43,7 @@ import org.eclipse.swt.widgets.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.workflow.states.State;
/**
@@ -67,7 +67,9 @@ public class DataSourceSelectComposite extends StateComposite {
FileDialog dialog = new FileDialog(
DataSourceSelectComposite.this.getShell(), SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.pdf", "*" }); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.setFilterNames(new String[] { "PDF documents", "All files" });
+ dialog.setFilterNames(new String[] {
+ Messages.getString("common.PDFExtension_Description"), //$NON-NLS-1$
+ Messages.getString("common.ALLExtension_Description") }); //$NON-NLS-1$
String fileName = dialog.open();
File file = null;
if (fileName != null) {
@@ -148,7 +150,8 @@ public class DataSourceSelectComposite extends StateComposite {
// Only taking first file ...
File file = new File(files[0]);
if (!file.exists()) {
- log.error("File: " + files[0] + " does not exist!");
+ log.error(Messages.getString("common.file") + " " + files[0] + //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.getString("common.file_not_exists")); //$NON-NLS-1$
return;
}
DataSourceSelectComposite.this.setSelected(file);
@@ -201,15 +204,15 @@ public class DataSourceSelectComposite extends StateComposite {
this.fd_lbl_drag.right = new FormAttachment(100, -10);
this.fd_lbl_drag.top = new FormAttachment(0, 10);
// fd_lbl_drag.bottom = new FormAttachment(100, -10);
- lbl_drag.setLayoutData(fd_lbl_drag);
+ lbl_drag.setLayoutData(this.fd_lbl_drag);
FontData[] fD = lbl_drag.getFont().getFontData();
fD[0].setHeight(18);
lbl_drag.setFont(new Font(Display.getCurrent(), fD[0]));
- lbl_drag.setText("To sign a document\ndrag and drop it here\nor use the button below");
+ lbl_drag.setText(Messages.getString("dataSourceSelection.DropLabel")); //$NON-NLS-1$
lbl_drag.setAlignment(SWT.CENTER);
final Button btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE);
- btn_open.setText("Choose file ...");
+ btn_open.setText(Messages.getString("common.browse")); //$NON-NLS-1$
lbl_drag.addListener(SWT.Resize, new Listener() {
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
index 6552c3d5..befde87a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java
@@ -29,6 +29,7 @@ import org.eclipse.swt.widgets.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPasswordException;
import at.asit.pdfover.gui.workflow.states.State;
@@ -78,7 +79,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
} catch(InvalidNumberException ex) {
log.error("Validating input for Mobile BKU failed!", ex); //$NON-NLS-1$
MobileBKUEnterNumberComposite.this
- .setErrorMessage("Given phone number is invalid! Example: +43664123456789");
+ .setErrorMessage(Messages.getString("error.InvalidPhoneNumber")); //$NON-NLS-1$
} catch(InvalidPasswordException ex) {
log.error("Validating input for Mobile BKU failed!", ex); //$NON-NLS-1$
MobileBKUEnterNumberComposite.this
@@ -87,7 +88,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
catch (Exception ex) {
log.error("Validating input for Mobile BKU failed!", ex); //$NON-NLS-1$
MobileBKUEnterNumberComposite.this
- .setErrorMessage("Given phone number is invalid! Example: +43664123456789");
+ .setErrorMessage(Messages.getString("error.InvalidPhoneNumber")); //$NON-NLS-1$
return;
}
@@ -175,7 +176,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
this.txt_number.setEditable(true);
Label lbl_number = new Label(this, SWT.NATIVE);
- lbl_number.setText("Nummer:");
+ lbl_number.setText(Messages.getString("mobileBKU.number")); //$NON-NLS-1$
FormData fd_lbl_number = new FormData();
fd_lbl_number.top = new FormAttachment(30, -15);
fd_lbl_number.bottom = new FormAttachment(30, 15);
@@ -194,7 +195,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
this.txt_password.setEditable(true);
Label lbl_password = new Label(this, SWT.NATIVE);
- lbl_password.setText("Passwort:");
+ lbl_password.setText(Messages.getString("mobileBKU.password")); //$NON-NLS-1$
FormData fd_lbl_password = new FormData();
fd_lbl_password.top = new FormAttachment(50, -15);
fd_lbl_password.bottom = new FormAttachment(50, 15);
@@ -211,7 +212,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite {
this.lbl_error.setLayoutData(fd_lbl_error);
Button btn_ok = new Button(this, SWT.NATIVE);
- btn_ok.setText("Ok");
+ btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$
FormData fd_btn_ok = new FormData();
fd_btn_ok.top = new FormAttachment(87, 0);
fd_btn_ok.bottom = new FormAttachment(95, 0);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
index ff8d5c63..f19ee361 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
@@ -29,6 +29,7 @@ import org.eclipse.swt.widgets.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.workflow.states.State;
/**
@@ -52,12 +53,12 @@ public class MobileBKUEnterTANComposite extends StateComposite {
tan = tan.trim();
if(MobileBKUEnterTANComposite.this.vergleichswert.startsWith(tan)) {
- MobileBKUEnterTANComposite.this.setMessage("Sie haben den Vergleichswert eingegeben!");
+ MobileBKUEnterTANComposite.this.setMessage(Messages.getString("error.EnteredReferenceValue")); //$NON-NLS-1$
return;
}
if(tan.length() > 6) {
- MobileBKUEnterTANComposite.this.setMessage("Eingabe zu lange für TAN");
+ MobileBKUEnterTANComposite.this.setMessage(Messages.getString("error.TanTooLong")); //$NON-NLS-1$
return;
}
@@ -70,6 +71,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
/**
* SLF4J Logger instance
**/
+ @SuppressWarnings("unused")
private static final Logger log = LoggerFactory
.getLogger(MobileBKUEnterTANComposite.class);
@@ -84,10 +86,18 @@ public class MobileBKUEnterTANComposite extends StateComposite {
return this.userAck;
}
+ /**
+ * Set how many tries are left
+ * @param tries
+ */
public void setTries(int tries) {
- this.lbl_tries.setText(tries + " tries left!");
+ this.lbl_tries.setText(tries + Messages.getString("tanEnter.tries")); //$NON-NLS-1$
}
+ /**
+ * Sets the message
+ * @param msg
+ */
public void setMessage(String msg) {
this.lbl_tries.setText(msg);
}
@@ -123,7 +133,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
if(this.vergleichswert != null) {
this.lblvergleich.setText(this.vergleichswert);
} else {
- this.lblvergleich.setText("");
+ this.lblvergleich.setText(""); //$NON-NLS-1$
}
}
@@ -165,7 +175,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
fd_lblVergleichswert.top = new FormAttachment(30, -15);
fd_lblVergleichswert.bottom = new FormAttachment(30, 15);
lblVergleichswert.setLayoutData(fd_lblVergleichswert);
- lblVergleichswert.setText("Vergleichswert");
+ lblVergleichswert.setText(Messages.getString("tanEnter.ReferenceValue")); //$NON-NLS-1$
this.lblvergleich = new Label(this, SWT.NATIVE);
FormData fd_lblvergleich = new FormData();
@@ -174,7 +184,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
fd_lblvergleich.top = new FormAttachment(30, -15);
fd_lblvergleich.bottom = new FormAttachment(30, 15);
this.lblvergleich.setLayoutData(fd_lblvergleich);
- this.lblvergleich.setText("New Label"); //$NON-NLS-1$
+ this.lblvergleich.setText(""); //$NON-NLS-1$
Label lblTan = new Label(this, SWT.NATIVE);
FormData fd_lblTan = new FormData();
@@ -183,7 +193,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
fd_lblTan.top = new FormAttachment(50, -15);
fd_lblTan.bottom = new FormAttachment(50, 15);
lblTan.setLayoutData(fd_lblTan);
- lblTan.setText("TAN:");
+ lblTan.setText(Messages.getString("tanEnter.TAN")); //$NON-NLS-1$
this.txt_tan = new Text(this, SWT.BORDER | SWT.NATIVE);
FormData fd_text = new FormData();
@@ -204,13 +214,13 @@ public class MobileBKUEnterTANComposite extends StateComposite {
Button btn_ok = new Button(this, SWT.NATIVE);
FormData fd_btn_ok = new FormData();
- fd_btn_ok.left = new FormAttachment(15, 0);
+ //fd_btn_ok.left = new FormAttachment(95, 0);
fd_btn_ok.right = new FormAttachment(95, 0);
fd_btn_ok.top = new FormAttachment(85);
fd_btn_ok.bottom = new FormAttachment(95);
btn_ok.setLayoutData(fd_btn_ok);
- btn_ok.setText("Ok");
+ btn_ok.setText(Messages.getString("common.Ok")); //$NON-NLS-1$
btn_ok.addSelectionListener(new OkSelectionListener());
}
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 9cdabe23..84801702 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
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.FileDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.DocumentSource;
@@ -62,7 +63,7 @@ public class OutputComposite extends StateComposite {
try {
FileDialog save = new FileDialog(OutputComposite.this.getShell(), SWT.SAVE | SWT.NATIVE);
save.setFilterExtensions(new String[] {"*.pdf"}); //$NON-NLS-1$
- save.setFilterNames(new String[] {"PDF Dateien"});
+ save.setFilterNames(new String[] {Messages.getString("common.PDFExtension_Description")}); //$NON-NLS-1$
String target = save.open();
@@ -104,7 +105,9 @@ public class OutputComposite extends StateComposite {
File open = OutputComposite.this.savedFile;
if (open == null) {
// Save as temp file ...
- open = new File("tmp_signed.pdf");
+ java.util.Date date= new java.util.Date();
+ String fileName = String.format("%d_tmp_signed.pdf", date.getTime()); //$NON-NLS-1$
+ open = new File(fileName);
FileOutputStream outstream = new FileOutputStream(open);
outstream.write(source.getByteArray(), 0,
source.getByteArray().length);
@@ -118,7 +121,9 @@ public class OutputComposite extends StateComposite {
}
} else {
log.error("OutputComposite:OpenSelectionListener:widgetSelected -> source is null!!"); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to get signed document.", "", false);
+ ErrorDialog dialog = new ErrorDialog(getShell(),
+ SWT.NONE, Messages.getString("error.FailedToGetSignedDocument"),//$NON-NLS-1$
+ "", false); //$NON-NLS-1$
dialog.open();
}
} catch (Exception ex) {
@@ -147,7 +152,7 @@ public class OutputComposite extends StateComposite {
this.setLayout(new FormLayout());
Button btn_open = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_open.setText("OPEN");
+ btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$
// Point mobile_size = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT);
FormData fd_btn_open = new FormData();
//fd_btn_open.left = new FormAttachment(40, 0);
@@ -162,7 +167,7 @@ public class OutputComposite extends StateComposite {
}
Button btn_save = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_save.setText("SAVE");
+ btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$
// Point card_size = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT);
FormData fd_btn_save = new FormData();
fd_btn_save.left = new FormAttachment(50, 5);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
index 6bac14ec..f70ff85e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
@@ -27,8 +27,6 @@ import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -42,7 +40,6 @@ import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
@@ -54,6 +51,7 @@ import org.eclipse.swt.widgets.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.ErrorMarker;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
@@ -61,7 +59,6 @@ import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPortException;
import at.asit.pdfover.gui.workflow.ConfigurationContainer;
import at.asit.pdfover.gui.workflow.states.State;
-import org.eclipse.swt.layout.FillLayout;
/**
*
@@ -84,7 +81,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
FileDialog dialog = new FileDialog(
SimpleConfigurationComposite.this.getShell(), SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.jpg", "*.gif" }); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.setFilterNames(new String[] { "JPG Dateien", "Gif Dateien" });
+ dialog.setFilterNames(new String[] {
+ Messages.getString("common.JPGExtension_Description"), //$NON-NLS-1$
+ Messages.getString("common.GIFExtension_Description") }); //$NON-NLS-1$
String fileName = dialog.open();
File file = null;
if (fileName != null) {
@@ -206,7 +205,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.recalculateEmblemSize();
} catch (Exception e) {
this.lblEmblem
- .setText("No Image. Drag and Drop a Image. Or use the browse button to select an emblem.");
+ .setText(Messages.getString("simple_config.EmblemEmpty")); //$NON-NLS-1$
this.lblEmblem.setImage(null);
if (this.origEmblem != null) {
this.origEmblem.dispose();
@@ -226,7 +225,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
plainEmblemSetter(filename);
} catch (Exception ex) {
log.error("processEmblemChanged: ", ex); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to load the emblem", ex, false);
+ ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE,
+ Messages.getString("error.FailedToLoadEmblem"), ex, false); //$NON-NLS-1$
dialog.open();
}
}
@@ -248,7 +248,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
} catch (Exception ex) {
this.txtMobileNumberErrorMarker.setVisible(true);
this.txtMobileNumberErrorMarker
- .setToolTipText("Phone number is invalid! Please provide in the form: +43676123456789");
+ .setToolTipText(Messages.getString("error.InvalidPhoneNumber")); //$NON-NLS-1$
log.error("processNumberChanged: ", ex); //$NON-NLS-1$
}
}
@@ -349,14 +349,14 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
fd_grpHandySignatur.top = new FormAttachment(0, 5);
fd_grpHandySignatur.bottom = new FormAttachment(20, -5);
grpHandySignatur.setLayoutData(fd_grpHandySignatur);
- grpHandySignatur.setText("Handy Signatur");
+ grpHandySignatur.setText(Messages.getString("simple_config.MobileBKU_Title")); //$NON-NLS-1$
grpHandySignatur.setLayout(new GridLayout(2, false));
Label lblMobileNumber = new Label(grpHandySignatur, SWT.NONE
| SWT.RESIZE);
lblMobileNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
false, 1, 1));
- lblMobileNumber.setText("Handy Nummer:");
+ lblMobileNumber.setText(Messages.getString("simple_config.PhoneNumber")); //$NON-NLS-1$
Composite composite_2 = new Composite(grpHandySignatur, SWT.NONE);
composite_2.setLayout(new FormLayout());
@@ -392,7 +392,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
}
});
- this.txtMobileNumber.setMessage("+43676123456789");
+ this.txtMobileNumber.setMessage(Messages.getString("simple_config.ExampleNumber")); //$NON-NLS-1$
this.txtMobileNumber.addFocusListener(new FocusListener() {
@@ -415,7 +415,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
fd_grpBildmarke.top = new FormAttachment(20, 5);
grpBildmarke.setLayoutData(fd_grpBildmarke);
grpBildmarke.setLayout(new GridLayout(5, false));
- grpBildmarke.setText("Bildmarke");
+ grpBildmarke.setText(Messages.getString("simple_config.Emblem_Title")); //$NON-NLS-1$
new Label(grpBildmarke, SWT.NONE);
new Label(grpBildmarke, SWT.NONE);
@@ -424,7 +424,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
true, 3, 1));
this.lblEmblem.setAlignment(SWT.CENTER);
this.lblEmblem
- .setText("No Image. Drag and Drop a Image. Or use the browse button to select an emblem.");
+ .setText(Messages.getString("simple_config.EmblemEmpty")); //$NON-NLS-1$
this.lblEmblem.addListener(SWT.Resize, new Listener() {
@Override
@@ -499,7 +499,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
new Label(grpBildmarke, SWT.NONE);
this.btnUseImage = new Button(grpBildmarke, SWT.CHECK);
- this.btnUseImage.setText("Use Image");
+ this.btnUseImage.setText(Messages.getString("simple_config.UseEmblem")); //$NON-NLS-1$
this.btnUseImage.addSelectionListener(new SelectionListener() {
@Override
@@ -512,7 +512,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
SimpleConfigurationComposite.this.configurationContainer
.setEmblem(null);
} catch (InvalidEmblemFile e1) {
- log.error("THIS EXCEPTION IS IMPOSSIBLE! ", e1); //$NON-NLS-1$
+ // This exception should not occur!
+ log.error("Failed to load emblem", e1); //$NON-NLS-1$
}
}
}
@@ -528,7 +529,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
btnBrowseEmblem.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
false, false, 1, 1));
btnBrowseEmblem.addSelectionListener(new ImageFileBrowser());
- btnBrowseEmblem.setText("Browse");
+ btnBrowseEmblem.setText(Messages.getString("common.browse")); //$NON-NLS-1$
Group grpProxy = new Group(this, SWT.NONE);
FormData fd_grpProxy = new FormData();
@@ -537,7 +538,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
fd_grpProxy.left = new FormAttachment(0, 5);
fd_grpProxy.bottom = new FormAttachment(90, -5);
grpProxy.setLayoutData(fd_grpProxy);
- grpProxy.setText("Proxy");
+ grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$
grpProxy.setLayout(new GridLayout(2, false));
Label lblNewLabel = new Label(grpProxy, SWT.NONE);
@@ -546,7 +547,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
gd_lblNewLabel.widthHint = 66;
lblNewLabel.setLayoutData(gd_lblNewLabel);
lblNewLabel.setBounds(0, 0, 57, 15);
- lblNewLabel.setText("Host:");
+ lblNewLabel.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$
Composite composite = new Composite(grpProxy, SWT.NONE);
composite.setLayout(new FormLayout());
@@ -571,7 +572,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.proxyHostErrorMarker.setVisible(false);
this.txtProxyHost.setLayoutData(fd_txtProxyHost);
- this.txtProxyHost.setMessage("Hostname or IP of proxy server");
+ this.txtProxyHost.setMessage(Messages.getString("simple_config.ProxyHostTemplate")); //$NON-NLS-1$
this.txtProxyHost.addFocusListener(new FocusListener() {
@@ -598,7 +599,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
Label lblNewLabel_1 = new Label(grpProxy, SWT.NONE);
lblNewLabel_1.setBounds(0, 0, 57, 15);
- lblNewLabel_1.setText("Port:");
+ lblNewLabel_1.setText(Messages.getString("simple_config.ProxyPort")); //$NON-NLS-1$
Composite composite_1 = new Composite(grpProxy, SWT.NONE);
composite_1.setLayout(new FormLayout());
@@ -632,7 +633,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
.setLayoutData(this.fd_txtProxyPortErrorMarker);
this.txtProxyPortErrorMarker.setVisible(false);
- this.txtProxyPort.setMessage("port proxy server [1-65535]");
+ this.txtProxyPort.setMessage(Messages.getString("simple_config.ProxyPortTemplate")); //$NON-NLS-1$
this.txtProxyPort.addFocusListener(new FocusListener() {
@@ -728,7 +729,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.btnUseImage.setSelection(true);
} catch (Exception e1) {
log.error("Failed to load emblem: ", e1); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to load emblem.", e1, false);
+ ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, Messages.getString("error.FailedToLoadEmblem"), e1, false); //$NON-NLS-1$
dialog.open();
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
index c6f7c19a..017de3ef 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java
@@ -36,6 +36,8 @@ import org.eclipse.swt.widgets.Shell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
+
/**
*
*/
@@ -87,7 +89,7 @@ public class ErrorDialog extends Dialog {
private boolean canRetry = false;
- private boolean doRetry = false;
+ boolean doRetry = false;
private String details = null;
@@ -140,7 +142,7 @@ public class ErrorDialog extends Dialog {
fd_group.top = new FormAttachment(lblerrorMessage, 5);
fd_group.left = new FormAttachment(lblErrorImage, 5);
group.setLayoutData(fd_group);
- group.setText("Details");
+ group.setText(Messages.getString("error.Details")); //$NON-NLS-1$
if (!this.canRetry) {
@@ -175,7 +177,7 @@ public class ErrorDialog extends Dialog {
fd_btnOk.bottom = new FormAttachment(100, -5);
fd_btnOk.right = new FormAttachment(100, -5);
btnOk.setLayoutData(fd_btnOk);
- btnOk.setText("Ok");
+ btnOk.setText(Messages.getString("common.Ok")); //$NON-NLS-1$
} else {
Button btnCancel = new Button(shell, SWT.NONE);
Button btnRetry = new Button(shell, SWT.NONE);
@@ -218,13 +220,13 @@ public class ErrorDialog extends Dialog {
fd_btnCancel.bottom = new FormAttachment(100, -5);
fd_btnCancel.right = new FormAttachment(100, -5);
btnCancel.setLayoutData(fd_btnCancel);
- btnCancel.setText("Cancel");
+ btnCancel.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$
FormData fd_btnRetry = new FormData();
fd_btnRetry.bottom = new FormAttachment(100, -5);
fd_btnRetry.right = new FormAttachment(btnCancel, -10);
btnRetry.setLayoutData(fd_btnRetry);
- btnRetry.setText("Retry");
+ btnRetry.setText(Messages.getString("error.Retry")); //$NON-NLS-1$
}
shell.pack();
shell.open();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java
index 9ba8f66a..bcf853c0 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java
@@ -18,8 +18,7 @@ package at.asit.pdfover.gui.exceptions;
// Imports
import java.io.File;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
/**
*
@@ -29,25 +28,21 @@ public class InvalidEmblemFile extends Exception {
*
*/
private static final long serialVersionUID = -5826910929131650685L;
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(InvalidEmblemFile.class);
/**
* Constructor
* @param file
*/
public InvalidEmblemFile(final File file) {
- super("File: " + file.getAbsolutePath() + " is an invalid emblem file!");
+ super(file.getAbsolutePath() + Messages.getString("exception.InvalidEmblemFile")); //$NON-NLS-1$
}
/**
* Constructor
* @param file
+ * @param reason
*/
public InvalidEmblemFile(final File file, Throwable reason) {
- super("File: " + file.getAbsolutePath() + " is an invalid emblem file!", reason);
+ super(file.getAbsolutePath() + Messages.getString("exception.InvalidEmblemFile"), reason); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java
index 923a04a5..96240f86 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java
@@ -15,6 +15,8 @@
*/
package at.asit.pdfover.gui.exceptions;
+import at.asit.pdfover.gui.Messages;
+
/**
*
*/
@@ -30,6 +32,6 @@ public class InvalidPortException extends Exception {
* @param port
*/
public InvalidPortException(int port) {
- super("Port " + port + " is invalid has to be between 1 and " + 0xffff);
+ super(port + Messages.getString("exception.InvalidPort") + 0xffff); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooLongException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooLongException.java
index ac578664..6d870564 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooLongException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooLongException.java
@@ -15,6 +15,8 @@
*/
package at.asit.pdfover.gui.exceptions;
+import at.asit.pdfover.gui.Messages;
+
// Imports
/**
@@ -26,7 +28,7 @@ public class PasswordTooLongException extends InvalidPasswordException {
* Constructor
*/
public PasswordTooLongException() {
- super("Given password is too long!");
+ super(Messages.getString("exception.PasswordTooLong")); //$NON-NLS-1$
}
/**
*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooShortException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooShortException.java
index 0e6a98f7..1376dfbb 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooShortException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/PasswordTooShortException.java
@@ -15,6 +15,8 @@
*/
package at.asit.pdfover.gui.exceptions;
+import at.asit.pdfover.gui.Messages;
+
// Imports
/**
@@ -30,7 +32,7 @@ public class PasswordTooShortException extends InvalidPasswordException {
* Constructor
*/
public PasswordTooShortException() {
- super("Given password is too short!");
+ super(Messages.getString("exception.PasswordTooShort")); //$NON-NLS-1$
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/messages.properties
index 3726b7c9..244cfb3d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/messages.properties
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/messages.properties
@@ -2,7 +2,112 @@ TrustedSocketFactory.FailedToCreateSecureConnection=Failed to create secure netw
main.title=PDF-Over
main.configuration=Configuration
-main.open=Open
main.position=Positioning
main.signature=Signing
-main.done=Finish \ No newline at end of file
+main.done=Finish
+
+common.browse=browse
+common.Cancel=Cancel
+common.Ok=OK
+common.Save=Save
+common.PDFExtension_Description=PDF documents
+common.JPGExtension_Description=JPG Dateien
+common.GIFExtension_Description=Gif Dateien
+common.ALLExtension_Description=All files
+common.file=File:
+common.file_not_exists= does not exist!
+common.open=Open
+
+config.Simple=Simple
+config.Advanced=Advanced
+
+advanced_config.AutoPosition_Title=Positioning
+advanced_config.AutoPosition=Automatic positioning
+advanced_config.BKUSelection_Title=BKU Selection
+advanced_config.OutputFolder_Title=Output location
+advanced_config.OutputFolder=Default output folder:
+advanced_config.OutputFolder.Dialog_Title=Select Output folder
+advanced_config.OutputFolder.Dialog=Select a folder
+
+simple_config.Emblem_Title=Emblem
+simple_config.EmblemEmpty=No Image. Drag and Drop a Image. Or use the browse button to select an emblem.
+simple_config.UseEmblem=Use emblem
+simple_config.MobileBKU_Title=Mobile signature
+simple_config.PhoneNumber=Mobile number:
+simple_config.ExampleNumber=+43676123456789
+simple_config.Proxy_Title=Proxy
+simple_config.ProxyHost=Host:
+simple_config.ProxyHostTemplate=Hostname or IP of proxy server
+simple_config.ProxyPort=Port:
+simple_config.ProxyPortTemplate=port proxy server [1-65535]
+
+
+
+dataSourceSelection.DropLabel=To sign a document\ndrag and drop it here\nor use the button below
+
+bku_selection.card=CARD
+bku_selection.mobile=MOBILE
+
+mobileBKU.number=Number:
+mobileBKU.password=Password:
+
+tanEnter.tries= tries left!"
+tanEnter.ReferenceValue=reference value
+tanEnter.TAN=TAN:
+
+BKU.LOCAL=Local BKU
+BKU.MOBILE=Mobile BKU
+BKU.NONE=no default
+
+error.SaveOutputFolder=Failed to save signed document to configured output folder.
+error.Signatur=Signature error
+error.PrepareDocument=Failed to prepare document for signature.
+error.Initialization=Initialization failed. Please check your configuration.
+error.Unexpected=Unexpected Error
+error.LocalBKU=Please check if a local BKU is running
+error.Details=Details
+error.Retry=Retry
+error.InvalidBKU=Invalid BKU selection. Please check.
+error.InvalidSettings=Invalid settings are still present. Please check your input.
+error.FailedToSaveSettings=Failed to save configuration file!
+error.InvalidPhoneNumber=Given phone number is invalid! Example: +43664123456789
+error.EnteredReferenceValue=You entered the reference value!
+error.TanTooLong=Entered TAN too long
+error.FailedToGetSignedDocument=Failed to get signed document.
+error.FailedToLoadEmblem=Failed to load the emblem
+
+exception.InvalidEmblemFile= is an invalid emblem file!
+exception.InvalidPort= is invalid has to be between 1 and
+exception.PasswordTooLong=Given password is too long!
+exception.PasswordTooShort=Given password is too short!
+
+argument.help.bku=Select the BKU to use values are: LOCAL, MOBILE (example: -b <option>
+argument.invalid.bku=BKU Argument invalid! Use:
+
+argument.help.config=Defines which configuration file to use. Example: -c <config file>
+argument.invalid.config=Configuration File Argument invalid! Use:
+
+argument.help.emblem=Sets the emblem file to use for the signature. Example: -e <emblem file>
+argument.invalid.emblem=Emblem argument invalid! Use:
+
+argument.help.help=shows this help message
+argument.info.help=The following options are available:
+
+argument.help.input=Sets the document to sign. Example: -i <input document>
+argument.invalid.input=Document to sign argument invalid! Use:
+
+argument.help.output=Sets the output folder to use. Example: -o <folder>
+argument.invalid.output=Output folder argument invalid! Use:
+argument.error.output= is not a directory
+
+argument.help.password=Sets the password to use for mobile bku. Example: -p <password>
+argument.invalid.password=Mobile BKU password invalid! Use:
+
+argument.help.number=Sets the telephone number to use for mobile bku. Example: -n <number>
+argument.invalid.number=Phone Number Argument invalid! Use:
+
+argument.help.proxyhost=Sets the proxy host to use. Example: -proxy <hostname/IP>
+argument.invalid.proxyhost=Proxy host argument invalid! Use:
+
+argument.help.proxyport=Sets the proxy port to use. Example: -proxyport <port>
+argument.invalid.proxyport=Proxy port argument invalid! Use: \ No newline at end of file
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java
index a669803b..b2f0f7a0 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java
@@ -53,6 +53,11 @@ public interface ConfigManipulator {
public static final String MOBILE_NUMBER_CONFIG = "MOBILE_NUMBER"; //$NON-NLS-1$
/**
+ * Mobile bku url config parameter
+ */
+ public static final String MOBILE_BKU_URL_CONFIG = "MOBILE_BKU_URL"; //$NON-NLS-1$
+
+ /**
* The emblem config parameter
*/
public static final String EMBLEM_CONFIG = "EMBLEM"; //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
index 4850a313..7d41a080 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
@@ -86,6 +86,12 @@ public interface ConfigProvider {
public String getDefaultOutputFolder();
/**
+ * Gets the mobile BKU URL
+ * @return the mobile BKU URL
+ */
+ public String getMobileBKUURL();
+
+ /**
* Loads the current configuration to the current configuration file
* @param configSource
* @throws IOException
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
index 529f9d5c..ea4088c6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
@@ -42,6 +42,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
private BKUs defaultBKU = BKUs.NONE;
+ /**
+ * Gets the Default Mobile URL
+ */
+ public static final String DEFAULT_MOBILE_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
+
+
private SignaturePosition defaultSignaturePosition = null;
/**
@@ -60,6 +66,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
private String configurationFile = ConfigManipulator.DEFAULT_CONFIG_FILE;
private int proxyPort = -1;
+
+ private String mobileBKU = DEFAULT_MOBILE_URL;
private String outputFolder = STRING_EMPTY;
@@ -344,6 +352,13 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
this.setDefaultOutputFolder(config
.getProperty(ConfigManipulator.OUTPUT_FOLDER_CONFIG));
+ String bku = config
+ .getProperty(ConfigManipulator.MOBILE_BKU_URL_CONFIG);
+
+ if(bku != null && !bku.equals("")) { //$NON-NLS-1$
+ this.mobileBKU = bku;
+ }
+
// Set Proxy Port
String proxyPortString = config
.getProperty(ConfigManipulator.PROXY_PORT_CONFIG);
@@ -433,4 +448,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
this.setDefaultSignaturePosition(position);
}
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigProvider#getMobileBKUURL()
+ */
+ @Override
+ public String getMobileBKUURL() {
+ return this.mobileBKU;
+ }
+
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
index 44ffd7f4..824611b5 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
@@ -26,6 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
import at.asit.pdfover.gui.workflow.states.State;
@@ -87,7 +88,7 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
} catch (Exception e) {
log.error("StateMachine update: ", e); //$NON-NLS-1$
ErrorDialog errorState = new ErrorDialog(this.getMainShell(),
- SWT.NONE, "Unexpected Error", e, false);
+ SWT.NONE, Messages.getString("error.Unexpected"), e, false); //$NON-NLS-1$
//errorState.setException(e);
//jumpToState(errorState);
errorState.open();
@@ -125,14 +126,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
this.status.setCurrentState(next);
}
}
-
- // TODO: Remove following line when releasing ...
- if (this.status.getCurrentState() != null) {
- this.setCurrentStateMessage(this.status.getCurrentState()
- .toString());
- } else {
- this.setCurrentStateMessage(""); //$NON-NLS-1$
- }
}
/**
@@ -159,17 +152,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
private MainWindow mainWindow = null;
- /**
- * Helper method for developing
- *
- * @param value
- */
- public void setCurrentStateMessage(String value) {
- if (this.mainWindow != null) {
- this.mainWindow.setStatus(value);
- }
- }
-
/*
* (non-Javadoc)
*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java
index 52dfb5c9..333b82d5 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java
@@ -21,7 +21,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindowBehavior;
-import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.composites.ConfigurationComposite;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
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 58e957b9..0c8c7047 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
@@ -21,12 +21,12 @@ import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
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.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
@@ -54,7 +54,7 @@ public class LocalBKUState extends State {
public final static String BKU_REPSONE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; //$NON-NLS-1$
/**
- * TODO: move to a better location ...
+ * PDF Over User Agent string
*/
public static final String PDF_OVER_USER_AGENT_STRING = "PDF-Over 4.0"; //$NON-NLS-1$
@@ -171,7 +171,7 @@ public class LocalBKUState extends State {
if (this.threadException != null) {
ErrorDialog dialog = new ErrorDialog(
this.stateMachine.getGUIProvider().getMainShell(), SWT.NONE,
- "Please check if a local BKU is running",
+ Messages.getString("error.LocalBKU"), //$NON-NLS-1$
this.threadException, true);
if (!dialog.open()) {
this.stateMachine.exit();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
index ed6d675f..f63ecf03 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.MainWindowBehavior;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.composites.MobileBKUEnterNumberComposite;
import at.asit.pdfover.gui.composites.MobileBKUEnterTANComposite;
import at.asit.pdfover.gui.composites.WaitingComposite;
@@ -151,7 +152,7 @@ public class MobileBKUState extends State {
if (this.threadException != null) {
ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(),
SWT.NONE,
- "Unexpected Error", this.threadException, false);
+ Messages.getString("error.Unexpected"), this.threadException, false); //$NON-NLS-1$
//error.setException(this.threadException);
//this.setNextState(error);
error.open();
@@ -164,7 +165,7 @@ public class MobileBKUState extends State {
this.stateMachine.getGUIProvider().display(
this.getWaitingComposite());
Thread postSLRequestThread = new Thread(new PostSLRequestThread(
- this));
+ this, this.stateMachine.getConfigProvider().getMobileBKUURL()));
postSLRequestThread.start();
break;
case POST_NUMBER:
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 5a42d3cc..f42473a9 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 org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.MainWindowBehavior;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.composites.OutputComposite;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.StateMachine;
@@ -47,7 +48,6 @@ public class OutputState extends State {
/**
* SFL4J Logger instance
**/
- @SuppressWarnings("unused")
private static final Logger log = LoggerFactory
.getLogger(OutputState.class);
@@ -89,7 +89,8 @@ public class OutputState extends State {
output.close();
} catch (IOException e) {
log.error("Failed to save signed document to configured output folder.", e); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(outputComposite.getShell(), SWT.NONE, "Failed to save signed document to configured output folder.", e, false);
+ ErrorDialog dialog = new ErrorDialog(outputComposite.getShell(), SWT.NONE,
+ Messages.getString("error.SaveOutputFolder"), e, false); //$NON-NLS-1$
dialog.open();
}
}
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 f720cb57..6957f85c 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
@@ -25,11 +25,13 @@ import org.eclipse.swt.SWT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.cliarguments.ArgumentHandler;
import at.asit.pdfover.gui.cliarguments.BKUArgument;
import at.asit.pdfover.gui.cliarguments.ConfigFileArgument;
import at.asit.pdfover.gui.cliarguments.EmblemArgument;
import at.asit.pdfover.gui.cliarguments.HelpArgument;
+import at.asit.pdfover.gui.cliarguments.InputDocumentArgument;
import at.asit.pdfover.gui.cliarguments.OutputFolderArgument;
import at.asit.pdfover.gui.cliarguments.PasswordArgument;
import at.asit.pdfover.gui.cliarguments.PhoneNumberArgument;
@@ -63,9 +65,11 @@ public class PrepareConfigurationState extends State {
this.handler.addCLIArgument(new ProxyHostArgument());
this.handler.addCLIArgument(new ProxyPortArgument());
this.handler.addCLIArgument(new OutputFolderArgument());
+ this.handler.addCLIArgument(new InputDocumentArgument());
// adding config file argument to this handler so it appears in help
this.handler.addCLIArgument(new ConfigFileArgument());
-
+
+
this.configFilehandler = new ArgumentHandler(this.stateMachine);
this.configFilehandler.addCLIArgument(new ConfigFileArgument());
}
@@ -155,7 +159,7 @@ public class PrepareConfigurationState extends State {
} catch (InitializationException e) {
log.error("Failed to initialize: ", e); //$NON-NLS-1$
ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(),
- SWT.NONE, "Initialization failed. Please check your configuration.",
+ SWT.NONE, Messages.getString("error.Initialization"), //$NON-NLS-1$
e, false);
//error.setException(e);
//this.setNextState(error);
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 38215593..7d8b5987 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
@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.MainWindowBehavior;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.composites.WaitingComposite;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.ConfigProvider;
@@ -153,7 +154,7 @@ public class PrepareSigningState extends State {
if(this.threadException != null) {
ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(),
- SWT.NONE, "Failed to prepare document for signature.", this.threadException,
+ SWT.NONE, Messages.getString("error.PrepareDocument"), this.threadException, //$NON-NLS-1$
true);
this.threadException = null;
if(error.open()) {
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
index 37877f12..6079893b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -20,6 +20,7 @@ import org.eclipse.swt.SWT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Messages;
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
@@ -87,7 +88,7 @@ public class SigningState extends State {
if(this.threadException != null) {
ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(),
- SWT.NONE, "Signature error", this.threadException, true);
+ SWT.NONE, Messages.getString("error.Signatur"), this.threadException, true); //$NON-NLS-1$
this.threadException = null;
if(error.open()) {
this.stateMachine.update();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
index fb52fce8..789fafac 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
@@ -28,6 +28,7 @@ import org.apache.commons.httpclient.protocol.Protocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.states.LocalBKUState;
import at.asit.pdfover.gui.workflow.states.MobileBKUState;
@@ -43,13 +44,17 @@ public class PostSLRequestThread implements Runnable {
private MobileBKUState state;
+ private String mobileBKUUrl = ConfigManipulator.MOBILE_BKU_URL_CONFIG;
+
/**
* Constructor
*
* @param state
+ * @param mobileBKUUrl
*/
- public PostSLRequestThread(MobileBKUState state) {
+ public PostSLRequestThread(MobileBKUState state, String mobileBKUUrl) {
this.state = state;
+ this.mobileBKUUrl = mobileBKUUrl;
}
/*
@@ -69,11 +74,9 @@ public class PostSLRequestThread implements Runnable {
HttpClient client = new HttpClient();
client.getParams().setParameter("http.useragent", //$NON-NLS-1$
LocalBKUState.PDF_OVER_USER_AGENT_STRING);
-
- // TODO: move URL to config?
- String url = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
- //String url = "https://test1.a-trust.at/https-security-layer-request/default.aspx";
-
+
+ String url = this.mobileBKUUrl;
+
PostMethod method = new PostMethod(url);
method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java
index 6aa8154b..c33dfae3 100644
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java
@@ -62,7 +62,7 @@ public class PDFFileDocumentSource implements DocumentSource {
@Override
public int getLength() {
if(this.file.length() > Integer.MAX_VALUE) {
- // TODO: Handle error somehow or use long ... (Ignore Files larger than 2 GB)
+ log.error("File size to big!" + this.file.length());
}
this.len = (int) this.file.length();
return this.len;
diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
index 5b15543e..fa1572e9 100644
--- a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
+++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
@@ -17,12 +17,13 @@ package at.asit.pdfover.signer.pdfas;
//Imports
import java.util.HashMap;
-import java.util.Properties;
import at.asit.pdfover.signator.SignatureDimension;
import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signator.SignaturePosition;
import at.gv.egiz.pdfas.api.io.DataSource;
import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning;
+import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
/**
* Implementation of SignatureParameter specific for PDF - AS Library
@@ -33,17 +34,27 @@ public class PdfAsSignatureParameter extends SignatureParameter {
@Override
public SignatureDimension getPlaceholderDimension() {
- // TODO Auto-generated method stub
- return null;
+ return new SignatureDimension(487, 206);
}
/**
* Gets the PDFAS Positioning
* @return SignaturePositioning
+ * @throws PDFDocumentException
*/
- public SignaturePositioning getPDFASPositioning() {
- // TODO: implement Signature creation
- return new SignaturePositioning();
+ public SignaturePositioning getPDFASPositioning() throws PDFDocumentException {
+ SignaturePosition position = this.getSignaturePosition();
+ position.useAutoPositioning();
+
+ SignaturePositioning positioning = null;
+ if(!position.useAutoPositioning()) {
+ positioning = new SignaturePositioning(String.format("p:%d;x:%f;y:%f",
+ position.getPage(), position.getX(), position.getY()));
+ } else {
+ positioning = new SignaturePositioning();
+ }
+
+ return positioning;
}
/**