summaryrefslogtreecommitdiff
path: root/trunk/pdf-over-gui/src/main
diff options
context:
space:
mode:
authortkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:37:03 +0000
committertkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:37:03 +0000
commit19565007036e27e5b14f7572b0d4617b8649aa31 (patch)
treee16f2c82e427bb7c0260bed49708498c98d56496 /trunk/pdf-over-gui/src/main
parented1c8c73a53855920a3e91fb70334f49b7888138 (diff)
downloadpdf-over-19565007036e27e5b14f7572b0d4617b8649aa31.tar.gz
pdf-over-19565007036e27e5b14f7572b0d4617b8649aa31.tar.bz2
pdf-over-19565007036e27e5b14f7572b0d4617b8649aa31.zip
Remember sig pos when going back to positioning
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12767 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src/main')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java22
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java12
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java9
3 files changed, 38 insertions, 5 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index ff708e93..988965b3 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/trunk/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/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
index b7edb669..33afce4a 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
+++ b/trunk/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/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
index 9bf875fb..cd2e1907 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
+++ b/trunk/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);
}