diff options
Diffstat (limited to 'pdf-over-gui/src')
3 files changed, 72 insertions, 96 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 2ee314db..215c7f08 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 @@ -86,11 +86,56 @@ public class Constants {  	/** Configuration directory */  	public static String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdfover"; //$NON-NLS-1$ //$NON-NLS-2$ -  	/** The default configuration file name */  	public static final String DEFAULT_CONFIG_FILENAME = "PDFOver.config"; //$NON-NLS-1$  	/** The default log4j file name */  	public static final String DEFAULT_LOG4J_FILENAME = "log4j.properties"; //$NON-NLS-1$ +	/* Configuration parameters */ + +	/** The bku config parameter */ +	public static final String CFG_BKU = "BKU"; //$NON-NLS-1$ + +	/** The value for the Signature position in the configuration file +	 * values for this entry are: +	 * +	 * x=vx;y=vy;p=vp or auto +	 * +	 * vx:= float value +	 * vy:= float value +	 * vp:= integer value +	 */ +	public static final String CFG_SIGNATURE_POSITION = "SIGNATURE_POSITION"; //$NON-NLS-1$ + +	/** This signature placeholder transparency config parameter (0-255) */ +	public static final String  CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$ + +	/** The mobile number config parameter */ +	public static final String CFG_MOBILE_NUMBER = "MOBILE_NUMBER"; //$NON-NLS-1$ + +	/** The signature note config parameter */ +	public static final String CFG_SIGNATURE_NOTE = "SIGNATURE_NOTE"; //$NON-NLS-1$ + +	/** Mobile bku url config parameter */ +	public static final String CFG_MOBILE_BKU_URL = "MOBILE_BKU_URL"; //$NON-NLS-1$ + +	/** The emblem config parameter */ +	public static final String CFG_EMBLEM = "EMBLEM"; //$NON-NLS-1$ + +	/** The locale config parameter */ +	public static final String CFG_LOCALE = "LOCALE"; //$NON-NLS-1$ + +	/** The signature locale config parameter */ +	public static final String CFG_SIGN_LOCALE = "SIGNLOCALE"; //$NON-NLS-1$ + +	/** The proxy host config parameter */ +	public static final String CFG_PROXY_HOST = "PROXY_HOST"; //$NON-NLS-1$ + +	/** The proxy port config parameter */ +	public static final String CFG_PROXY_PORT = "PROXY_PORT"; //$NON-NLS-1$ + +	/** The output folder config parameter */ +	public static final String CFG_OUTPUT_FOLDER = "OUTPUT_FOLDER"; //$NON-NLS-1$ +  } 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 bf7cbab3..8784dc02 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 @@ -25,75 +25,6 @@ import at.asit.pdfover.signator.SignaturePosition;   *    */  public interface ConfigManipulator { -	 -	/** -	 * The bku config parameter -	 */ -	public static final String BKU_CONFIG = "BKU"; //$NON-NLS-1$ -	 -	/** -	 * The value for the Singature position in the configuration file -	 * values for this entry are: -	 *  -	 * x=vx;y=vy;p=vp or auto -	 *  -	 * vx:= float value -	 * vy:= float value -	 * vp:= integer value -	 */ -	public static final String SIGNATURE_POSITION_CONFIG = "SIGNATURE_POSITION"; //$NON-NLS-1$ -	 -	/** -	 * This signature placeholder transparency config parameter (0-255) -	 */ -	public static final String  SIGNATURE_PLACEHOLDER_TRANSPARENCY_CONFIG = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$ -	 -	/** -	 * The mobile number config parameter -	 */ -	public static final String MOBILE_NUMBER_CONFIG = "MOBILE_NUMBER"; //$NON-NLS-1$ -	 -	/** -	 * The signature note config parameter -	 */ -	public static final String SIGNATURE_NOTE_CONFIG = "SIGNATURE_NOTE"; //$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$ -	 -	/** -	 * The locale config parameter -	 */ -	public static final String LOCALE_CONFIG = "LOCALE"; //$NON-NLS-1$ -	 -	/** -	 * The locale config parameter -	 */ -	public static final String SIGN_LOCALE_CONFIG = "SIGNLOCALE"; //$NON-NLS-1$ -	 -	/** -	 * The proxy host config parameter -	 */ -	public static final String PROXY_HOST_CONFIG = "PROXY_HOST"; //$NON-NLS-1$ -	 -	/** -	 * The proxy port config parameter -	 */ -	public static final String PROXY_PORT_CONFIG = "PROXY_PORT"; //$NON-NLS-1$ -	 -	/** -	 * The output folder config parameter -	 */ -	public static final String OUTPUT_FOLDER_CONFIG = "OUTPUT_FOLDER"; //$NON-NLS-1$ -	  	/**  	 * Sets the default bku type  	 * @param bku the bku type 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 ae8d18db..83dea41f 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 @@ -347,35 +347,35 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		Properties props = new Properties();  		props.clear(); -		props.setProperty(BKU_CONFIG, this.getDefaultBKU().toString()); -		props.setProperty(PROXY_HOST_CONFIG, this.getProxyHost()); -		props.setProperty(PROXY_PORT_CONFIG, +		props.setProperty(Constants.CFG_BKU, this.getDefaultBKU().toString()); +		props.setProperty(Constants.CFG_PROXY_HOST, this.getProxyHost()); +		props.setProperty(Constants.CFG_PROXY_PORT,  				Integer.toString(this.getProxyPort())); -		props.setProperty(EMBLEM_CONFIG, this.getDefaultEmblem()); -		props.setProperty(SIGNATURE_NOTE_CONFIG, this.getSignatureNote()); -		props.setProperty(MOBILE_NUMBER_CONFIG, this.getDefaultMobileNumber()); -		props.setProperty(OUTPUT_FOLDER_CONFIG, this.getDefaultOutputFolder()); -		props.setProperty(SIGNATURE_PLACEHOLDER_TRANSPARENCY_CONFIG, +		props.setProperty(Constants.CFG_EMBLEM, this.getDefaultEmblem()); +		props.setProperty(Constants.CFG_SIGNATURE_NOTE, this.getSignatureNote()); +		props.setProperty(Constants.CFG_MOBILE_NUMBER, this.getDefaultMobileNumber()); +		props.setProperty(Constants.CFG_OUTPUT_FOLDER, this.getDefaultOutputFolder()); +		props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY,  				Integer.toString(this.getPlaceholderTransparency()));  		Locale configLocale = this.getConfigLocale();  		if(configLocale != null) { -			props.setProperty(LOCALE_CONFIG, LocaleSerializer.getParsableString(configLocale)); +			props.setProperty(Constants.CFG_LOCALE, LocaleSerializer.getParsableString(configLocale));  		}  		Locale signLocale = this.getSignLocale();  		if(signLocale != null) { -			props.setProperty(SIGN_LOCALE_CONFIG, LocaleSerializer.getParsableString(signLocale)); +			props.setProperty(Constants.CFG_SIGN_LOCALE, LocaleSerializer.getParsableString(signLocale));  		}  		SignaturePosition pos = this.getDefaultSignaturePosition();  		if (pos == null) { -			props.setProperty(SIGNATURE_POSITION_CONFIG, ""); //$NON-NLS-1$ +			props.setProperty(Constants.CFG_SIGNATURE_POSITION, ""); //$NON-NLS-1$  		} else if (pos.useAutoPositioning()) { -			props.setProperty(SIGNATURE_POSITION_CONFIG, "auto"); //$NON-NLS-1$ +			props.setProperty(Constants.CFG_SIGNATURE_POSITION, "auto"); //$NON-NLS-1$  		} else { -			props.setProperty(SIGNATURE_POSITION_CONFIG, +			props.setProperty(Constants.CFG_SIGNATURE_POSITION,  					String.format((Locale) null, "x=%f;y=%f;p=%d", //$NON-NLS-1$  							pos.getX(), pos.getY(), pos.getPage()));  		} @@ -404,32 +404,32 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		// Set Emblem  		this.setDefaultEmblem(config -				.getProperty(ConfigManipulator.EMBLEM_CONFIG)); +				.getProperty(Constants.CFG_EMBLEM));  		// Set Mobile Phone Number  		this.setDefaultMobileNumber(config -				.getProperty(ConfigManipulator.MOBILE_NUMBER_CONFIG)); +				.getProperty(Constants.CFG_MOBILE_NUMBER));  		// Set signature note  		this.setSignatureNote(config -				.getProperty(ConfigManipulator.SIGNATURE_NOTE_CONFIG)); +				.getProperty(Constants.CFG_SIGNATURE_NOTE));  		// Set Proxy Host  		this.setProxyHost(config -				.getProperty(ConfigManipulator.PROXY_HOST_CONFIG)); +				.getProperty(Constants.CFG_PROXY_HOST));  		// Set Output Folder  		this.setDefaultOutputFolder(config -				.getProperty(ConfigManipulator.OUTPUT_FOLDER_CONFIG)); +				.getProperty(Constants.CFG_OUTPUT_FOLDER)); -		String localString = config.getProperty(ConfigManipulator.LOCALE_CONFIG); +		String localString = config.getProperty(Constants.CFG_LOCALE);  		Locale targetLocale = LocaleSerializer.parseFromString(localString);  		if(targetLocale != null) {  			this.setLocale(targetLocale);  		} -		String signlocalString = config.getProperty(ConfigManipulator.SIGN_LOCALE_CONFIG); +		String signlocalString = config.getProperty(Constants.CFG_SIGN_LOCALE);  		Locale signtargetLocale = LocaleSerializer.parseFromString(signlocalString);  		if(signtargetLocale != null) { @@ -437,7 +437,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		}  		String bku = config -				.getProperty(ConfigManipulator.MOBILE_BKU_URL_CONFIG); +				.getProperty(Constants.CFG_MOBILE_BKU_URL);  		if (bku != null && !bku.isEmpty()) {  			this.mobileBKU = bku; @@ -445,7 +445,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		// Set Proxy Port  		String proxyPortString = config -				.getProperty(ConfigManipulator.PROXY_PORT_CONFIG); +				.getProperty(Constants.CFG_PROXY_PORT);  		if (proxyPortString != null && !proxyPortString.trim().isEmpty()) {  			int port = Integer.parseInt(proxyPortString); @@ -458,7 +458,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		}  		// Set Default BKU -		String bkuString = config.getProperty(ConfigManipulator.BKU_CONFIG); +		String bkuString = config.getProperty(Constants.CFG_BKU);  		BKUs defaultBKU = BKUs.NONE; @@ -479,7 +479,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		try {  			transparency = Integer  					.parseInt(config -							.getProperty(ConfigManipulator.SIGNATURE_PLACEHOLDER_TRANSPARENCY_CONFIG)); +							.getProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY));  		} catch (NumberFormatException e) {  			log.debug("Couldn't parse placeholder transparency", e); //$NON-NLS-1$  			// ignore parsing exception @@ -488,7 +488,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		// Set Signature Position  		String signaturePosition = config -				.getProperty(ConfigManipulator.SIGNATURE_POSITION_CONFIG); +				.getProperty(Constants.CFG_SIGNATURE_POSITION);  		SignaturePosition position = null; @@ -547,7 +547,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  	/*  	 * (non-Javadoc)  	 *  -	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSigantureNote() +	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignatureNote()  	 */  	@Override  	public String getSignatureNote() { | 
