From 303ad8174d07db79c8cb365a140c327fb5dd2791 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:13:18 +0000 Subject: Message strings update git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@202 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../gui/composites/MobileBKUEnterTANComposite.java | 2 +- .../pdfover/gui/composites/OutputComposite.java | 2 +- .../composites/SimpleConfigurationComposite.java | 6 ++- .../pdfover/gui/exceptions/InvalidEmblemFile.java | 4 +- .../gui/exceptions/InvalidPortException.java | 15 ++++++-- .../at/asit/pdfover/gui/messages.properties | 44 +++++++++++----------- 6 files changed, 43 insertions(+), 30 deletions(-) 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 833d2670..fcd7084f 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 @@ -101,7 +101,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { * @param tries */ public void setTries(int tries) { - this.lbl_tries.setText(tries + Messages.getString("tanEnter.tries")); //$NON-NLS-1$ + this.lbl_tries.setText(String.format(Messages.getString("tanEnter.tries"), tries)); //$NON-NLS-1$ } /** 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 7f73d0c8..a9ea31d2 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 @@ -214,7 +214,7 @@ public class OutputComposite extends StateComposite { if (OutputComposite.this.outputFile != null) { if (OutputComposite.this.outputFile.exists()) { - // Desktop supported check allready done in constructor + // Desktop supported check already done in constructor if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open( OutputComposite.this.outputFile); 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 5d32ec30..04b10d9c 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 @@ -854,7 +854,11 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { if (portString == null || portString.trim().equals("")) { //$NON-NLS-1$ port = -1; } else { - port = Integer.parseInt(portString); + try { + port = Integer.parseInt(portString); + } catch (NumberFormatException e) { + throw new InvalidPortException(portString, e); + } } this.configurationContainer.setProxyPort(port); } 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 0657da7c..0d3306fa 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 @@ -34,7 +34,7 @@ public class InvalidEmblemFile extends PDFOverGUIException { * @param file */ public InvalidEmblemFile(final File file) { - super(file.getAbsolutePath() + Messages.getString("exception.InvalidEmblemFile")); //$NON-NLS-1$ + super(String.format(Messages.getString("exception.InvalidEmblemFile"), file.getAbsolutePath())); //$NON-NLS-1$ } /** @@ -43,6 +43,6 @@ public class InvalidEmblemFile extends PDFOverGUIException { * @param reason */ public InvalidEmblemFile(final File file, Throwable reason) { - super(file.getAbsolutePath() + Messages.getString("exception.InvalidEmblemFile"), reason); //$NON-NLS-1$ + super(String.format(Messages.getString("exception.InvalidEmblemFile"), file.getAbsolutePath()), 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 3a37d3a0..98b05c79 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 @@ -28,10 +28,19 @@ public class InvalidPortException extends PDFOverGUIException { /** - * Constructor - * @param port + * Constructor with an invalid port number + * @param port invalid port number */ public InvalidPortException(int port) { - super(port + Messages.getString("exception.InvalidPort") + 0xffff); //$NON-NLS-1$ + super(String.format(Messages.getString("exception.InvalidPort"), Integer.toString(port), 1, 0xffff)); //$NON-NLS-1$ + } + + /** + * Constructor with an invalid port string + * @param source InvalidNumberFormat exception + * @param portString invalid port string + */ + public InvalidPortException(String portString, Throwable source) { + super(String.format(Messages.getString("exception.InvalidPort"), portString, 1, 0xffff), source); //$NON-NLS-1$ } } diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index 2904e9c4..733c4724 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -1,13 +1,13 @@ #Eclipse messages class #Tue Oct 23 16:04:42 CEST 2012 -BKU.LOCAL=Local BKU -BKU.MOBILE=Mobile BKU +BKU.LOCAL=Local CCE +BKU.MOBILE=Mobile CCE BKU.NONE=no default BKUSelectionComposite.btnMobile.text=MOBILE TrustedSocketFactory.FailedToCreateSecureConnection=Failed to create secure network connection advanced_config.AutoPosition=Automatic positioning advanced_config.Signature_Title=Si&gnature -advanced_config.BKUSelection_Title=BKU Selection +advanced_config.BKUSelection_Title=CCE Selection advanced_config.OutputFolder=Default output folder: advanced_config.OutputFolder.Dialog=Select a folder advanced_config.OutputFolder.Dialog_Title=Select Output folder @@ -17,26 +17,26 @@ advanced_config.SigPHTransparencyMax=Opaque advanced_config.SigPHTransparencyMin=Invisible advanced_config.AutoPosition_ToolTip=Activate this option to automatically position the signature advanced_config.OutputFolder_ToolTip=Select the folder where the signed document will be saved automatically (clear this field to disable automatic saving) -advanced_config.BKUSelection_ToolTip=Select the default BKU to use during signature +advanced_config.BKUSelection_ToolTip=Select the default CCE to use during signature argument.error.output=is not a directory -argument.help.bku=Select the BKU to use values are: LOCAL, MOBILE (example: -b