View Javadoc

1   package org.eparapher.rcp.wizards;
2   
3   import org.eclipse.jface.wizard.IWizardPage;
4   import org.eclipse.jface.wizard.WizardPage;
5   import org.eclipse.swt.SWT;
6   import org.eclipse.swt.layout.GridData;
7   import org.eclipse.swt.layout.GridLayout;
8   import org.eclipse.swt.widgets.Button;
9   import org.eclipse.swt.widgets.Combo;
10  import org.eclipse.swt.widgets.Composite;
11  import org.eclipse.swt.widgets.Label;
12  import org.eparapher.core.signature.PDFSignatureParameters;
13  import org.eparapher.rcp.tools.GUIIcons;
14  
15  
16  
17  public class PDFSigningWizardPageThree extends WizardPage implements IWizardPage {
18  
19  	private Combo format;
20  	private Combo Certification;
21  	private Button allowMultipleSignature;
22  	private Button visibleSignature;
23  	
24  	private Composite container;
25  
26  	private PDFSignatureParameters pdfsignatureparams;
27  
28  	//http://www.eclipse.org/swt/widgets/
29  	
30  	protected PDFSigningWizardPageThree(PDFSignatureParameters mpdfsignatureparams) {
31  		super("PDF Signing");
32  		setTitle("PDF Signing Wizard Page 3/4");
33  		setDescription("This wizard helps you configuring your PDF Signature Format.");
34  		setImageDescriptor(GUIIcons.WIZARD_SIGN_IMG);
35  		pdfsignatureparams = mpdfsignatureparams;
36  	}
37  	
38  	public void createControl(Composite parent) {
39  		//parent.setLayoutData(new GridData(GridData.FILL_BOTH));
40  		container = new Composite(parent, SWT.NULL);
41  		container.setLayout(new GridLayout(2,false));
42  		container.setLayoutData(new GridData(GridData.FILL_BOTH));
43  
44  		Label labelFormat = new Label(container, SWT.NULL);
45  		labelFormat.setText("Signature Format : ");
46  		labelFormat.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
47  		format = new Combo(container, SWT.READ_ONLY |SWT.BORDER);
48  		format.setItems(PDFSignatureParameters.FORMAT_ITEMS);
49  		format.select(pdfsignatureparams.getFormatasInt());
50  		format.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
51  		
52  		Label labelCertification = new Label(container, SWT.NULL);
53  		labelCertification.setText("Certify the document : ");
54  		labelCertification.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
55  		Certification = new Combo(container, SWT.READ_ONLY |SWT.BORDER);
56  		Certification.setItems(PDFSignatureParameters.DOCUMENT_CERTIFS_ITEMS);
57  		Certification.select(pdfsignatureparams.getDocCert());
58  		Certification.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
59  		
60  		Label labelMultiSign = new Label(container, SWT.NULL);
61  		labelMultiSign.setText("Multiple Signature : ");
62  		labelMultiSign.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
63  		allowMultipleSignature = new Button(container, SWT.CHECK);
64  		allowMultipleSignature.setToolTipText("erase other signatures if not checked");
65  		allowMultipleSignature.setSelection (pdfsignatureparams.isMultipleSignature());
66  		
67  		Label labelVisibleSign = new Label(container, SWT.NULL);
68  		labelVisibleSign.setText("Visible Signature in doc: ");
69  		labelVisibleSign.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
70  		visibleSignature = new Button(container, SWT.CHECK);
71  		visibleSignature.setToolTipText("Visible signature in the document");
72  		visibleSignature.setSelection (pdfsignatureparams.isVisibleSignature());
73  		
74  		
75  		// Required to avoid an error in the system
76  		setControl(container);
77  		setPageComplete(true);
78  	}
79  
80  	public boolean isMultipleSignature() {
81  		return allowMultipleSignature.getSelection();
82  	}
83  	
84  	public boolean isVisibleSignature() {
85  		return visibleSignature.getSelection();
86  	}
87  	
88  	public int getSignatureFormat() {
89  		return format.getSelectionIndex();
90  	}
91  	
92  	public int getDocumentCertification() {
93  		return Certification.getSelectionIndex();
94  	}
95      public boolean canFinish() {
96          return false;
97      }
98  }