summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-08 15:00:02 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-08 15:00:02 +0200
commitedcabbd3f6b9fc7d4697257d4f9c2e18dc7c9534 (patch)
treec4411b5c4af5703b529aefabc24ca8abfd922664 /pdf-over-gui
parent6c13dd46eabee023b9b852fa9e7897658017e4b8 (diff)
downloadpdf-over-edcabbd3f6b9fc7d4697257d4f9c2e18dc7c9534.tar.gz
pdf-over-edcabbd3f6b9fc7d4697257d4f9c2e18dc7c9534.tar.bz2
pdf-over-edcabbd3f6b9fc7d4697257d4f9c2e18dc7c9534.zip
remove placeholder transparency from config
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java17
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java23
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java3
7 files changed, 9 insertions, 54 deletions
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 7f21904b..e74c4e92 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
@@ -184,14 +184,12 @@ public class PositioningComposite extends StateComposite {
* 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(final Image placeholder, final int transparency) {
+ public void setPlaceholder(final Image placeholder) {
EventQueue.invokeLater(() -> {
if (this.viewer == null)
return;
- this.viewer.setSignaturePlaceholder(placeholder, transparency);
+ this.viewer.setSignaturePlaceholder(placeholder);
});
}
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 5cc1b749..87ec0c42 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
@@ -40,7 +40,6 @@ import org.apache.pdfbox.rendering.PDFRenderer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.commons.Messages;
/**
@@ -76,10 +75,6 @@ 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 = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY;
- /** 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 */
@@ -148,14 +143,12 @@ 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 transparency) {
+ public void setSignaturePlaceholder(Image placeholder) {
this.sigPlaceholder = placeholder;
// TODO figure out why this is divided by 4 (factor ported from old code)
this.sigPageWidth = placeholder.getWidth(null) / 4;
this.sigPageHeight = placeholder.getHeight(null) / 4;
- this.sigPlaceholderTransparency = transparency;
renderPageToImage();
repaint();
}
@@ -368,14 +361,12 @@ public class SignaturePanel extends JPanel {
else {
if (
((this.sigScreenWidth != this.prevSigScreenWidth) ||
- (this.sigScreenHeight != this.prevSigScreenHeight) ||
- (this.sigPlaceholderTransparency != this.prevSigPlaceholderTransparency)) &&
+ (this.sigScreenHeight != this.prevSigScreenHeight)) &&
((this.sigScreenWidth != 0) && (this.sigScreenHeight != 0)))
{
// 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);
@@ -384,12 +375,12 @@ public class SignaturePanel extends JPanel {
Graphics g_phs = this.sigPlaceholderScaled.getGraphics();
g_phs.drawImage(placeholder, 0, 0, null);
g_phs.dispose();
-
+
int[] phpixels = new int[this.sigScreenWidth * this.sigScreenHeight];
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(), this.sigPlaceholderTransparency);
+ c = new Color(c.getRed(), c.getGreen(), c.getBlue(), 170);
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/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
index 7316b91e..b98f4fda 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java
@@ -170,6 +170,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
SWTUtils.setFontHeight(lblTransparenzRechts, Constants.TEXT_SIZE_NORMAL);
this.sclTransparenz = new Scale(this.grpSignatur, SWT.HORIZONTAL);
+ this.sclTransparenz.setEnabled(false);
SWTUtils.anchor(sclTransparenz).right(lblTransparenzRechts, -5).top(lblTransparenz, 5).left(lblTransparenzLinks, 5).set();
this.sclTransparenz.setMinimum(0);
this.sclTransparenz.setMaximum(255);
@@ -179,7 +180,6 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
this.sclTransparenz.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- performPlaceholderTransparency(AdvancedConfigurationComposite.this.sclTransparenz.getSelection());
}
});
@@ -569,10 +569,6 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
}
}
- void performPlaceholderTransparency(int transparency) {
- this.configurationContainer.placeholderTransparency = transparency;
- }
-
void performUpdateCheckSelection(boolean checkUpdate) {
this.configurationContainer.updateCheck = checkUpdate;
this.btnUpdateCheck.setSelection(checkUpdate);
@@ -643,7 +639,6 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
this.configurationContainer.setUseSignatureFields(provider.getUseSignatureFields());
this.configurationContainer.enabledPlaceholderUsage = provider.getEnablePlaceholderUsage();
this.configurationContainer.signaturePDFACompat = provider.getSignaturePdfACompat();
- this.configurationContainer.placeholderTransparency = provider.getPlaceholderTransparency();
this.configurationContainer.defaultBKU = provider.getDefaultBKUPersistent();
this.configurationContainer.keystoreEnabled = provider.getKeyStoreEnabledPersistent();
@@ -690,7 +685,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
performUseMarkerSelection(this.configurationContainer.getUseMarker());
performUseSignatureFieldsSelection(this.configurationContainer.getUseSignatureFields());
performEnableUsePlaceholder(this.configurationContainer.enabledPlaceholderUsage);
- this.sclTransparenz.setSelection(this.configurationContainer.placeholderTransparency);
+ this.sclTransparenz.setSelection(170); // TODO REPLACE WITH SIGNATURE SCALE
performLocaleSelectionChanged(this.configurationContainer.interfaceLocale);
performPdfACompatSelection(this.configurationContainer.signaturePDFACompat);
performKeystoreEnabledSelection(this.configurationContainer.keystoreEnabled);
@@ -734,7 +729,6 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
store.setUseSignatureFieldsPersistent(this.configurationContainer.getUseSignatureFields());
store.setEnablePlaceholderUsagePersistent(this.configurationContainer.enabledPlaceholderUsage);
store.setSignaturePdfACompatPersistent(this.configurationContainer.signaturePDFACompat);
- store.setPlaceholderTransparency(this.configurationContainer.placeholderTransparency);
store.setDefaultBKUPersistent(this.configurationContainer.defaultBKU);
store.setKeyStoreEnabledPersistent(this.configurationContainer.keystoreEnabled);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
index 19bbace0..167d50ea 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
@@ -31,7 +31,6 @@ import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java
index 39d557c5..51b48c09 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java
@@ -111,9 +111,6 @@ public class ConfigurationDataInMemory {
/** Holds the proxy password */
public String proxyPass = null;
- /** Holds the transparency of the signature placeholder */
- public int placeholderTransparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY;
-
/** Holds the default BKU to use */
public BKUs defaultBKU = BKUs.NONE;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
index 25353ac4..f9981878 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
@@ -186,19 +186,6 @@ public class ConfigurationManager {
}
setDefaultBKUPersistent(defaultBKU);
- // Set Signature placeholder transparency
- int transparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY;
- String trans = diskConfig.getProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY);
- if (trans != null) {
- try {
- transparency = Integer.parseInt(trans);
- } catch (NumberFormatException e) {
- log.debug("Couldn't parse placeholder transparency", e);
- // ignore parsing exception
- }
- }
- setPlaceholderTransparency(transparency);
-
// Set MainWindow size
int width = Constants.DEFAULT_MAINWINDOW_WIDTH;
int height = Constants.DEFAULT_MAINWINDOW_HEIGHT;
@@ -289,8 +276,6 @@ public class ConfigurationManager {
props.setProperty(Constants.CFG_MOBILE_PASSWORD_REMEMBER, Constants.TRUE);
props.setProperty(Constants.CFG_OUTPUT_FOLDER, getDefaultOutputFolderPersistent());
props.setProperty(Constants.CFG_POSTFIX, getSaveFilePostFix());
- props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY,
- Integer.toString(getPlaceholderTransparency()));
Point size = this.configuration.mainWindowSize;
props.setProperty(Constants.CFG_MAINWINDOW_SIZE, size.x + "," + size.y);
@@ -428,14 +413,6 @@ public class ConfigurationManager {
return this.configuration.autoPositionSignature;
}
- public void setPlaceholderTransparency(int transparency) {
- this.configuration.placeholderTransparency = transparency;
- }
-
- public int getPlaceholderTransparency() {
- return this.configuration.placeholderTransparency;
- }
-
public void setDefaultMobileNumberPersistent(String number) {
if (number == null || number.trim().isEmpty()) {
this.configuration.setMobileNumber(STRING_EMPTY);
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 1a4767dd..1f23f0ba 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
@@ -120,8 +120,7 @@ public class PositioningState extends State {
PdfAs4SignaturePlaceholder.For(param, (p) -> {
this.positionComposite.setPlaceholder(
- p.getAWTImage(),
- config.getPlaceholderTransparency());
+ p.getAWTImage());
});
if (this.previousPosition != null && !this.previousPosition.useAutoPositioning())