summaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authortkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-08-24 17:06:04 +0000
committertkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-08-24 17:06:04 +0000
commita923be0d995d25e6db9734ba053b64e14459d0c6 (patch)
tree26c86e1833068a892aad1b3c7ad073758bf93630 /trunk
parente21b53f404f0a9f1c911dd19d15e9843e868731a (diff)
downloadpdf-over-a923be0d995d25e6db9734ba053b64e14459d0c6.tar.gz
pdf-over-a923be0d995d25e6db9734ba053b64e14459d0c6.tar.bz2
pdf-over-a923be0d995d25e6db9734ba053b64e14459d0c6.zip
Display PDF Document
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12408 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java39
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java22
2 files changed, 48 insertions, 13 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 da18bb49..559c6b26 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
@@ -16,12 +16,17 @@
package at.asit.pdfover.gui.composites;
// Imports
+import java.io.File;
+import java.io.IOException;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
+import org.icepdf.core.exceptions.PDFException;
+import org.icepdf.core.exceptions.PDFSecurityException;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.SignaturePosition;
@@ -32,6 +37,22 @@ import at.asit.pdfover.signator.SignaturePosition;
*/
public class PositioningComposite extends StateComposite {
+ private PDFViewerComposite viewer = null;
+
+ /**
+ * Set the PDF Document to display
+ * @param document document to display
+ * @throws PDFException Error parsing PDF document
+ * @throws PDFSecurityException Error decrypting PDF document (not supported)
+ * @throws IOException I/O Error
+ */
+ public void displayDocument(File document) throws PDFException, PDFSecurityException, IOException {
+ if (this.viewer == null)
+ this.viewer = new PDFViewerComposite(this, SWT.EMBEDDED | SWT.NO_BACKGROUND, document);
+ else
+ this.viewer.setDocument(document);
+ }
+
/**
* Selection listener when position was fixed
*/
@@ -76,16 +97,12 @@ public class PositioningComposite extends StateComposite {
*/
public PositioningComposite(Composite parent, int style, State state) {
super(parent, style, state);
-
-
- Label test = new Label(this, SWT.NATIVE);
- test.setBounds(10, 20, 100, 30);
- test.setText("POSITIONING ---- TODO!!");
-
- Button btn_position = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_position.setBounds(10, 50, 100, 30);
- btn_position.setText("FAKE Position");
- btn_position.addSelectionListener(new PositionSelectedListener());
+ this.setLayout(new FillLayout());
+
+// Button btn_position = new Button(this, SWT.NATIVE | SWT.RESIZE);
+// btn_position.setBounds(10, 50, 100, 30);
+// btn_position.setText("FAKE Position");
+// btn_position.addSelectionListener(new PositionSelectedListener());
}
@Override
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 1d98ae18..1c45b2b5 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
@@ -16,7 +16,11 @@
package at.asit.pdfover.gui.workflow.states;
//Imports
+import java.io.IOException;
+
import org.eclipse.swt.SWT;
+import org.icepdf.core.exceptions.PDFException;
+import org.icepdf.core.exceptions.PDFSecurityException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,10 +51,12 @@ public class PositioningState extends State {
private PositioningComposite positionComposite = null;
- private PositioningComposite getPositioningComposite() {
+ private PositioningComposite getPositioningComposite() throws PDFException, PDFSecurityException, IOException {
if (this.positionComposite == null) {
this.positionComposite =
this.stateMachine.getGUIProvider().createComposite(PositioningComposite.class, SWT.RESIZE, this);
+ log.debug("Displaying " + stateMachine.getStatus().getDocument());
+ this.positionComposite.displayDocument(this.stateMachine.getStatus().getDocument());
}
return this.positionComposite;
@@ -67,7 +73,19 @@ public class PositioningState extends State {
if(status.getSignaturePosition() == null) {
- PositioningComposite position = this.getPositioningComposite();
+ PositioningComposite position = null;
+ try {
+ position = this.getPositioningComposite();
+ } catch (PDFException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (PDFSecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
this.stateMachine.getGUIProvider().display(position);