summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:06:00 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:06:00 +0000
commit0b716028cb197d4bebfbb88b317b3a0600f82d6a (patch)
tree64d7e3f1b8c05fb90cbf32bdd6faa97f8d621ca3 /pdf-over-gui
parent06e896f3578e9a527e4e80940e88342ea6dad24f (diff)
downloadpdf-over-0b716028cb197d4bebfbb88b317b3a0600f82d6a.tar.gz
pdf-over-0b716028cb197d4bebfbb88b317b3a0600f82d6a.tar.bz2
pdf-over-0b716028cb197d4bebfbb88b317b3a0600f82d6a.zip
Make signature placeholder transparency configurable
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@128 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java106
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java19
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java21
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java13
-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.java117
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainer.java12
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigurationContainerImpl.java23
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java15
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties2
11 files changed, 238 insertions, 102 deletions
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 b82150aa..e9383747 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
@@ -16,40 +16,53 @@
package at.asit.pdfover.gui.composites;
// Imports
-import org.eclipse.swt.widgets.Composite;
-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;
-import at.asit.pdfover.signator.BKUs;
-
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
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.workflow.ConfigurationContainer;
+import at.asit.pdfover.gui.workflow.states.State;
+import at.asit.pdfover.signator.BKUs;
/**
* Composite for advanced configuration
*/
public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
+
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(AdvancedConfigurationComposite.class);
+ SimpleConfigurationComposite simpleComposite;
+ Text txtOutputFolder;
+ Combo cmbBKUAuswahl;
+ String[] bkuStrings;
+ Button btnAutomatischePositionierung;
+ Scale sclTransparenz;
+
/**
* @param parent
* @param style
@@ -89,21 +102,21 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
advancedTabItem.setControl(advancedComposite);
advancedComposite.setLayout(new FormLayout());
- Group grpSignaturPosition = new Group(advancedComposite, SWT.NONE);
- 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);
- fd_grpSignaturPosition.bottom = new FormAttachment(33, -5);
- fd_grpSignaturPosition.right = new FormAttachment(100, -5);
- fd_grpSignaturPosition.left = new FormAttachment(0, 5);
- grpSignaturPosition.setLayoutData(fd_grpSignaturPosition);
-
- FontData[] fD_grpSignaturPosition = grpSignaturPosition.getFont().getFontData();
+ Group grpSignatur = new Group(advancedComposite, SWT.NONE);
+ grpSignatur.setText(Messages.getString("advanced_config.Signature_Title")); //$NON-NLS-1$
+ grpSignatur.setLayout(new FormLayout());
+ FormData fd_grpSignatur = new FormData();
+ fd_grpSignatur.top = new FormAttachment(0, 5);
+ fd_grpSignatur.bottom = new FormAttachment(33, -5);
+ fd_grpSignatur.right = new FormAttachment(100, -5);
+ fd_grpSignatur.left = new FormAttachment(0, 5);
+ grpSignatur.setLayoutData(fd_grpSignatur);
+
+ FontData[] fD_grpSignaturPosition = grpSignatur.getFont().getFontData();
fD_grpSignaturPosition[0].setHeight(TEXT_SIZE_NORMAL);
- grpSignaturPosition.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0]));
+ grpSignatur.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0]));
- this.btnAutomatischePositionierung = new Button(grpSignaturPosition,
+ this.btnAutomatischePositionierung = new Button(grpSignatur,
SWT.CHECK);
FormData fd_btnAutomatischePositionierung = new FormData();
fd_btnAutomatischePositionierung.right = new FormAttachment(100, -5);
@@ -125,6 +138,24 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
AdvancedConfigurationComposite.this.btnAutomatischePositionierung.getSelection());
}
});
+ log.debug(this.btnAutomatischePositionierung.getBounds().toString());
+
+ this.sclTransparenz = new Scale(grpSignatur, SWT.HORIZONTAL);
+ FormData fd_sldTransparenz = new FormData();
+ fd_sldTransparenz.right = new FormAttachment(100, -5);
+ fd_sldTransparenz.top = new FormAttachment(this.btnAutomatischePositionierung, 5);
+ fd_sldTransparenz.left = new FormAttachment(0, 5);
+ this.sclTransparenz.setLayoutData(fd_sldTransparenz);
+ this.sclTransparenz.setMinimum(0);
+ this.sclTransparenz.setMaximum(255);
+ this.sclTransparenz.setIncrement(1);
+ this.sclTransparenz.setPageIncrement(10);
+ this.sclTransparenz.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ performPlaceholderTransparency(AdvancedConfigurationComposite.this.sclTransparenz.getSelection());
+ }
+ });
Group grpBkuAuswahl = new Group(advancedComposite, SWT.NONE);
grpBkuAuswahl.setText(Messages.getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$
@@ -328,16 +359,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
this.btnAutomatischePositionierung.setSelection(automatic);
}
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(AdvancedConfigurationComposite.class);
- SimpleConfigurationComposite simpleComposite;
- Text txtOutputFolder;
- Combo cmbBKUAuswahl;
- String[] bkuStrings;
- Button btnAutomatischePositionierung;
+ void performPlaceholderTransparency(int transparency) {
+ log.debug("Transparency: " + transparency); //$NON-NLS-1$
+ this.configurationContainer.setPlaceholderTransparency(transparency);
+ }
/*
* (non-Javadoc)
@@ -367,6 +392,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
this.performOutputFolderChanged(outputFolder);
}
this.performPositionSelection(this.configurationContainer.getAutomaticPosition());
+ this.sclTransparenz.setSelection(this.configurationContainer.getPlaceholderTransparency());
}
/* (non-Javadoc)
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 105fcd54..e19cdfa6 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
@@ -201,6 +201,9 @@ public class ConfigurationComposite extends StateComposite {
.useAutoPositioning());
}
+ this.configurationContainer.setPlaceholderTransparency(
+ this.configProvider.getPlaceholderTransparency());
+
this.configurationContainer.setBKUSelection(this.configProvider
.getDefaultBKU());
try {
@@ -332,6 +335,9 @@ public class ConfigurationComposite extends StateComposite {
this.configManipulator.setDefaultSignaturePosition(null);
}
+ this.configManipulator.setPlaceholderTransparency(
+ this.configurationContainer.getPlaceholderTransparency());
+
this.configManipulator
.setDefaultOutputFolder(this.configurationContainer
.getOutputFolder());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index 86ccbe9b..f841ae6f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
@@ -92,6 +92,13 @@ public class PositioningComposite extends StateComposite {
this.numPages = this.pdf.getNumPages();
this.scrollbar.setValues(1, 1, this.numPages + 1, 1, 1, 1);
showPage(this.numPages);
+ }
+
+ /**
+ * Request focus (to enable keyboard input)
+ */
+ public void requestFocus()
+ {
this.setFocus();
this.frame.requestFocus();
}
@@ -102,11 +109,12 @@ public class PositioningComposite extends StateComposite {
* @param placeholder signature placeholder
* @param width width of the placeholder in page space
* @param height height of the placeholder in page space
+ * @param transparency transparency of the signature placeholder (0 - 255)
*/
- public void setPlaceholder(Image placeholder, int width, int height) {
+ public void setPlaceholder(Image placeholder, int width, int height, int transparency) {
if (this.viewer == null)
return;
- this.viewer.setSignaturePlaceholder(placeholder, width, height);
+ this.viewer.setSignaturePlaceholder(placeholder, width, height, transparency);
}
/**
@@ -124,8 +132,6 @@ public class PositioningComposite extends StateComposite {
this.addKeyListener(this.keyListener);
this.frame.addMouseWheelListener(this.mouseListener);
this.scrollbar.addSelectionListener(this.selectionListener);
- this.setFocus();
- this.frame.requestFocus();
}
private KeyListener keyListener = new KeyAdapter() {
@@ -222,7 +228,10 @@ public class PositioningComposite extends StateComposite {
*/
void setFinalPosition() {
// TODO: check if this is the real position
- this.position = new SignaturePosition(this.viewer.getSignaturePositionX(), this.viewer.getSignaturePositionY(), this.currentPage);
+ this.position = new SignaturePosition(
+ this.viewer.getSignaturePositionX(),
+ this.viewer.getSignaturePositionY(),
+ this.currentPage);
PositioningComposite.this.state.updateStateMachine();
}
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 f2c2c798..b2f5270f 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
@@ -50,9 +50,6 @@ public class SignaturePanel extends JPanel {
/** Default serial version ID */
private static final long serialVersionUID = 1L;
- /** Signature transparency (0-255) */
- private static final int SIG_TRANSPARENCY = 170;
-
/** The PDF file being displayed */
private PDFFile pdf = null;
/** The image of the rendered PDF page being displayed */
@@ -75,6 +72,10 @@ public class SignaturePanel extends JPanel {
private Image sigPlaceholder = null;
/** Current scaled signature placeholder image */
BufferedImage sigPlaceholderScaled = null;
+ /** Transparency of the signature placeholder (0-255) */
+ private int sigPlaceholderTransparency = 170;
+ /** Previous Transparency of the signature placeholder */
+ private int prevSigPlaceholderTransparency = 0;
/** Width of the signature placeholder in page space */
private int sigPageWidth = 0;
/** Height of the signature placeholder in page space */
@@ -116,12 +117,13 @@ public class SignaturePanel extends JPanel {
* @param placeholder signature placeholder
* @param width width of the placeholder in page space
* @param height height of the placeholder in page space
+ * @param transparency transparency of the signature placeholder (0 - 255)
*/
- public void setSignaturePlaceholder(Image placeholder, int width, int height)
- {
+ public void setSignaturePlaceholder(Image placeholder, int width, int height, int transparency) {
this.sigPlaceholder = placeholder;
this.sigPageWidth = width;
this.sigPageHeight = height;
+ this.sigPlaceholderTransparency = transparency;
}
/**
@@ -253,12 +255,15 @@ public class SignaturePanel extends JPanel {
g.drawRect(sigX, sigY, 100, 40);
}
else {
- if ((this.sigScreenWidth != this.prevSigScreenWidth)
- || (this.sigScreenHeight != this.prevSigScreenHeight))
+ if (
+ (this.sigScreenWidth != this.prevSigScreenWidth) ||
+ (this.sigScreenHeight != this.prevSigScreenHeight) ||
+ (this.sigPlaceholderTransparency != this.prevSigPlaceholderTransparency))
{
// redraw scaled transparent placeholder
this.prevSigScreenWidth = this.sigScreenWidth;
this.prevSigScreenHeight = this.sigScreenHeight;
+ this.prevSigPlaceholderTransparency = this.sigPlaceholderTransparency;
Image placeholder = this.sigPlaceholder.getScaledInstance(
this.sigScreenWidth, this.sigScreenHeight, Image.SCALE_SMOOTH);
this.sigPlaceholderScaled = new BufferedImage(this.sigScreenWidth, this.sigScreenHeight, BufferedImage.TYPE_INT_ARGB);
@@ -269,7 +274,7 @@ public class SignaturePanel extends JPanel {
phpixels = this.sigPlaceholderScaled.getRGB(0, 0, this.sigScreenWidth, this.sigScreenHeight, phpixels, 0, this.sigScreenWidth);
for (int i = 0; i < phpixels.length; ++i) {
Color c = new Color(phpixels[i]);
- c = new Color(c.getRed(), c.getGreen(), c.getBlue(), SIG_TRANSPARENCY);
+ c = new Color(c.getRed(), c.getGreen(), c.getBlue(), this.sigPlaceholderTransparency);
phpixels[i] = c.getRGB();
}
this.sigPlaceholderScaled.setRGB(0, 0, this.sigScreenWidth, this.sigScreenHeight, phpixels, 0, this.sigScreenWidth);
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 {
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 05665bcc..93e76a3a 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
@@ -6,7 +6,7 @@ BKU.NONE=no default
BKUSelectionComposite.btnMobile.text=MOBILE
TrustedSocketFactory.FailedToCreateSecureConnection=Failed to create secure network connection
advanced_config.AutoPosition=Automatic positioning
-advanced_config.AutoPosition_Title=Positioning
+advanced_config.Signature_Title=Signature
advanced_config.BKUSelection_Title=BKU Selection
advanced_config.OutputFolder=Default output folder\:
advanced_config.OutputFolder.Dialog=Select a folder