diff options
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
6 files changed, 138 insertions, 48 deletions
| 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 b2f0f7a0..1e584f40 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 @@ -48,6 +48,11 @@ public interface ConfigManipulator {  	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$ @@ -77,7 +82,6 @@ public interface ConfigManipulator {  	 */  	public static final String OUTPUT_FOLDER_CONFIG = "OUTPUT_FOLDER"; //$NON-NLS-1$ -	  	/**  	 * Sets the default bku type  	 * @param bku the bku type @@ -92,6 +96,13 @@ public interface ConfigManipulator {  	public void setDefaultSignaturePosition(SignaturePosition signaturePosition);  	/** +	 * Sets the signature placeholder transparency +	 *  +	 * @param transparency the signature placeholder transparency +	 */ +	void setPlaceholderTransparency(int transparency); +	 +	/**  	 * Sets the default mobile number  	 * @param number the default mobile number  	 */ 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 0ee116ad..910bdcbb 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 SignaturePosition getDefaultSignaturePosition();  	/** +	 * Get the transparency of the signature placeholder +	 * @return the transparency of the signature placeholder +	 */ +	public int getPlaceholderTransparency(); +	 +	/**  	 * Gets the default output folder for signed documents  	 * @return the default output folder   	 */ 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 dc50b60b..553daeeb 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 @@ -78,6 +78,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  	private String outputFolder = STRING_EMPTY; +	private int placeholderTransparency = 170; +  	/**  	 * Sets the default bku type  	 *  @@ -122,6 +124,25 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  	}  	/** +	 * Sets the signature placeholder transparency +	 *  +	 * @param transparency +	 *            the signature placeholder transparency +	 */ +	@Override +	public void setPlaceholderTransparency(int transparency) { +		this.placeholderTransparency = transparency; +	} + +	/* (non-Javadoc) +	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getPlaceholderTransparency() +	 */ +	@Override +	public int getPlaceholderTransparency() { +		return this.placeholderTransparency; +	} + +	/**  	 * Sets the default mobile number  	 *   	 * @param number @@ -246,6 +267,48 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  	 * (non-Javadoc)  	 *   	 * @see +	 * at.asit.pdfover.gui.workflow.ConfigManipulator#setDefaultOutputFolder +	 * (java.lang.String) +	 */ +	@Override +	public void setDefaultOutputFolder(String outputFolder) { +		if (outputFolder == null || outputFolder.trim().equals("")) { //$NON-NLS-1$ +			this.outputFolder = STRING_EMPTY; +		} else { +			this.outputFolder = outputFolder; +		} +	} + +	/* +	 * (non-Javadoc) +	 *  +	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultOutputFolder() +	 */ +	@Override +	public String getDefaultOutputFolder() { +		return this.outputFolder; +	} + +	/* (non-Javadoc) +	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getMobileBKUURL() +	 */ +	@Override +	public String getMobileBKUURL() { +		return this.mobileBKU; +	} + +	/* (non-Javadoc) +	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigurationDirectory() +	 */ +	@Override +	public String getConfigurationDirectory() { +		return CONFIG_DIRECTORY; +	} + +	/* +	 * (non-Javadoc) +	 *  +	 * @see  	 * at.asit.pdfover.gui.workflow.ConfigManipulator#setConfigurationFile(java  	 * .lang.String)  	 */ @@ -286,6 +349,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		props.setProperty(EMBLEM_CONFIG, this.getDefaultEmblem());  		props.setProperty(MOBILE_NUMBER_CONFIG, this.getDefaultMobileNumber());  		props.setProperty(OUTPUT_FOLDER_CONFIG, this.getDefaultOutputFolder()); +		props.setProperty(SIGNATURE_PLACEHOLDER_TRANSPARENCY_CONFIG, Integer.toString(this.getPlaceholderTransparency()));  		SignaturePosition pos = this.getDefaultSignaturePosition(); @@ -311,32 +375,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  	 * (non-Javadoc)  	 *   	 * @see -	 * at.asit.pdfover.gui.workflow.ConfigManipulator#setDefaultOutputFolder -	 * (java.lang.String) -	 */ -	@Override -	public void setDefaultOutputFolder(String outputFolder) { -		if (outputFolder == null || outputFolder.trim().equals("")) { //$NON-NLS-1$ -			this.outputFolder = STRING_EMPTY; -		} else { -			this.outputFolder = outputFolder; -		} -	} - -	/* -	 * (non-Javadoc) -	 *  -	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultOutputFolder() -	 */ -	@Override -	public String getDefaultOutputFolder() { -		return this.outputFolder; -	} - -	/* -	 * (non-Javadoc) -	 *  -	 * @see  	 * at.asit.pdfover.gui.workflow.ConfigProvider#loadConfiguration(java.io  	 * .InputStream)  	 */ @@ -401,6 +439,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {  		this.setDefaultBKU(defaultBKU); +		// Set Signature placeholder transparency +		int transparency = 170; +		try { +			transparency = Integer.parseInt(config +					.getProperty(ConfigManipulator.SIGNATURE_PLACEHOLDER_TRANSPARENCY_CONFIG)); +		} catch (NumberFormatException e) { +			log.debug("Couldn't parse placeholder transparency", e); +			// ignore parsing exception +		} +		this.setPlaceholderTransparency(transparency); +  		// Set Signature Position  		String signaturePosition = config  				.getProperty(ConfigManipulator.SIGNATURE_POSITION_CONFIG); @@ -459,20 +508,4 @@ 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; -	} - -	/* (non-Javadoc) -	 * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigurationDirectory() -	 */ -	@Override -	public String getConfigurationDirectory() { -		return CONFIG_DIRECTORY; -	} -  } 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 796a4cec..693d5e16 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 @@ -95,6 +95,18 @@ public interface ConfigurationContainer {  	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) +	 */ +	public void setPlaceholderTransparency(int transparency); + +	/**  	 * Gets the default BKU  	 * @return the default BKU  	 */ 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 081f4072..ef7a8450 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 @@ -78,6 +78,11 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {  	 */  	protected boolean automaticPositioning = false; +	/** +	 * Holds the transparency of the signature placeholder +	 */ +	protected int placeholderTransparency = 170; +  	/* (non-Javadoc)  	 * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem()  	 */ @@ -200,6 +205,24 @@ public class ConfigurationContainerImpl implements ConfigurationContainer {  	/* (non-Javadoc) +	 * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getPlaceholderTransparency() +	 */ +	@Override +	public int getPlaceholderTransparency() { +		return this.placeholderTransparency; +	} + + +	/* (non-Javadoc) +	 * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setPlaceholderTransparency(int) +	 */ +	@Override +	public void setPlaceholderTransparency(int transparency) { +		this.placeholderTransparency = transparency; +	} + + +	/* (non-Javadoc)  	 * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getBKUSelection()  	 */  	@Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index d291956d..e35ec790 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -56,12 +56,18 @@ public class PositioningState extends State {  			this.positionComposite =  					this.stateMachine.getGUIProvider().createComposite(PositioningComposite.class, SWT.RESIZE, this);  			log.debug("Displaying " +  this.stateMachine.getStatus().getDocument()); -			SignatureParameter param = this.stateMachine.getPDFSigner().getPDFSigner().newParameter(); -			Emblem emblem = new FileNameEmblem(this.stateMachine.getConfigProvider().getDefaultEmblem()); -			param.setEmblem(emblem);  			this.positionComposite.displayDocument(this.stateMachine.getStatus().getDocument()); -			this.positionComposite.setPlaceholder(param.getPlaceholder(), param.getPlaceholderDimension().getWidth(), param.getPlaceholderDimension().getHeight());  		} +		// Update possibly changed values +		SignatureParameter param = this.stateMachine.getPDFSigner().getPDFSigner().newParameter(); +		Emblem emblem = new FileNameEmblem(this.stateMachine.getConfigProvider().getDefaultEmblem()); +		param.setEmblem(emblem); +		this.positionComposite.setPlaceholder( +				param.getPlaceholder(), +				param.getPlaceholderDimension().getWidth(), +				param.getPlaceholderDimension().getHeight(), +				this.stateMachine.getConfigProvider().getPlaceholderTransparency()); +		this.positionComposite.requestFocus();  		return this.positionComposite;  	} @@ -75,7 +81,6 @@ public class PositioningState extends State {  			status.setSignaturePosition(null);  		} -  		if(status.getSignaturePosition() == null) {  			PositioningComposite position = null;  			try { | 
