summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:27:40 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:27:40 +0000
commit8705b6239bca1e83341a613ce9aba700efa98dcf (patch)
tree0f2fc22372e7dd5f03ba6590babe977a1b838e57 /pdf-over-gui/src/main/java/at
parentc3c000f9bf8dabef9ad193cfe94eff3e504483bb (diff)
downloadpdf-over-8705b6239bca1e83341a613ce9aba700efa98dcf.tar.gz
pdf-over-8705b6239bca1e83341a613ce9aba700efa98dcf.tar.bz2
pdf-over-8705b6239bca1e83341a613ce9aba700efa98dcf.zip
Rework ConfigurationProvider to store config in a ConfigurationContainer
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@334 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java2
-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.java209
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java118
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java161
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java2
12 files changed, 338 insertions, 187 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index 2ce3171b..9eb38388 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -77,6 +77,9 @@ public class Constants {
/** Big text size */
public static final int TEXT_SIZE_BIG = 14;
+ /** Default signature placeholder transparency */
+ public static final int DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY = 170;
+
/** How far to displace the signature with the arrow keys */
public static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15;
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 bef807a0..b522df45 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
@@ -58,7 +58,7 @@ public class PasswordArgument extends CLIArgument {
ConfigManipulator configManipulator = stateMachine.getConfigManipulator();
- configManipulator.setDefaultPassword(password);
+ configManipulator.setDefaultMobilePassword(password);
return argOffset + 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 7e846d13..8f8db82a 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
@@ -228,7 +228,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
@Override
public void widgetSelected(SelectionEvent e) {
int selectionIndex = getBKUElementIndex(AdvancedConfigurationComposite.this.configurationContainer
- .getBKUSelection());
+ .getDefaultBKU());
if (AdvancedConfigurationComposite.this.cmbBKUAuswahl
.getSelectionIndex() != selectionIndex) {
selectionIndex = AdvancedConfigurationComposite.this.cmbBKUAuswahl
@@ -416,7 +416,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
void performBKUSelectionChanged(BKUs selected) {
log.debug("Selected BKU: " + selected.toString()); //$NON-NLS-1$
- this.configurationContainer.setBKUSelection(selected);
+ this.configurationContainer.setDefaultBKU(selected);
this.cmbBKUAuswahl.select(this.getBKUElementIndex(selected));
}
@@ -494,7 +494,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
public void loadConfiguration() {
// load advanced settings
this.performBKUSelectionChanged(this.configurationContainer
- .getBKUSelection());
+ .getDefaultBKU());
String outputFolder = this.configurationContainer.getOutputFolder();
if (outputFolder != null) {
this.performOutputFolderChanged(outputFolder);
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 63372f63..706ac1f6 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
@@ -294,7 +294,7 @@ public class ConfigurationComposite extends StateComposite {
this.configurationContainer.setSignLocale(this.configProvider.getSignLocale());
- this.configurationContainer.setBKUSelection(this.configProvider
+ this.configurationContainer.setDefaultBKU(this.configProvider
.getDefaultBKU());
try {
this.configurationContainer.setEmblem(this.configProvider
@@ -303,7 +303,7 @@ public class ConfigurationComposite extends StateComposite {
log.error("Failed to set emblem!", e); //$NON-NLS-1$
}
try {
- this.configurationContainer.setNumber(this.configProvider
+ this.configurationContainer.setMobileNumber(this.configProvider
.getDefaultMobileNumber());
} catch (InvalidNumberException e) {
log.error("Failed to set mobile phone number!", e); //$NON-NLS-1$
@@ -397,9 +397,9 @@ public class ConfigurationComposite extends StateComposite {
// Write current Configuration
this.configManipulator.setDefaultBKU(this.configurationContainer
- .getBKUSelection());
+ .getDefaultBKU());
this.configManipulator
- .setDefaultMobileNumber(this.configurationContainer.getNumber());
+ .setDefaultMobileNumber(this.configurationContainer.getMobileNumber());
if (this.configurationContainer.getAutomaticPosition()) {
this.configManipulator
.setDefaultSignaturePosition(new SignaturePosition());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
index 416a3a85..7daafb19 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
@@ -76,7 +76,7 @@ public class SignaturePanel extends JPanel {
/** Current scaled signature placeholder image */
BufferedImage sigPlaceholderScaled = null;
/** Transparency of the signature placeholder (0-255) */
- private int sigPlaceholderTransparency = 170;
+ private int sigPlaceholderTransparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY;
/** Previous Transparency of the signature placeholder */
private int prevSigPlaceholderTransparency = 0;
/** Width of the signature placeholder in page space */
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 403d5ffc..dfe97470 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
@@ -908,8 +908,8 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
*/
private void plainMobileNumberSetter() throws InvalidNumberException {
String number = this.txtMobileNumber.getText();
- this.configurationContainer.setNumber(number);
- number = this.configurationContainer.getNumber();
+ this.configurationContainer.setMobileNumber(number);
+ number = this.configurationContainer.getMobileNumber();
if (number == null) {
this.txtMobileNumber.setText(""); //$NON-NLS-1$
return;
@@ -1006,7 +1006,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
@Override
public void loadConfiguration() {
// Initialize form fields from configuration Container
- String number = this.configurationContainer.getNumber();
+ String number = this.configurationContainer.getMobileNumber();
if (number != null) {
this.txtMobileNumber.setText(number);
}
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 68922802..2c879d2f 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
@@ -57,7 +57,7 @@ public interface ConfigManipulator {
* Sets the default password
* @param password the default password
*/
- public void setDefaultPassword(String password);
+ public void setDefaultMobilePassword(String password);
/**
* Sets the default emblem
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 c5d7fdd7..9d337b6d 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
@@ -56,7 +56,7 @@ public interface ConfigProvider {
* Gets the password to use for Mobile BKU
* @return the password
*/
- public String getDefaultPassword();
+ public String getDefaultMobilePassword();
/**
* Gets the filename of the default emblem
@@ -131,8 +131,8 @@ public interface ConfigProvider {
public Point getMainWindowSize();
/**
- * Loads the current configuration to the current configuration file
- * @param configSource
+ * Loads the configuration from a configuration file
+ * @param configSource the configuration file
* @throws IOException
*/
public void loadConfiguration(InputStream 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 daa04261..74afffb9 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
@@ -30,6 +30,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.Constants;
+import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
+import at.asit.pdfover.gui.exceptions.InvalidNumberException;
+import at.asit.pdfover.gui.exceptions.InvalidPortException;
import at.asit.pdfover.gui.utils.LocaleSerializer;
import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.signator.BKUs;
@@ -45,39 +48,48 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
private static final Logger log = LoggerFactory
.getLogger(ConfigProviderImpl.class);
- private BKUs defaultBKU = BKUs.NONE;
-
- private SignaturePosition defaultSignaturePosition = null;
-
/**
- * An Emtpy property entry
+ * An empty property entry
*/
public static final String STRING_EMPTY = ""; //$NON-NLS-1$
- private String defaultMobileNumber = STRING_EMPTY;
-
- private String defaultPassword = STRING_EMPTY;
-
- private Locale locale = Messages.getDefaultLocale();
- private Locale signLocale = this.locale;
-
- private String emblem = STRING_EMPTY;
-
- private String proxyHost = STRING_EMPTY;
-
private String configurationFile = Constants.DEFAULT_CONFIG_FILENAME;
- private int proxyPort = -1;
-
- private String mobileBKUURL = Constants.DEFAULT_MOBILE_BKU_URL;
+ private ConfigurationContainer configuration;
+
+// private BKUs defaultBKU = BKUs.NONE;
+//
+// private SignaturePosition defaultSignaturePosition = null;
+//
+// private String defaultMobileNumber = STRING_EMPTY;
+//
+// private String defaultPassword = STRING_EMPTY;
+//
+// private Locale locale = Messages.getDefaultLocale();
+// private Locale signLocale = this.locale;
+//
+// private String emblem = STRING_EMPTY;
+//
+// private String proxyHost = STRING_EMPTY;
+//
+// private int proxyPort = -1;
+//
+// private String mobileBKUURL = Constants.DEFAULT_MOBILE_BKU_URL;
+//
+// private String outputFolder = STRING_EMPTY;
+//
+// private String signatureNote = STRING_EMPTY;
+//
+// private int placeholderTransparency = 170;
+//
+// private Point mainWindowSize;
- private String outputFolder = STRING_EMPTY;
-
- private String signatureNote = STRING_EMPTY;
-
- private int placeholderTransparency = 170;
-
- private Point mainWindowSize;
+ /**
+ * Constructor
+ */
+ public ConfigProviderImpl() {
+ this.configuration = new ConfigurationContainerImpl();
+ }
/*
* (non-Javadoc)
@@ -127,11 +139,11 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
this.setSignLocale(signtargetLocale);
}
- String bku = config
+ String bkuUrl = config
.getProperty(Constants.CFG_MOBILE_BKU_URL);
- if (bku != null && !bku.isEmpty()) {
- this.mobileBKUURL = bku;
+ if (bkuUrl != null && !bkuUrl.isEmpty()) {
+ this.configuration.setMobileBKUURL(bkuUrl);
}
// Set Proxy Port
@@ -166,7 +178,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
this.setDefaultBKU(defaultBKU);
// Set Signature placeholder transparency
- int transparency = 170;
+ int transparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY;
try {
transparency = Integer
.parseInt(config
@@ -196,7 +208,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
// ignore parsing exception
}
}
- this.mainWindowSize = new Point(width, height);
+ this.configuration.setMainWindowSize(new Point(width, height));
// Set Signature Position
String signaturePosition = config
@@ -283,8 +295,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY,
Integer.toString(this.getPlaceholderTransparency()));
- props.setProperty(Constants.CFG_MAINWINDOW_SIZE,
- this.mainWindowSize.x + "," + this.mainWindowSize.y); //$NON-NLS-1$
+ Point size = this.configuration.getMainWindowSize();
+ props.setProperty(Constants.CFG_MAINWINDOW_SIZE, size.x + "," + size.y); //$NON-NLS-1$
Locale configLocale = this.getConfigLocale();
if(configLocale != null) {
@@ -357,7 +369,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setDefaultBKU(BKUs bku) {
- this.defaultBKU = bku;
+ this.configuration.setDefaultBKU(bku);
}
/*
@@ -367,7 +379,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public BKUs getDefaultBKU() {
- return this.defaultBKU;
+ return this.configuration.getDefaultBKU();
}
/**
@@ -378,7 +390,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setDefaultSignaturePosition(SignaturePosition signaturePosition) {
- this.defaultSignaturePosition = signaturePosition;
+ this.configuration.setDefaultSignaturePosition(signaturePosition);
}
/*
@@ -389,7 +401,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public SignaturePosition getDefaultSignaturePosition() {
- return this.defaultSignaturePosition;
+ return this.configuration.getDefaultSignaturePosition();
}
/**
@@ -400,7 +412,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setPlaceholderTransparency(int transparency) {
- this.placeholderTransparency = transparency;
+ this.configuration.setPlaceholderTransparency(transparency);
}
/*
@@ -411,7 +423,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public int getPlaceholderTransparency() {
- return this.placeholderTransparency;
+ return this.configuration.getPlaceholderTransparency();
}
/**
@@ -422,10 +434,19 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setDefaultMobileNumber(String number) {
- if (number == null || number.trim().isEmpty()) {
- this.defaultMobileNumber = STRING_EMPTY;
- } else {
- this.defaultMobileNumber = number;
+ try {
+ if (number == null || number.trim().isEmpty()) {
+ this.configuration.setMobileNumber(STRING_EMPTY);
+ } else {
+ this.configuration.setMobileNumber(number);
+ }
+ } catch (InvalidNumberException e) {
+ log.error("Error setting mobile number", e); //$NON-NLS-1$
+ try {
+ this.configuration.setMobileNumber(STRING_EMPTY);
+ } catch (InvalidNumberException e1) {
+ // Ignore
+ }
}
}
@@ -436,21 +457,21 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public String getDefaultMobileNumber() {
- return this.defaultMobileNumber;
+ return this.configuration.getMobileNumber();
}
/**
- * Sets the default password
+ * Sets the default mobile password
*
* @param password
* the default password
*/
@Override
- public void setDefaultPassword(String password) {
+ public void setDefaultMobilePassword(String password) {
if (password == null || password.trim().isEmpty()) {
- this.defaultPassword = STRING_EMPTY;
+ this.configuration.setMobilePassword(STRING_EMPTY);
} else {
- this.defaultPassword = password;
+ this.configuration.setMobilePassword(password);
}
}
@@ -460,8 +481,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
* @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultPassword()
*/
@Override
- public String getDefaultPassword() {
- return this.defaultPassword;
+ public String getDefaultMobilePassword() {
+ return this.configuration.getMobilePassword();
}
/**
@@ -472,10 +493,19 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setDefaultEmblem(String emblem) {
- if (emblem == null || emblem.trim().isEmpty()) {
- this.emblem = STRING_EMPTY;
- } else {
- this.emblem = emblem;
+ try {
+ if (emblem == null || emblem.trim().isEmpty()) {
+ this.configuration.setEmblem(STRING_EMPTY);
+ } else {
+ this.configuration.setEmblem(emblem);
+ }
+ } catch (InvalidEmblemFile e) {
+ log.error("Error setting emblem file", e); //$NON-NLS-1$
+ try {
+ this.configuration.setEmblem(STRING_EMPTY);
+ } catch (InvalidEmblemFile e1) {
+ // Ignore
+ }
}
}
@@ -486,7 +516,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public String getDefaultEmblem() {
- return this.emblem;
+ return this.configuration.getEmblem();
}
/**
@@ -498,9 +528,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
@Override
public void setProxyHost(String host) {
if (host == null || host.trim().isEmpty()) {
- this.proxyHost = STRING_EMPTY;
+ this.configuration.setProxyHost(STRING_EMPTY);
} else {
- this.proxyHost = host;
+ this.configuration.setProxyHost(host);
}
}
@@ -511,7 +541,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public String getProxyHost() {
- return this.proxyHost;
+ return this.configuration.getProxyHost();
}
/**
@@ -522,7 +552,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setProxyPort(int port) {
- this.proxyPort = port;
+ try {
+ this.configuration.setProxyPort(port);
+ } catch (InvalidPortException e) {
+ log.error("Error setting proxy port" , e); //$NON-NLS-1$
+ // ignore
+ }
}
/*
@@ -532,7 +567,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public int getProxyPort() {
- return this.proxyPort;
+ return this.configuration.getProxyPort();
}
/*
@@ -545,9 +580,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
@Override
public void setDefaultOutputFolder(String outputFolder) {
if (outputFolder == null || outputFolder.trim().isEmpty()) {
- this.outputFolder = STRING_EMPTY;
+ this.configuration.setOutputFolder(STRING_EMPTY);
} else {
- this.outputFolder = outputFolder;
+ this.configuration.setOutputFolder(outputFolder);
}
}
@@ -558,7 +593,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public String getDefaultOutputFolder() {
- return this.outputFolder;
+ return this.configuration.getOutputFolder();
}
/*
@@ -568,17 +603,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public String getMobileBKUURL() {
- return this.mobileBKUURL;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignatureNote()
- */
- @Override
- public String getSignatureNote() {
- return this.signatureNote;
+ return this.configuration.getMobileBKUURL();
}
/*
@@ -591,18 +616,20 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
@Override
public void setSignatureNote(String note) {
if (note == null || note.trim().isEmpty()) {
- this.signatureNote = STRING_EMPTY;
+ this.configuration.setSignatureNote(STRING_EMPTY);
} else {
- this.signatureNote = note;
+ this.configuration.setSignatureNote(note);
}
}
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigLocale()
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignatureNote()
*/
@Override
- public Locale getConfigLocale() {
- return this.locale;
+ public String getSignatureNote() {
+ return this.configuration.getSignatureNote();
}
/* (non-Javadoc)
@@ -611,23 +638,31 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
@Override
public void setLocale(Locale locale) {
if(locale == null) {
- this.locale = Messages.getDefaultLocale();
+ this.configuration.setLocale(Messages.getDefaultLocale());
} else {
- this.locale = locale;
+ this.configuration.setLocale(locale);
Locale.setDefault(locale);
Messages.setLocale(locale);
}
}
/* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigLocale()
+ */
+ @Override
+ public Locale getConfigLocale() {
+ return this.configuration.getLocale();
+ }
+
+ /* (non-Javadoc)
* @see at.asit.pdfover.gui.workflow.ConfigManipulator#setSignLocale(java.util.Locale)
*/
@Override
public void setSignLocale(Locale locale) {
if(locale == null) {
- this.signLocale = Messages.getDefaultLocale();
+ this.configuration.setSignLocale(Messages.getDefaultLocale());
} else {
- this.signLocale = locale;
+ this.configuration.setSignLocale(locale);
}
}
@@ -636,7 +671,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public Locale getSignLocale() {
- return this.signLocale;
+ return this.configuration.getSignLocale();
}
/* (non-Javadoc)
@@ -644,7 +679,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public void setMainWindowSize(Point size) {
- this.mainWindowSize = size;
+ this.configuration.setMainWindowSize(size);
}
/* (non-Javadoc)
@@ -652,7 +687,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public Point getMainWindowSize() {
- return this.mainWindowSize;
+ return this.configuration.getMainWindowSize();
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java
index b9c80f6b..195ac144 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java
@@ -17,66 +17,80 @@ package at.asit.pdfover.gui.workflow;
import java.util.Locale;
+import org.eclipse.swt.graphics.Point;
+
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPortException;
import at.asit.pdfover.signator.BKUs;
+import at.asit.pdfover.signator.SignaturePosition;
/**
*
*/
public interface ConfigurationContainer {
-
/**
* Gets the configured emblem
* @return the configured emblem
*/
public String getEmblem();
-
+
/**
* Sets the emblem
* @param emblem the emblem
* @throws InvalidEmblemFile
*/
public void setEmblem(String emblem) throws InvalidEmblemFile;
-
+
/**
* Gets the mobile phone number
* @return the mobile phone number
*/
- public String getNumber();
-
+ public String getMobileNumber();
+
/**
* Sets the mobile phone number
* @param number the mobile phone number
* @throws InvalidNumberException
*/
- public void setNumber(String number) throws InvalidNumberException;
-
+ public void setMobileNumber(String number) throws InvalidNumberException;
+
+ /**
+ * Gets the mobile phone number
+ * @return the mobile phone number
+ */
+ public String getMobilePassword();
+
+ /**
+ * Sets the mobile phone password
+ * @param password the mobile phone password
+ */
+ public void setMobilePassword(String password);
+
/**
* Gets the proxy host
* @return the proxy host
*/
public String getProxyHost();
-
+
/**
* Sets the proxy host
* @param host the proxy host
*/
public void setProxyHost(String host);
-
+
/**
* Gets the signature note
* @return the signature note
*/
public String getSignatureNote();
-
+
/**
* Sets the signature note
* @param note the signature note
*/
public void setSignatureNote(String note);
-
+
/**
* Gets the proxy port
*
@@ -85,7 +99,7 @@ public interface ConfigurationContainer {
* @return the proxy port
*/
public int getProxyPort();
-
+
/**
* Sets the proxy port
*
@@ -95,25 +109,25 @@ public interface ConfigurationContainer {
* @throws InvalidPortException
*/
public void setProxyPort(int port) throws InvalidPortException;
-
+
/**
* Gets the automatic position
* @return the automatic position
*/
public boolean getAutomaticPosition();
-
+
/**
* Sets the automatic position
* @param automatic the automatic position
*/
public void setAutomaticPosition(boolean automatic);
-
+
/**
* Gets the transparency of the placeholder
* @return transparency of the placeholder (0-255)
*/
public int getPlaceholderTransparency();
-
+
/**
* Sets the transparency of the placeholder
* @param transparency transparency of the placeholder (0-255)
@@ -124,47 +138,83 @@ public interface ConfigurationContainer {
* Gets the default BKU
* @return the default BKU
*/
- public BKUs getBKUSelection();
-
+ public BKUs getDefaultBKU();
+
/**
* Sets the default BKU
- * @param bkuSelection the default BKU
+ * @param defaultBKU the default BKU
*/
- public void setBKUSelection(BKUs bkuSelection);
-
+ public void setDefaultBKU(BKUs defaultBKU);
+
/**
* Gets the default output folder
* @return the default output folder
*/
public String getOutputFolder();
-
+
/**
* Sets the default output folder
* @param folder the default output folder
*/
public void setOutputFolder(String folder);
-
- /**
- * Sets the locale
- * @param locale the locale
- */
- public void setLocale(Locale locale);
-
+
/**
* Gets the locale
* @return the locale
*/
public Locale getLocale();
-
+
/**
* Sets the locale
* @param locale the locale
*/
- public void setSignLocale(Locale locale);
-
+ public void setLocale(Locale locale);
+
/**
- * Gets the locale
- * @return the locale
+ * Gets the signature locale
+ * @return the signature locale
*/
public Locale getSignLocale();
+
+ /**
+ * Sets the signature locale
+ * @param locale the signature locale
+ */
+ public void setSignLocale(Locale locale);
+
+ /**
+ * Gets the mobile BKU URL
+ * @return the mobile BKU URL
+ */
+ public String getMobileBKUURL();
+
+ /**
+ * Sets the mobile BKU URL
+ * @param bkuUrl the mobile BKU URL
+ */
+ public void setMobileBKUURL(String bkuUrl);
+
+ /**
+ * Gets the default signature position
+ * @return the default signature position
+ */
+ public SignaturePosition getDefaultSignaturePosition();
+
+ /**
+ * Gets the default signature position
+ * @param signaturePosition the default signature position
+ */
+ public void setDefaultSignaturePosition(SignaturePosition signaturePosition);
+
+ /**
+ * Gets the main window size
+ * @return the main window size
+ */
+ public Point getMainWindowSize();
+
+ /**
+ * Sets the main window size
+ * @param size the main window size
+ */
+ public void setMainWindowSize(Point size);
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java
index e7359c64..219ac99b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java
@@ -22,16 +22,19 @@ import java.util.Locale;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Constants;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPortException;
import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.gui.workflow.states.mobilebku.ATrustHelper;
import at.asit.pdfover.signator.BKUs;
+import at.asit.pdfover.signator.SignaturePosition;
/**
*
@@ -45,60 +48,50 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
.getLogger(ConfigurationContainerImpl.class);
- /**
- * the emblem File
- */
+ /** the emblem File */
protected String emblemFile = null;
- /**
- * The mobile phone number
- */
+ /** The mobile phone number */
protected String mobileNumber = null;
- /**
- * Holds the proxy Host
- */
+ /** The mobile phone password */
+ protected String mobilePassword = null;
+
+ /** Holds the proxy Host */
protected String proxyHost = null;
- /**
- * Holds the signatureNote
- */
+ /** Holds the signatureNote */
protected String signatureNote = null;
- /**
- * Holds the proxy port number
- */
+ /** Holds the proxy port number */
protected int proxyPort = -1;
- /**
- * Holds the locale
- */
+ /** Holds the locale */
protected Locale locale = null;
- /**
- * Holds the locale
- */
+ /** Holds the signature locale */
protected Locale signLocale = null;
- /**
- * Holds the output folder
- */
+ /** Holds the output folder */
protected String folder = null;
- /**
- * Holds the default BKU to use
- */
- protected BKUs defaulBKU = BKUs.NONE;
+ /** Holds the default BKU to use */
+ protected BKUs defaultBKU = BKUs.NONE;
- /**
- * Holds the automatic positioning value
- */
+ /** Holds the automatic positioning value */
protected boolean automaticPositioning = false;
- /**
- * Holds the transparency of the signature placeholder
- */
- protected int placeholderTransparency = 170;
+ /** Holds the transparency of the signature placeholder */
+ protected int placeholderTransparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY;
+
+ /** Holds the mobile BKU URL */
+ protected String mobileBKUURL = Constants.DEFAULT_MOBILE_BKU_URL;
+
+ /** Holds the main window size */
+ protected Point mainWindowSize = null;
+
+ /** Holds the default signature position */
+ protected SignaturePosition defaultSignaturePosition = null;
/* (non-Javadoc)
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem()
@@ -108,7 +101,6 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
return this.emblemFile;
}
-
/* (non-Javadoc)
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#setEmblem(java.lang.String)
*/
@@ -141,7 +133,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#getNumber()
*/
@Override
- public String getNumber() {
+ public String getMobileNumber() {
return this.mobileNumber;
}
@@ -150,7 +142,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#setNumber(java.lang.String)
*/
@Override
- public void setNumber(String number) throws InvalidNumberException {
+ public void setMobileNumber(String number) throws InvalidNumberException {
if(number == null || number.trim().isEmpty()) {
this.mobileNumber = null;
return;
@@ -164,6 +156,24 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
/* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getDefaultMobilePassword()
+ */
+ @Override
+ public String getMobilePassword() {
+ return this.mobilePassword;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setDefaultMobilePassword(java.lang.String)
+ */
+ @Override
+ public void setMobilePassword(String password) {
+ this.mobilePassword = password;
+ }
+
+
+ /* (non-Javadoc)
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#getProxyHost()
*/
@Override
@@ -247,8 +257,8 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#getBKUSelection()
*/
@Override
- public BKUs getBKUSelection() {
- return this.defaulBKU;
+ public BKUs getDefaultBKU() {
+ return this.defaultBKU;
}
@@ -256,8 +266,8 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
* @see at.asit.pdfover.gui.composites.ConfigurationContainer#setBKUSelection(at.asit.pdfover.signator.BKUs)
*/
@Override
- public void setBKUSelection(BKUs bkuSelection) {
- this.defaulBKU = bkuSelection;
+ public void setDefaultBKU(BKUs bkuSelection) {
+ this.defaultBKU = bkuSelection;
}
@@ -298,6 +308,15 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
/* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getLocale()
+ */
+ @Override
+ public Locale getLocale() {
+ return this.locale;
+ }
+
+
+ /* (non-Javadoc)
* @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setLocale(java.util.Locale)
*/
@Override
@@ -307,11 +326,11 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
/* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getLocale()
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignLocale()
*/
@Override
- public Locale getLocale() {
- return this.locale;
+ public Locale getSignLocale() {
+ return this.signLocale;
}
@@ -325,11 +344,55 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {
/* (non-Javadoc)
- * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignLocale()
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getMobileBkURL()
*/
@Override
- public Locale getSignLocale() {
- return this.signLocale;
+ public String getMobileBKUURL() {
+ return this.mobileBKUURL;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setMobileBkURL(java.lang.String)
+ */
+ @Override
+ public void setMobileBKUURL(String bkuUrl) {
+ this.mobileBKUURL = bkuUrl;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignaturePosition()
+ */
+ @Override
+ public SignaturePosition getDefaultSignaturePosition() {
+ return this.defaultSignaturePosition;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setSignaturePosition(at.asit.pdfover.signator.SignaturePosition)
+ */
+ @Override
+ public void setDefaultSignaturePosition(SignaturePosition signaturePosition) {
+ this.defaultSignaturePosition = signaturePosition;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getMainWindowSize()
+ */
+ @Override
+ public Point getMainWindowSize() {
+ return this.mainWindowSize;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setMainWindowSize(org.eclipse.swt.graphics.Point)
+ */
+ @Override
+ public void setMainWindowSize(Point size) {
+ this.mainWindowSize = size;
}
-
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java
index fe85d492..fd8ded4e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUStatus.java
@@ -43,7 +43,7 @@ public class MobileBKUStatus {
*/
public MobileBKUStatus(ConfigProvider provider) {
this.setPhoneNumber(provider.getDefaultMobileNumber());
- this.setMobilePassword(provider.getDefaultPassword());
+ this.setMobilePassword(provider.getDefaultMobilePassword());
}
String viewstate;