View Javadoc

1   package org.eparapher.rcp.wizards;
2   
3   import org.apache.log4j.Logger;
4   import org.eclipse.jface.viewers.IStructuredSelection;
5   import org.eclipse.jface.wizard.Wizard;
6   import org.eclipse.ui.INewWizard;
7   import org.eclipse.ui.IWorkbench;
8   import org.eclipse.ui.IWorkbenchWindow;
9   import org.eparapher.core.signature.PDFSignatureParameters;
10  
11  public class PDFSigningWizard extends Wizard implements INewWizard {
12  	
13  	private static Logger log = Logger.getLogger(PDFSigningWizard.class);
14  
15  	/** The window */
16  	private IWorkbenchWindow window;
17  	
18  	private PDFSigningWizardPageOne   one;
19  	private PDFSigningWizardPageTwo two;
20  	private PDFSigningWizardPageThree  three;
21  	private PDFSigningWizardPageFour  four;
22  
23  	private PDFSignatureParameters pdfsignatureparams;
24  	
25  	public boolean performFinish() {
26  
27  		pdfsignatureparams.setFileSelectiontoSign(one.getFiles2Process());
28  		
29  		pdfsignatureparams.setSignatureAlias(two.getSelectedSignatureCertificateAlias());
30  
31  		pdfsignatureparams.setFormat( three.getSignatureFormat() );
32  		pdfsignatureparams.setDocCert( three.getDocumentCertification() );
33  		pdfsignatureparams.setMultipleSignature( three.isMultipleSignature() );
34  		pdfsignatureparams.setVisibleSignature( three.isVisibleSignature() );
35  		pdfsignatureparams.setVisibleSignature( three.canFlipToNextPage() );
36  
37  		pdfsignatureparams.setLocation( four.getLocation() );
38  		pdfsignatureparams.setReason( four.getReason() );
39  		//pdfsignatureparams.setInsertTimestamp(three.getIsTimestamped);
40  	    //pdfsignatureparams.setInsertCRLs(three.get);
41  		
42  		return true;
43  		
44  	}
45  
46  	public PDFSigningWizard() {
47  		super();
48  		setNeedsProgressMonitor(true);
49  		setWindowTitle("PDF Signature settings");
50  		pdfsignatureparams = new PDFSignatureParameters();
51  		pdfsignatureparams.setPdfsignatureParamsFromPreferences();
52  	}
53  
54  	public PDFSigningWizard(PDFSignatureParameters pdfsp) {
55  		this();
56  		pdfsignatureparams = pdfsp;
57  	}
58  	
59  	public void addPages() {
60  
61  		one   = new PDFSigningWizardPageOne(pdfsignatureparams);
62  		two   = new PDFSigningWizardPageTwo(pdfsignatureparams);
63  		three = new PDFSigningWizardPageThree(pdfsignatureparams);
64  		four  = new PDFSigningWizardPageFour(pdfsignatureparams);
65  
66  		addPage(one);
67  		addPage(two);
68  		addPage(three);
69  		addPage(four);
70  
71  	}
72  	public PDFSignatureParameters getPdfsignatureparams() {
73  		return pdfsignatureparams;
74  	}
75  
76  	public void init(IWorkbench workbench, IStructuredSelection selection) {
77          window = workbench.getActiveWorkbenchWindow();
78  	}
79  	
80  }