summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java22
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java12
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java9
3 files changed, 38 insertions, 5 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 ff708e93..988965b3 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
@@ -70,15 +70,16 @@ public class PositioningComposite extends StateComposite {
private Composite mainArea = null;
- private Label lblPage = null;
+ Label lblPage = null;
+
+ ScrollBar scrollbar = null;
+
+ private SignaturePosition position = null;
int currentPage = 0;
int numPages = 0;
- private SignaturePosition position = null;
-
- ScrollBar scrollbar = null;
/**
* Create the composite.
@@ -282,7 +283,7 @@ public class PositioningComposite extends StateComposite {
PositioningComposite.this.scrollbar.setSelection(
PositioningComposite.this.currentPage);
PositioningComposite.this.lblPage.setText(String.format(
- "Page %d of %d",
+ "Page %d of %d", //$NON-NLS-1$
PositioningComposite.this.currentPage,
PositioningComposite.this.numPages));
}
@@ -326,6 +327,17 @@ public class PositioningComposite extends StateComposite {
}
/**
+ * Set the signature position
+ * @param x the horizontal signature position
+ * @param y the vertical signature position
+ * @param page the page the signature is on
+ */
+ public void setPosition(float x, float y, int page) {
+ showPage(page);
+ this.viewer.setSignaturePosition(x, y);
+ }
+
+ /**
* Get the signature position
* @return the signature position
*/
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 b7edb669..33afce4a 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
@@ -138,6 +138,7 @@ public class SignaturePanel extends JPanel {
public void setSignaturePlaceholderBorderColor(Color color) {
this.sigPlaceholderBorderColor = color;
}
+
/**
* Change the currently displayed page
* @param page the number of the page to display
@@ -157,6 +158,17 @@ public class SignaturePanel extends JPanel {
}
/**
+ * Set the signature placeholder position
+ * Call showPage afterwards to update actual position
+ * @param x the horizontal signature position
+ * @param y the vertical signature position
+ */
+ public void setSignaturePosition(float x, float y)
+ {
+ this.sigPagePos = new Point2D.Double(x, y);
+ }
+
+ /**
* Get the current horizontal position of the signature
* @return signature x coordinate
*/
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 9bf875fb..cd2e1907 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
@@ -30,6 +30,7 @@ import at.asit.pdfover.gui.workflow.Status;
import at.asit.pdfover.signator.Emblem;
import at.asit.pdfover.signator.FileNameEmblem;
import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signator.SignaturePosition;
/**
* Decides where to position the signature block
@@ -51,6 +52,8 @@ public class PositioningState extends State {
private PositioningComposite positionComposite = null;
+ private SignaturePosition previousPosition = null;
+
private PositioningComposite getPositioningComposite() throws IOException {
if (this.positionComposite == null) {
this.positionComposite =
@@ -67,6 +70,11 @@ public class PositioningState extends State {
param.getPlaceholderDimension().getWidth(),
param.getPlaceholderDimension().getHeight(),
this.stateMachine.getConfigProvider().getPlaceholderTransparency());
+ if (this.previousPosition != null)
+ this.positionComposite.setPosition(
+ this.previousPosition.getX(),
+ this.previousPosition.getY(),
+ this.previousPosition.getPage());
return this.positionComposite;
}
@@ -77,6 +85,7 @@ public class PositioningState extends State {
if (!(status.getPreviousState() instanceof PositioningState) &&
!(status.getPreviousState() instanceof OpenState))
{
+ this.previousPosition = status.getSignaturePosition();
status.setSignaturePosition(null);
}