pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1577050 - in /pdfbox/trunk: examples/src/main/java/org/apache/pdfbox/examples/fdf/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/ pdfbox/src/main/java/or...
Date Thu, 13 Mar 2014 07:29:36 GMT
Author: jahewson
Date: Thu Mar 13 07:29:36 2014
New Revision: 1577050

URL: http://svn.apache.org/r1577050
Log:
PDFBOX-1982: Standardise AcroForm Fields

Added:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
      - copied, changed from r1577032, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignature.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java
      - copied, changed from r1577032, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDText.java
Removed:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignature.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDText.java
Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAppearanceString.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/fdf/PrintFields.java Thu
Mar 13 07:29:36 2014
@@ -26,7 +26,7 @@ import org.apache.pdfbox.pdmodel.common.
 import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
-import org.apache.pdfbox.pdmodel.interactive.form.PDSignature;
+import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
  * This example will take a PDF document and print all the fields from the file.
@@ -85,10 +85,10 @@ public class PrintFields
         else
         {
             String fieldValue = null;
-            if (field instanceof PDSignature)
+            if (field instanceof PDSignatureField)
             {
-                // PDSignature doesn't have a value
-                fieldValue = "PDSignature";
+                // PDSignatureField doesn't have a value
+                fieldValue = "PDSignatureField";
             }
             else
             {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Thu Mar 13
07:29:36 2014
@@ -64,7 +64,7 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
-import org.apache.pdfbox.pdmodel.interactive.form.PDSignature;
+import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
  * This is the in-memory representation of the PDF document. You need to call close() on
this object when you are done
@@ -259,7 +259,7 @@ public class PDDocument implements Close
     /**
      * Add a signature.
      * 
-     * @param sigObject is the PDSignature model
+     * @param sigObject is the PDSignatureField model
      * @param signatureInterface is a interface which provides signing capabilities
      * @throws IOException if there is an error creating required fields
      */
@@ -273,7 +273,7 @@ public class PDDocument implements Close
     /**
      * This will add a signature to the document.
      * 
-     * @param sigObject is the PDSignature model
+     * @param sigObject is the PDSignatureField model
      * @param signatureInterface is a interface which provides signing capabilities
      * @param options signature options
      * @throws IOException if there is an error creating required fields
@@ -354,7 +354,7 @@ public class PDDocument implements Close
         List<PDAnnotation> annotations = page.getAnnotations();
 
         List<PDField> fields = acroForm.getFields();
-        PDSignature signatureField = null;
+        PDSignatureField signatureField = null;
         if(fields == null) 
         {
             fields = new ArrayList();
@@ -362,18 +362,18 @@ public class PDDocument implements Close
         }
         for (PDField pdField : fields)
         {
-            if (pdField instanceof PDSignature)
+            if (pdField instanceof PDSignatureField)
             {
-                org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature signature
= ((PDSignature) pdField).getSignature();
+                org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature signature
= ((PDSignatureField) pdField).getSignature();
                 if (signature != null && signature.getDictionary().equals(sigObject.getDictionary()))
                 {
-                    signatureField = (PDSignature) pdField;
+                    signatureField = (PDSignatureField) pdField;
                 }
             }
         }
         if (signatureField == null)
         {
-            signatureField = new PDSignature(acroForm);
+            signatureField = new PDSignatureField(acroForm);
             signatureField.setSignature(sigObject); // append the signature object
             signatureField.getWidget().setPage(page); // backward linking
         }
@@ -387,9 +387,9 @@ public class PDDocument implements Close
         boolean checkFields = false;
         for (PDField field : acroFormFields)
         {
-            if (field instanceof PDSignature)
+            if (field instanceof PDSignatureField)
             {
-                if (((PDSignature) field).getCOSObject().equals(signatureField.getCOSObject()))
+                if (((PDSignatureField) field).getCOSObject().equals(signatureField.getCOSObject()))
                 {
                     checkFields = true;
                     signatureField.getCOSObject().setNeedToBeUpdate(true);
@@ -510,7 +510,7 @@ public class PDDocument implements Close
      * @param options signature options
      * @throws IOException if there is an error creating required fields
      */
-    public void addSignatureField(List<PDSignature> sigFields, SignatureInterface signatureInterface,
+    public void addSignatureField(List<PDSignatureField> sigFields, SignatureInterface
signatureInterface,
             SignatureOptions options) throws IOException
     {
         PDDocumentCatalog catalog = getDocumentCatalog();
@@ -537,7 +537,7 @@ public class PDDocument implements Close
 
         List<PDField> field = acroForm.getFields();
 
-        for (PDSignature sigField : sigFields)
+        for (PDSignatureField sigField : sigFields)
         {
             org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature sigObject
= sigField.getSignature();
             sigField.getCOSObject().setNeedToBeUpdate(true);
@@ -546,9 +546,9 @@ public class PDDocument implements Close
             boolean checkFields = false;
             for (Object obj : field)
             {
-                if (obj instanceof PDSignature)
+                if (obj instanceof PDSignatureField)
                 {
-                    if (((PDSignature) obj).getCOSObject().equals(sigField.getCOSObject()))
+                    if (((PDSignatureField) obj).getCOSObject().equals(sigField.getCOSObject()))
                     {
                         checkFields = true;
                         sigField.getCOSObject().setNeedToBeUpdate(true);
@@ -796,7 +796,7 @@ public class PDDocument implements Close
     /**
      * This will return the last signature.
      * 
-     * @return the last signature as <code>PDSignature</code>.
+     * @return the last signature as <code>PDSignatureField</code>.
      * @throws IOException if no document catalog can be found.
      */
     public org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature getLastSignatureDictionary()
throws IOException
@@ -813,19 +813,19 @@ public class PDDocument implements Close
     /**
      * Retrieve all signature fields from the document.
      * 
-     * @return a <code>List</code> of <code>PDSignature</code>s
+     * @return a <code>List</code> of <code>PDSignatureField</code>s
      * @throws IOException if no document catalog can be found.
      */
-    public List<PDSignature> getSignatureFields() throws IOException
+    public List<PDSignatureField> getSignatureFields() throws IOException
     {
-        List<PDSignature> fields = new LinkedList<PDSignature>();
+        List<PDSignatureField> fields = new LinkedList<PDSignatureField>();
         PDAcroForm acroForm = getDocumentCatalog().getAcroForm();
         if (acroForm != null)
         {
             List<COSDictionary> signatureDictionary = document.getSignatureFields(false);
             for (COSDictionary dict : signatureDictionary)
             {
-                fields.add(new PDSignature(acroForm, dict));
+                fields.add(new PDSignatureField(acroForm, dict));
             }
         }
         return fields;
@@ -834,7 +834,7 @@ public class PDDocument implements Close
     /**
      * Retrieve all signature dictionaries from the document.
      * 
-     * @return a <code>List</code> of <code>PDSignature</code>s
+     * @return a <code>List</code> of <code>PDSignatureField</code>s
      * @throws IOException if no document catalog can be found.
      */
     public List<org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature>
getSignatureDictionaries() throws IOException

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateBuilder.java
Thu Mar 13 07:29:36 2014
@@ -29,7 +29,7 @@ import org.apache.pdfbox.pdmodel.common.
 import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
 import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
-import org.apache.pdfbox.pdmodel.interactive.form.PDSignature;
+import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
  * That class builds visible signature template
@@ -72,13 +72,13 @@ public interface PDFTemplateBuilder {
 	public void createSignatureField(PDAcroForm acroForm) throws IOException;
 	
 	/**
-	 * Creates PDSignature
+	 * Creates PDSignatureField
 	 * @param pdSignatureField
 	 * @param page
 	 * @param signatureName
 	 * @throws IOException
 	 */
-	public void createSignature(PDSignature pdSignatureField, PDPage page, String signatureName)
throws IOException;
+	public void createSignature(PDSignatureField pdSignatureField, PDPage page, String signatureName)
throws IOException;
 	
 	/**
 	 * Create AcroForm Dictionary
@@ -86,7 +86,7 @@ public interface PDFTemplateBuilder {
 	 * @param signatureField
 	 * @throws IOException
 	 */
-	public void createAcroFormDictionary(PDAcroForm acroForm, PDSignature signatureField) throws
IOException;
+	public void createAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField)
throws IOException;
 	
 	/**
 	 * Creates SingatureRectangle
@@ -94,7 +94,7 @@ public interface PDFTemplateBuilder {
 	 * @param properties
 	 * @throws IOException
 	 */
-	public void createSignatureRectangle(PDSignature signatureField, PDVisibleSignDesigner properties)
throws IOException;
+	public void createSignatureRectangle(PDSignatureField signatureField, PDVisibleSignDesigner
properties) throws IOException;
 	
 	/**
 	 * Creates procSetArray of PDF,Text,ImageB,ImageC,ImageI    
@@ -140,7 +140,7 @@ public interface PDFTemplateBuilder {
 	 * @param signatureField
 	 * @throws IOException
 	 */
-	public void createAppearanceDictionary(PDFormXObject holderForml, PDSignature signatureField)
throws IOException;
+	public void createAppearanceDictionary(PDFormXObject holderForml, PDSignatureField signatureField)
throws IOException;
 	
 	/**
 	 * 
@@ -232,7 +232,7 @@ public interface PDFTemplateBuilder {
 	 * @param holderFormResources
 	 * @throws IOException
 	 */
-	public void createWidgetDictionary(PDSignature signatureField, PDResources holderFormResources)
throws IOException;
+	public void createWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources)
throws IOException;
 	
 	/**
 	 * 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
Thu Mar 13 07:29:36 2014
@@ -30,7 +30,7 @@ import org.apache.pdfbox.pdmodel.common.
 import org.apache.pdfbox.pdmodel.common.PDStream;
 import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
-import org.apache.pdfbox.pdmodel.interactive.form.PDSignature;
+import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
  * Using that class, we  build pdf template
@@ -90,7 +90,7 @@ public class PDFTemplateCreator
 
         // AcroForm contains singature fields
         this.pdfBuilder.createSignatureField(acroForm);
-        PDSignature pdSignatureField = pdfStructure.getSignatureField();
+        PDSignatureField pdSignatureField = pdfStructure.getSignatureField();
         
         // create signature
         this.pdfBuilder.createSignature(pdSignatureField, page, properties.getSignatureFieldName());

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java
Thu Mar 13 07:29:36 2014
@@ -36,7 +36,7 @@ import org.apache.pdfbox.pdmodel.graphic
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
-import org.apache.pdfbox.pdmodel.interactive.form.PDSignature;
+import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
  * Structure of PDF document with visible signature
@@ -49,7 +49,7 @@ public class PDFTemplateStructure
     private PDPage page;
     private PDDocument template;
     private PDAcroForm acroForm;
-    private PDSignature signatureField;
+    private PDSignatureField signatureField;
     private org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature pdSignature;
     private COSDictionary acroFormDictionary;
     private PDRectangle singatureRectangle;
@@ -136,7 +136,7 @@ public class PDFTemplateStructure
      * Gets Signature field
      * @return
      */
-    public PDSignature getSignatureField()
+    public PDSignatureField getSignatureField()
     {
         return signatureField;
     }
@@ -145,13 +145,13 @@ public class PDFTemplateStructure
      * Sets signature field
      * @param signatureField
      */
-    public void setSignatureField(PDSignature signatureField)
+    public void setSignatureField(PDSignatureField signatureField)
     {
         this.signatureField = signatureField;
     }
 
     /**
-     * Gets PDSignature
+     * Gets PDSignatureField
      * @return
      */
     public org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature getPdSignature()
@@ -160,7 +160,7 @@ public class PDFTemplateStructure
     }
 
     /**
-     * Sets PDSignature
+     * Sets PDSignatureField
      * @param pdSignature
      */
     public void setPdSignature(org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature
pdSignature)

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
Thu Mar 13 07:29:36 2014
@@ -39,7 +39,7 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
-import org.apache.pdfbox.pdmodel.interactive.form.PDSignature;
+import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
  * That's implementation of <b>PDFTemplateBuilder </b>
@@ -95,13 +95,13 @@ public class PDVisibleSigBuilder impleme
     @Override
     public void createSignatureField(PDAcroForm acroForm) throws IOException
     {
-        PDSignature sf = new PDSignature(acroForm);
+        PDSignatureField sf = new PDSignatureField(acroForm);
         pdfStructure.setSignatureField(sf);
         logger.info("Signature field has been created");
     }
 
     @Override
-    public void createSignature(PDSignature pdSignatureField, PDPage page, String signatureName)
+    public void createSignature(PDSignatureField pdSignatureField, PDPage page, String signatureName)
             throws IOException
     {
         org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature pdSignature =
new org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature();
@@ -116,7 +116,7 @@ public class PDVisibleSigBuilder impleme
     }
 
     @Override
-    public void createAcroFormDictionary(PDAcroForm acroForm, PDSignature signatureField)
throws IOException
+    public void createAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField)
throws IOException
     {
         @SuppressWarnings("unchecked")
         List<PDField> acroFormFields = acroForm.getFields();
@@ -131,7 +131,7 @@ public class PDVisibleSigBuilder impleme
     }
 
     @Override
-    public void createSignatureRectangle(PDSignature signatureField, PDVisibleSignDesigner
properties)
+    public void createSignatureRectangle(PDSignatureField signatureField, PDVisibleSignDesigner
properties)
             throws IOException
     {
 
@@ -220,7 +220,7 @@ public class PDVisibleSigBuilder impleme
     }
 
     @Override
-    public void createAppearanceDictionary(PDFormXObject holderForml, PDSignature signatureField)
+    public void createAppearanceDictionary(PDFormXObject holderForml, PDSignatureField signatureField)
             throws IOException
     {
 
@@ -371,7 +371,7 @@ public class PDVisibleSigBuilder impleme
     }
 
     @Override
-    public void createWidgetDictionary(PDSignature signatureField, PDResources holderFormResources)
+    public void createWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources)
             throws IOException
     {
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAppearanceString.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAppearanceString.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAppearanceString.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAppearanceString.java
Thu Mar 13 07:29:36 2014
@@ -374,18 +374,18 @@ public final class PDAppearanceString
         }
         printWriter.println( getTextPosition( boundingBox, pdFont, fontSize, tokens ) );
         int q = getQ();
-        if( q == PDText.QUADDING_LEFT )
+        if( q == PDTextField.QUADDING_LEFT )
         {
             //do nothing because left is default
         }
-        else if( q == PDText.QUADDING_CENTERED ||
-                 q == PDText.QUADDING_RIGHT )
+        else if( q == PDTextField.QUADDING_CENTERED ||
+                 q == PDTextField.QUADDING_RIGHT )
         {
             float fieldWidth = boundingBox.getWidth();
             float stringWidth = (pdFont.getStringWidth( value )/1000)*fontSize;
             float adjustAmount = fieldWidth - stringWidth - 4;
 
-            if( q == PDText.QUADDING_CENTERED )
+            if( q == PDTextField.QUADDING_CENTERED )
             {
                 adjustAmount = adjustAmount/2.0f;
             }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java
Thu Mar 13 07:29:36 2014
@@ -87,11 +87,11 @@ public final class PDFieldFactory
         }
         else if ("Tx".equals(fieldType))
         {
-            return new PDText(form, field);
+            return new PDTextField(form, field);
         }
         else if ("Sig".equals(fieldType))
         {
-            return new PDSignature(form, field);
+            return new PDSignatureField(form, field);
         }
         else
         {

Copied: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
(from r1577032, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignature.java)
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java?p2=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java&p1=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignature.java&r1=1577032&r2=1577050&rev=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignature.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
Thu Mar 13 07:29:36 2014
@@ -33,7 +33,7 @@ import java.util.Set;
  * @author Ben Litchfield
  * @author Thomas Chojecki
  */
-public class PDSignature extends PDField
+public class PDSignatureField extends PDField
 {
     /**
      * @see PDField#PDField(PDAcroForm,COSDictionary)
@@ -42,7 +42,7 @@ public class PDSignature extends PDField
      * @param field The dictionary for the signature.
      * @throws IOException If there is an error while resolving partital name for the signature
field
      */
-    public PDSignature(PDAcroForm theAcroForm, COSDictionary field) throws IOException
+    public PDSignatureField(PDAcroForm theAcroForm, COSDictionary field) throws IOException
     {
         super(theAcroForm,field);
         // dirty hack to avoid npe caused through getWidget() method
@@ -57,7 +57,7 @@ public class PDSignature extends PDField
      * @throws IOException If there is an error while resolving partial name for the signature
field
      *         or getting the widget object.
      */
-    public PDSignature(PDAcroForm theAcroForm) throws IOException
+    public PDSignatureField(PDAcroForm theAcroForm) throws IOException
     {
         super( theAcroForm );
         getDictionary().setItem(COSName.FT, COSName.SIG);
@@ -85,9 +85,9 @@ public class PDSignature extends PDField
       
       for ( Object object : fields )
       {
-        if(object instanceof PDSignature)
+        if(object instanceof PDSignatureField)
         {
-          sigNames.add(((PDSignature) object).getPartialName());
+          sigNames.add(((PDSignatureField) object).getPartialName());
         }
       }
 
@@ -104,13 +104,13 @@ public class PDSignature extends PDField
      * @param value The new value for the field.
      *
      * @throws IOException If there is an error creating the appearance stream.
-     * @deprecated use setSignature(PDSignature) instead
+     * @deprecated use setSignature(PDSignatureField) instead
      */
     @Override
     @Deprecated
     public void setValue(String value) throws IOException
     {
-        throw new RuntimeException( "Can't set signature as String, use setSignature(PDSignature)
instead" );
+        throw new RuntimeException( "Can't set signature as String, use setSignature(PDSignatureField)
instead" );
     }
 
     /**
@@ -136,13 +136,13 @@ public class PDSignature extends PDField
     @Override
     public String toString()
     {
-        return "PDSignature";
+        return "PDSignatureField";
     }
     
     /**
      * Add a signature dictionary to the signature field.
      * 
-     * @param value is the PDSignature 
+     * @param value is the PDSignatureField
      */
     public void setSignature(org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature
value)
     {

Copied: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java
(from r1577032, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDText.java)
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java?p2=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java&p1=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDText.java&r1=1577032&r2=1577050&rev=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDText.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java
Thu Mar 13 07:29:36 2014
@@ -25,14 +25,14 @@ import org.apache.pdfbox.cos.COSName;
  *
  * @author sug
  */
-public final class PDText extends PDVariableText
+public final class PDTextField extends PDVariableText
 {
     /**
      * @see PDField#PDField(PDAcroForm,COSDictionary)
      *
      * @param theAcroForm The acroform.
      */
-    public PDText(PDAcroForm theAcroForm)
+    public PDTextField(PDAcroForm theAcroForm)
     {
         super( theAcroForm );
     }
@@ -43,7 +43,7 @@ public final class PDText extends PDVari
      * @param theAcroForm The acroForm for this field.
      * @param field The field's dictionary.
      */
-    public PDText(PDAcroForm theAcroForm, COSDictionary field)
+    public PDTextField(PDAcroForm theAcroForm, COSDictionary field)
     {
         super( theAcroForm, field);
     }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java Thu Mar 13 07:29:36
2014
@@ -35,7 +35,7 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
 import org.apache.pdfbox.pdmodel.interactive.form.PDRadioButton;
-import org.apache.pdfbox.pdmodel.interactive.form.PDText;
+import org.apache.pdfbox.pdmodel.interactive.form.PDTextField;
 
 /**
  * This will test the FDF algorithms in PDFBox.
@@ -98,7 +98,7 @@ public class TestFDF extends TestCase
             {
                 fdeb = PDDocument.load( filePDF );
                 PDAcroForm form = fdeb.getDocumentCatalog().getAcroForm();
-                PDText field = (PDText)form.getField( "f67_1" );
+                PDTextField field = (PDTextField)form.getField( "f67_1" );
                 field.setValue( "2" );
     
                 String expected =
@@ -139,7 +139,7 @@ public class TestFDF extends TestCase
             {
                 fdeb = PDDocument.load( filePDF );
                 PDAcroForm form = fdeb.getDocumentCatalog().getAcroForm();
-                PDText feld2 = (PDText)form.getField( "Feld.2" );
+                PDTextField feld2 = (PDTextField)form.getField( "Feld.2" );
                 feld2.setValue( "Benjamin" );
     
                 String expected =
@@ -214,7 +214,7 @@ public class TestFDF extends TestCase
                 fdf = FDFDocument.load( fileFDF );
                 PDAcroForm form = freedom.getDocumentCatalog().getAcroForm();
                 form.importFDF( fdf );
-                PDText feld2 = (PDText)form.getField( "eeFirstName" );
+                PDTextField feld2 = (PDTextField)form.getField( "eeFirstName" );
                 List kids = feld2.getKids();
                 PDField firstKid = (PDField)kids.get( 0 );
                 PDField secondKid = (PDField)kids.get( 1 );

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java?rev=1577050&r1=1577049&r2=1577050&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java
Thu Mar 13 07:29:36 2014
@@ -77,7 +77,7 @@ public class TestFields extends TestCase
         {
             doc = new PDDocument();
             PDAcroForm form = new PDAcroForm( doc );
-            PDText textBox = new PDText(form);
+            PDTextField textBox = new PDTextField(form);
 
             //assert that default is false.
             assertFalse( textBox.shouldComb() );



Mime
View raw message