You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ja...@apache.org on 2015/05/14 19:45:44 UTC

svn commit: r1679413 [2/2] - in /pdfbox/trunk: examples/src/main/java/org/apache/pdfbox/examples/fdf/ pdfbox/src/main/java/org/apache/pdfbox/cos/ pdfbox/src/main/java/org/apache/pdfbox/multipdf/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/ pdfbox/sr...

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDNonTerminalField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDNonTerminalField.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDNonTerminalField.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDNonTerminalField.java Thu May 14 17:45:43 2015
@@ -28,41 +28,37 @@ import org.apache.pdfbox.cos.COSName;
  * 
  * The attributes such as FT (field type) or V (field value) do not logically
  * belong to the non terminal field but are inheritable attributes
- * for descendant terminal fields. 
- * 
+ * for descendant terminal fields.
  */
-public class PDNonTerminalField extends PDFieldTreeNode
+public class PDNonTerminalField extends PDField
 {
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      */
-    public PDNonTerminalField(PDAcroForm theAcroForm)
+    public PDNonTerminalField(PDAcroForm acroForm)
     {
-        super(theAcroForm);
+        super(acroForm);
     }
 
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
+     * @param parent the parent node of the node to be created
      */
-    public PDNonTerminalField(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
+    PDNonTerminalField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
     {
-        super(theAcroForm, field, parentNode);
+        super(acroForm, field, parent);
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
     @Override
     public int getFieldFlags()
     {
         int retval = 0;
-        COSInteger ff = (COSInteger) getCOSObject().getDictionaryObject(COSName.FF);
+        COSInteger ff = (COSInteger) dictionary.getDictionaryObject(COSName.FF);
         if (ff != null)
         {
             retval = ff.intValue();
@@ -70,55 +66,39 @@ public class PDNonTerminalField extends
         // There is no need to look up the parent hierarchy within a non terminal field
         return retval;
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
     @Override
     public String getFieldType()
     {
         // There is no need to look up the parent hierarchy within a non terminal field
-        return getCOSObject().getNameAsString(COSName.FT);
+        return dictionary.getNameAsString(COSName.FT);
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
     @Override
     public Object getValue()
     {
         // There is no need to look up the parent hierarchy within a non terminal field
-        return getCOSObject().getNameAsString(COSName.V);
+        return dictionary.getNameAsString(COSName.V);
     }
     
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public void setValue(String fieldValue)
     {
         // There is no need to look up the parent hierarchy within a non terminal field
-        getCOSObject().setString(COSName.V, fieldValue);
+        dictionary.setString(COSName.V, fieldValue);
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
     @Override
     public Object getDefaultValue()
     {
         // There is no need to look up the parent hierarchy within a non terminal field
-        return getCOSObject().getNameAsString(COSName.V);
+        return dictionary.getNameAsString(COSName.V);
     }
-
-    /**
-     * {@inheritDoc}
-     */    
+    
     @Override
     public void setDefaultValue(String defaultValue)
     {
         // There is no need to look up the parent hierarchy within a non terminal field
-        getCOSObject().setString(COSName.V, defaultValue);
+        dictionary.setString(COSName.V, defaultValue);
     }
-    
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java Thu May 14 17:45:43 2015
@@ -30,50 +30,35 @@ import org.apache.pdfbox.cos.COSDictiona
 public class PDPushButton extends PDButton
 {
     /**
-     * @see PDFieldTreeNode#PDFieldTreeNode(PDAcroForm)
+     * @see PDField#PDField(PDAcroForm)
      *
-     * @param theAcroForm The acroform.
+     * @param acroForm The acroform.
      */
-    public PDPushButton(PDAcroForm theAcroForm)
+    public PDPushButton(PDAcroForm acroForm)
     {
-        super( theAcroForm );
+        super( acroForm );
         setPushButton(true);
     }
     
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
+     * @param parent the parent node of the node
      */
-    public PDPushButton( PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
+    PDPushButton( PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
     {
-        super(theAcroForm, field, parentNode);
+        super(acroForm, field, parent);
     }
     
-    /**
-     * Get the fields default value.
-     * 
-     * A push button field does not have a field value.
-     * 
-     * @return This will always return an empty string.
-     */
     @Override
     public String getDefaultValue()
     {
         // PushButton fields don't support the "DV" entry.
         return "";
     }    
-
-    /**
-     * Set the fields default value.
-     * 
-     * A push button field does not have a field value.
-     * 
-     * @param defaultValue The field doesn't support setting any value
-     * @throws IllegalArgumentException when trying to set a value other than null
-     */
+    
     @Override
     public void setDefaultValue(String defaultValue)
     {
@@ -82,28 +67,13 @@ public class PDPushButton extends PDButt
             throw new IllegalArgumentException("A PDPushButton shall not use the DV entry in the field dictionary");
         }
     }
-
-    /**
-     * Get the fields options.
-     * 
-     * A push button field does not have option value.
-     * 
-     * @return This will always return an empty List.
-     */
+    
     @Override
     public List<String> getOptions()
     {
         return Collections.<String>emptyList();
     }
-
-    /**
-     * Set the fields options.
-     * 
-     * A push button field does not have a option values.
-     * 
-     * @param values The field doesn't support setting any option value
-     * @throws IllegalArgumentException when trying to set the a value other than null or an empty list.
-     */
+    
     @Override
     public void setOptions(List<String> values)
     {
@@ -113,28 +83,13 @@ public class PDPushButton extends PDButt
         }
     }
     
-    /**
-     * Get the fields value.
-     * 
-     * A push button field does not have field value.
-     * 
-     * @return This will always return an empty String.
-     */    
     @Override
     public String getValue()
     {
         // PushButton fields don't support the "V" entry.
         return "";
     }
-
-    /**
-     * Set the fields value.
-     * 
-     * A push button field does not have a field value.
-     * 
-     * @param fieldValue The field doesn't support setting any field value.
-     * @throws IllegalArgumentException when trying to set the a value other than null or an empty String.
-     */
+    
     @Override
     public void setValue(String fieldValue)
     {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioButton.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioButton.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioButton.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioButton.java Thu May 14 17:45:43 2015
@@ -33,33 +33,32 @@ import org.apache.pdfbox.pdmodel.interac
  */
 public final class PDRadioButton extends PDButton
 {
-
     /**
      * A Ff flag.
      */
-    public static final int FLAG_NO_TOGGLE_TO_OFF = 1 << 14;
+    private static final int FLAG_NO_TOGGLE_TO_OFF = 1 << 14;
     
     /**
-     * @see PDFieldTreeNode#PDFieldTreeNode(PDAcroForm)
+     * @see PDField#PDField(PDAcroForm)
      *
-     * @param theAcroForm The acroform.
+     * @param acroForm The acroform.
      */
-    public PDRadioButton(PDAcroForm theAcroForm)
+    public PDRadioButton(PDAcroForm acroForm)
     {
-        super( theAcroForm );
+        super( acroForm );
         setRadioButton(true);
     }
     
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
+     * @param parent the parent node of the node
      */
-    public PDRadioButton(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
+    PDRadioButton(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
     {
-        super(theAcroForm, field, parentNode);
+        super(acroForm, field, parent);
     }
 
     /**
@@ -72,7 +71,7 @@ public final class PDRadioButton extends
      */
     public void setRadiosInUnison(boolean radiosInUnison)
     {
-        getCOSObject().setFlag(COSName.FF, FLAG_RADIOS_IN_UNISON, radiosInUnison);
+        dictionary.setFlag(COSName.FF, FLAG_RADIOS_IN_UNISON, radiosInUnison);
     }
 
     /**
@@ -81,7 +80,7 @@ public final class PDRadioButton extends
      */
     public boolean isRadiosInUnison()
     {
-        return getCOSObject().getFlag(COSName.FF, FLAG_RADIOS_IN_UNISON);
+        return dictionary.getFlag(COSName.FF, FLAG_RADIOS_IN_UNISON);
     }
 
     /**
@@ -149,17 +148,7 @@ public final class PDRadioButton extends
             throw new IOException("Expected a COSName entry but got " + attribute.getClass().getName());
         }
     }
-
-    /**
-     * Set the field value.
-     * 
-     * The field value holds a name object which is corresponding to the 
-     * appearance state of the child field being in the on state.
-     * 
-     * The default value is Off.
-     * 
-     * @param fieldValue the COSName object to set the field value.
-     */
+    
     @Override
     public void setValue(String fieldValue)
     {
@@ -185,7 +174,7 @@ public final class PDRadioButton extends
                     }
                     else
                     {
-                        ((COSDictionary) kid.getCOSObject()).setItem(COSName.AS, PDButton.OFF);
+                        ((COSDictionary) kid.getCOSObject()).setItem(COSName.AS, COSName.OFF);
                     }
                 }
             }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java Thu May 14 17:45:43 2015
@@ -16,64 +16,62 @@
  */
 package org.apache.pdfbox.pdmodel.interactive.form;
 
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSeedValue;
 import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
 
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 /**
  * A signature field is a form field that contains a digital signature.
  *
  * @author Ben Litchfield
  * @author Thomas Chojecki
  */
-public class PDSignatureField extends PDField
+public class PDSignatureField extends PDTerminalField
 {
     /**
-     * Constructor.
-     * 
-     * @param theAcroForm The form that this field is part of.
-     * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
-     */
-    public PDSignatureField(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
-    {
-        super(theAcroForm, field, parentNode);
-    }
-
-    /**
-     * @see PDField#PDField(PDAcroForm)
+     * @see PDTerminalField#PDTerminalField(PDAcroForm)
      *
-     * @param theAcroForm The acroForm for this field.
+     * @param acroForm The acroForm for this field.
      * @throws IOException If there is an error while resolving partial name for the signature field
      *         or getting the widget object.
      */
-    public PDSignatureField(PDAcroForm theAcroForm) throws IOException
+    public PDSignatureField(PDAcroForm acroForm) throws IOException
     {
-        super( theAcroForm );
-        getCOSObject().setItem(COSName.FT, COSName.SIG);
+        super(acroForm);
+        dictionary.setItem(COSName.FT, COSName.SIG);
         getWidget().setLocked(true);
         getWidget().setPrinted(true);
         setPartialName(generatePartialName());
     }
     
     /**
+     * Constructor.
+     * 
+     * @param acroForm The form that this field is part of.
+     * @param field the PDF object to represent as a field.
+     * @param parent the parent node of the node to be created
+     */
+    PDSignatureField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
+    {
+        super(acroForm, field, parent);
+    }
+    
+    /**
      * Generate a unique name for the signature.
+     * 
      * @return the signature's unique name
      */
     private String generatePartialName()
     {
-        PDAcroForm acroForm = getAcroForm();
-        List<PDFieldTreeNode> fields = acroForm.getFields();
         String fieldName = "Signature";
         Set<String> sigNames = new HashSet<String>();
-        for ( PDFieldTreeNode field : fields )
+        // fixme: this ignores non-terminal fields, so will miss any descendant signatures
+        for ( PDField field : acroForm.getFields() )
         {
             if(field instanceof PDSignatureField)
             {
@@ -89,17 +87,6 @@ public class PDSignatureField extends PD
     }
     
     /**
-     * Return a string rep of this object.
-     *
-     * @return A string rep of this object.
-     */
-    @Override
-    public String toString()
-    {
-        return "PDSignatureField";
-    }
-    
-    /**
      * Add a signature dictionary to the signature field.
      * 
      * @param value is the PDSignatureField
@@ -129,11 +116,11 @@ public class PDSignatureField extends PD
     {
         if (value == null)
         {
-            getCOSObject().removeItem(COSName.V);
+            dictionary.removeItem(COSName.V);
         }
         else
         {
-            getCOSObject().setItem(COSName.V, (PDSignature)value);
+            dictionary.setItem(COSName.V, (PDSignature)value);
         }
     }
     
@@ -144,20 +131,15 @@ public class PDSignatureField extends PD
         throw new IllegalArgumentException( "Signature fields don't support a string for the value entry." );     
     }    
     
-    /**
-     * Get the signature dictionary.
-     * 
-     * @return the signature dictionary
-     * 
-     */
+    @Override
     public PDSignature getValue()
     {
-        COSBase dictionary = getCOSObject().getDictionaryObject(COSName.V);
-        if (dictionary == null)
+        COSBase value = dictionary.getDictionaryObject(COSName.V);
+        if (value == null)
         {
             return null;
         }
-        return new PDSignature((COSDictionary)dictionary);
+        return new PDSignature((COSDictionary)value);
     }
 
     /**
@@ -169,7 +151,7 @@ public class PDSignatureField extends PD
      */
     public PDSeedValue getSeedValue()
     {
-        COSDictionary dict = (COSDictionary) getCOSObject().getDictionaryObject(COSName.SV);
+        COSDictionary dict = (COSDictionary) dictionary.getDictionaryObject(COSName.SV);
         PDSeedValue sv = null;
         if (dict != null)
         {
@@ -189,7 +171,7 @@ public class PDSignatureField extends PD
     {
         if (sv != null)
         {
-            getCOSObject().setItem(COSName.SV, sv.getCOSObject());
+            dictionary.setItem(COSName.SV, sv);
         }
     }
     
@@ -206,4 +188,10 @@ public class PDSignatureField extends PD
         // Signature fields don't support the "DV" entry.
         throw new IllegalArgumentException( "Signature fields don't support the \"DV\" entry." );     
     }
+
+    @Override
+    public String toString()
+    {
+        return "PDSignatureField";
+    }
 }

Copied: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java (from r1679304, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java)
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java?p2=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java&p1=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java&r1=1679304&r2=1679413&rev=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java Thu May 14 17:45:43 2015
@@ -29,28 +29,28 @@ import org.apache.pdfbox.pdmodel.interac
  *
  * @author sug
  */
-public abstract class PDField extends PDFieldTreeNode
+public abstract class PDTerminalField extends PDField
 {
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      */
-    protected PDField(PDAcroForm theAcroForm)
+    protected PDTerminalField(PDAcroForm acroForm)
     {
-        super(theAcroForm);
+        super(acroForm);
     }
 
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
+     * @param parent the parent node of the node
      */
-    protected PDField(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
+    PDTerminalField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
     {
-        super(theAcroForm, field, parentNode);
+        super(acroForm, field, parent);
     }
 
     /**
@@ -60,38 +60,32 @@ public abstract class PDField extends PD
      */
     public void setActions(PDFormFieldAdditionalActions actions)
     {
-        getCOSObject().setItem(COSName.AA, actions);
+        dictionary.setItem(COSName.AA, actions);
     }
     
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public int getFieldFlags()
     {
         int retval = 0;
-        COSInteger ff = (COSInteger) getCOSObject().getDictionaryObject(COSName.FF);
+        COSInteger ff = (COSInteger) dictionary.getDictionaryObject(COSName.FF);
         if (ff != null)
         {
             retval = ff.intValue();
         }
-        else if (getParent() != null)
+        else if (parent != null)
         {
-            retval = getParent().getFieldFlags();
+            retval = parent.getFieldFlags();
         }
         return retval;
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
     @Override
     public String getFieldType()
     {
-        String fieldType = getCOSObject().getNameAsString(COSName.FT);
-        if (fieldType == null && getParent() != null)
+        String fieldType = dictionary.getNameAsString(COSName.FT);
+        if (fieldType == null && parent != null)
         {
-            fieldType = getParent().getFieldType();
+            fieldType = parent.getFieldType();
         }
         return fieldType;
     }
@@ -101,15 +95,14 @@ public abstract class PDField extends PD
      * 
      * The fields appearance stream needs to be updated to reflect the new field
      * value. This will be done only if the NeedAppearances flag has not been set.
+     * 
      * @throws IOException if the appearance couldn't be generated
      */
     protected void updateFieldAppearances() throws IOException
     {
-        if (!getAcroForm().isNeedAppearances())
+        if (!acroForm.isNeedAppearances())
         {
             AppearanceGenerator.generateFieldAppearances(this);
         }
     }
-
-
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java Thu May 14 17:45:43 2015
@@ -30,10 +30,6 @@ import org.apache.pdfbox.cos.COSString;
  */
 public final class PDTextField extends PDVariableText
 {
-    
-    /**
-     * Ff flags.
-     */
     private static final int FLAG_MULTILINE = 1 << 12;
     private static final int FLAG_PASSWORD = 1 << 13;
     private static final int FLAG_FILE_SELECT = 1 << 20;
@@ -42,29 +38,27 @@ public final class PDTextField extends P
     private static final int FLAG_COMB = 1 << 24;
     private static final int FLAG_RICH_TEXT = 1 << 25;
     
-    
-    
     /**
-     * @see PDFieldTreeNode#PDFieldTreeNode(PDAcroForm)
+     * @see PDField#PDField(PDAcroForm)
      *
-     * @param theAcroForm The acroform.
+     * @param acroForm The acroform.
      */
-    public PDTextField(PDAcroForm theAcroForm)
+    public PDTextField(PDAcroForm acroForm)
     {
-        super( theAcroForm );
-        getCOSObject().setItem(COSName.FT, COSName.TX);
+        super( acroForm );
+        dictionary.setItem(COSName.FT, COSName.TX);
     }
 
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
+     * @param parent the parent node of the node
      */
-    public PDTextField(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
+    PDTextField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
     {
-        super( theAcroForm, field, parentNode);
+        super( acroForm, field, parent);
     }
 
     /**
@@ -72,7 +66,7 @@ public final class PDTextField extends P
      */
     public boolean isMultiline()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_MULTILINE );
+        return dictionary.getFlag(COSName.FF, FLAG_MULTILINE);
     }
 
     /**
@@ -82,7 +76,7 @@ public final class PDTextField extends P
      */
     public void setMultiline( boolean multiline )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_MULTILINE, multiline );
+        dictionary.setFlag(COSName.FF, FLAG_MULTILINE, multiline);
     }
 
     /**
@@ -90,7 +84,7 @@ public final class PDTextField extends P
      */
     public boolean isPassword()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_PASSWORD );
+        return dictionary.getFlag(COSName.FF, FLAG_PASSWORD);
     }
 
     /**
@@ -100,7 +94,7 @@ public final class PDTextField extends P
      */
     public void setPassword( boolean password )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_PASSWORD, password );
+        dictionary.setFlag(COSName.FF, FLAG_PASSWORD, password);
     }
 
     /**
@@ -108,7 +102,7 @@ public final class PDTextField extends P
      */
     public boolean isFileSelect()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_FILE_SELECT );
+        return dictionary.getFlag(COSName.FF, FLAG_FILE_SELECT);
     }
 
     /**
@@ -118,7 +112,7 @@ public final class PDTextField extends P
      */
     public void setFileSelect( boolean fileSelect )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_FILE_SELECT, fileSelect );
+        dictionary.setFlag(COSName.FF, FLAG_FILE_SELECT, fileSelect);
     }
 
     /**
@@ -126,7 +120,7 @@ public final class PDTextField extends P
      */
     public boolean doNotSpellCheck()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_DO_NOT_SPELL_CHECK );
+        return dictionary.getFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK);
     }
 
     /**
@@ -136,7 +130,7 @@ public final class PDTextField extends P
      */
     public void setDoNotSpellCheck( boolean doNotSpellCheck )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck );
+        dictionary.setFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck);
     }
 
     /**
@@ -144,7 +138,7 @@ public final class PDTextField extends P
      */
     public boolean doNotScroll()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_DO_NOT_SCROLL );
+        return dictionary.getFlag(COSName.FF, FLAG_DO_NOT_SCROLL);
     }
 
     /**
@@ -154,7 +148,7 @@ public final class PDTextField extends P
      */
     public void setDoNotScroll( boolean doNotScroll )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_DO_NOT_SCROLL, doNotScroll );
+        dictionary.setFlag(COSName.FF, FLAG_DO_NOT_SCROLL, doNotScroll);
     }
 
     /**
@@ -162,7 +156,7 @@ public final class PDTextField extends P
      */
     public boolean isComb()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_COMB );
+        return dictionary.getFlag(COSName.FF, FLAG_COMB);
     }
 
     /**
@@ -172,7 +166,7 @@ public final class PDTextField extends P
      */
     public void setComb( boolean comb )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_COMB, comb );
+        dictionary.setFlag(COSName.FF, FLAG_COMB, comb);
     }
 
     /**
@@ -180,7 +174,7 @@ public final class PDTextField extends P
      */
     public boolean isRichText()
     {
-        return getCOSObject().getFlag( COSName.FF, FLAG_RICH_TEXT );
+        return dictionary.getFlag(COSName.FF, FLAG_RICH_TEXT);
     }
 
     /**
@@ -190,10 +184,8 @@ public final class PDTextField extends P
      */
     public void setRichText( boolean richText )
     {
-        getCOSObject().setFlag( COSName.FF, FLAG_RICH_TEXT, richText );
-    }    
-    
-    
+        dictionary.setFlag(COSName.FF, FLAG_RICH_TEXT, richText);
+    }
     
     /**
      * Returns the maximum number of characters of the text field.
@@ -202,7 +194,7 @@ public final class PDTextField extends P
      */
     public int getMaxLen()
     {
-        return getCOSObject().getInt(COSName.MAX_LEN);
+        return dictionary.getInt(COSName.MAX_LEN);
     }
 
     /**
@@ -212,16 +204,9 @@ public final class PDTextField extends P
      */
     public void setMaxLen(int maxLen)
     {
-        getCOSObject().setInt(COSName.MAX_LEN, maxLen);
+        dictionary.setInt(COSName.MAX_LEN, maxLen);
     }
-
-    /**
-     * Sets the default value for the field.
-     * 
-     * The value is stored in the field dictionaries "DV" entry.
-     *
-     * @param value the default value
-     */
+    
     @Override
     public void setDefaultValue(String value)
     {
@@ -236,13 +221,6 @@ public final class PDTextField extends P
         }
     }
     
-    /**
-     * Get the fields default value.
-     * 
-     * The value is stored in the field dictionaries "DV" entry.
-     * 
-     * @return The value of this entry.
-     */
     @Override
     public String getDefaultValue()
     {
@@ -254,14 +232,6 @@ public final class PDTextField extends P
         return "";
     }    
     
-    /**
-     * Set the field's value.
-     * 
-     * The value is stored in the field dictionaries "V" entry.
-     * 
-     * @param value the value
-     * @throws IOException if there is an error setting the field value
-     */
     @Override
     public void setValue(String value) throws IOException
     {
@@ -279,14 +249,6 @@ public final class PDTextField extends P
         updateFieldAppearances();
     }
     
-    /**
-     * Get the field's value.
-     * 
-     * The value is stored in the field dictionaries "V" entry.
-     * 
-     * @return The value of this entry.
-     * @throws IOException if the field dictionary entry is not a text type
-     */
     @Override
     public String getValue() throws IOException
     {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java Thu May 14 17:45:43 2015
@@ -29,44 +29,32 @@ import org.apache.pdfbox.cos.COSString;
  *
  * @author Ben Litchfield
  */
-public abstract class PDVariableText extends PDField
+public abstract class PDVariableText extends PDTerminalField
 {
+    static final int QUADDING_LEFT = 0;
+    static final int QUADDING_CENTERED = 1;
+    static final int QUADDING_RIGHT = 2;
 
     /**
-     * A Q value.
-     */
-    public static final int QUADDING_LEFT = 0;
-
-    /**
-     * A Q value.
-     */
-    public static final int QUADDING_CENTERED = 1;
-
-    /**
-     * A Q value.
-     */
-    public static final int QUADDING_RIGHT = 2;
-
-    /**
-     * @see PDField#PDField(PDAcroForm)
+     * @see PDTerminalField#PDTerminalField(PDAcroForm)
      *
-     * @param theAcroForm The acroform.
+     * @param acroForm The acroform.
      */
-    PDVariableText(PDAcroForm theAcroForm)
+    PDVariableText(PDAcroForm acroForm)
     {
-        super( theAcroForm );
+        super( acroForm );
     }
 
     /**
      * Constructor.
      * 
-     * @param theAcroForm The form that this field is part of.
+     * @param acroForm The form that this field is part of.
      * @param field the PDF object to represent as a field.
-     * @param parentNode the parent node of the node to be created
+     * @param parent the parent node of the node
      */
-    protected PDVariableText(PDAcroForm theAcroForm, COSDictionary field, PDFieldTreeNode parentNode)
+    PDVariableText(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
     {
-        super( theAcroForm, field, parentNode);
+        super( acroForm, field, parent);
     }
 
     /**
@@ -117,7 +105,7 @@ public abstract class PDVariableText ext
      */
     public String getDefaultStyleString()
     {
-        COSString defaultStyleString = (COSString) getCOSObject().getDictionaryObject(COSName.DS);
+        COSString defaultStyleString = (COSString) dictionary.getDictionaryObject(COSName.DS);
         return defaultStyleString.getString();
     }
 
@@ -132,11 +120,11 @@ public abstract class PDVariableText ext
     {
         if (defaultStyleString != null)
         {
-            getCOSObject().setItem(COSName.DS, new COSString(defaultStyleString));
+            dictionary.setItem(COSName.DS, new COSString(defaultStyleString));
         }
         else
         {
-            getCOSObject().removeItem(COSName.DS);
+            dictionary.removeItem(COSName.DS);
         }
     }    
 
@@ -172,7 +160,7 @@ public abstract class PDVariableText ext
      */
     public void setQ( int q )
     {
-        getCOSObject().setInt( COSName.Q, q );
+        dictionary.setInt(COSName.Q, q);
     }
     
     /**
@@ -210,11 +198,11 @@ public abstract class PDVariableText ext
     {
         if (richTextValue != null)
         {
-            getCOSObject().setItem(COSName.RV, new COSString(richTextValue));
+            dictionary.setItem(COSName.RV, new COSString(richTextValue));
         }
         else
         {
-            getCOSObject().removeItem(COSName.RV);
+            dictionary.removeItem(COSName.RV);
         }        
     }
 }

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=1679413&r1=1679412&r2=1679413&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 May 14 17:45:43 2015
@@ -35,7 +35,7 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
-import org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode;
+import org.apache.pdfbox.pdmodel.interactive.form.PDField;
 import org.apache.pdfbox.pdmodel.interactive.form.PDRadioButton;
 import org.apache.pdfbox.pdmodel.interactive.form.PDTextField;
 
@@ -216,14 +216,14 @@ public class TestFDF extends TestCase
                 form.importFDF( fdf );
                 PDTextField feld2 = (PDTextField)form.getField( "eeFirstName" );
                 List<COSObjectable> kids = feld2.getKids();
-                PDFieldTreeNode firstKid = (PDFieldTreeNode)kids.get( 0 );
-                PDFieldTreeNode secondKid = (PDFieldTreeNode)kids.get( 1 );
+                PDField firstKid = (PDField)kids.get( 0 );
+                PDField secondKid = (PDField)kids.get( 1 );
                 testContentStreamContains( freedom, firstKid, "Steve" );
                 testContentStreamContains( freedom, secondKid, "Steve" );
     
                 //the appearance stream is suppose to be null because there
                 //is an F action in the AA dictionary that populates that field.
-                PDFieldTreeNode totalAmt = form.getField( "eeSuppTotalAmt" );
+                PDField totalAmt = form.getField( "eeSuppTotalAmt" );
                 assertTrue( totalAmt.getCOSObject().getDictionaryObject( COSName.AP ) == null );
     
             }
@@ -241,7 +241,7 @@ public class TestFDF extends TestCase
         }
     }
 
-    private void testContentStreamContains( PDDocument doc, PDFieldTreeNode field, String expected ) throws Exception
+    private void testContentStreamContains( PDDocument doc, PDField field, String expected ) throws Exception
     {
         PDAnnotationWidget widget = field.getWidget();
         PDAppearanceEntry normalAppearance = widget.getAppearance().getNormalAppearance();
@@ -252,7 +252,7 @@ public class TestFDF extends TestCase
         assertTrue( actualTokens.contains( new COSString( expected ) ) );
     }
 
-    private void testContentStreams( PDDocument doc, PDFieldTreeNode field, String expected ) throws Exception
+    private void testContentStreams( PDDocument doc, PDField field, String expected ) throws Exception
     {
         PDAnnotationWidget widget = field.getWidget();
         PDAppearanceEntry normalAppearance = widget.getAppearance().getNormalAppearance();

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextFieldTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextFieldTest.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextFieldTest.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextFieldTest.java Thu May 14 17:45:43 2015
@@ -16,15 +16,16 @@
  */
 package org.apache.pdfbox.pdmodel.interactive.form;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
 import org.junit.Before;
 import org.junit.Test;
 
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 /**
  * Test for the PDSignatureField class.
  *
@@ -44,7 +45,7 @@ public class PDTextFieldTest
     @Test
     public void createDefaultTextField()
     {
-        PDFieldTreeNode textField = new PDTextField(acroForm);
+        PDField textField = new PDTextField(acroForm);
         
         assertEquals(textField.getFieldType(), textField.getCOSObject().getNameAsString(COSName.FT));
         assertEquals(textField.getFieldType(), "Tx");

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=1679413&r1=1679412&r2=1679413&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 May 14 17:45:43 2015
@@ -145,7 +145,7 @@ public class TestFields extends TestCase
             
             // assert that there is no value, set the field value and
             // ensure it has been set 
-            PDFieldTreeNode field = form.getField("TextField");
+            PDField field = form.getField("TextField");
             assertNull(field.getCOSObject().getItem(COSName.V));
             field.setValue("field value");
             assertNotNull(field.getCOSObject().getItem(COSName.V));

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java?rev=1679413&r1=1679412&r2=1679413&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java (original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/AcroFormValidationProcess.java Thu May 14 17:45:43 2015
@@ -21,29 +21,29 @@
 
 package org.apache.pdfbox.preflight.process;
 
-import static org.apache.pdfbox.preflight.PreflightConfiguration.ANNOTATIONS_PROCESS;
-import static org.apache.pdfbox.preflight.PreflightConstants.ACROFORM_DICTIONARY_KEY_NEED_APPEARANCES;
-import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_ADDITIONAL_ACTIONS_FIELD;
-import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_WIDGET_ACTION_FIELD;
-import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_DICT_INVALID;
-import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_NOCATALOG;
-import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_BODY;
-
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
 import org.apache.pdfbox.pdmodel.interactive.action.PDFormFieldAdditionalActions;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
-import org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode;
+import org.apache.pdfbox.pdmodel.interactive.form.PDField;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
 import org.apache.pdfbox.preflight.exception.ValidationException;
 import org.apache.pdfbox.preflight.utils.ContextHelper;
 
+
+import static org.apache.pdfbox.preflight.PreflightConfiguration.ANNOTATIONS_PROCESS;
+import static org.apache.pdfbox.preflight.PreflightConstants.ACROFORM_DICTIONARY_KEY_NEED_APPEARANCES;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_ADDITIONAL_ACTIONS_FIELD;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_ACTION_FORBIDDEN_WIDGET_ACTION_FIELD;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_BODY;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_DICT_INVALID;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_NOCATALOG;
+
 public class AcroFormValidationProcess extends AbstractProcess
 {
 
@@ -93,7 +93,7 @@ public class AcroFormValidationProcess e
     /**
      * This function explores all fields and their children to validate them.
      * 
-     * @see #validateField(PreflightContext, PDFieldTreeNode) 
+     * @see #validateField(PreflightContext, PDField) 
      * 
      * @param ctx the preflight context.
      * @param lFields the list of fields, can be null.
@@ -107,9 +107,9 @@ public class AcroFormValidationProcess e
             // the list can be null if the field doesn't have children
             for (Object obj : lFields)
             {
-                if (obj instanceof PDFieldTreeNode)
+                if (obj instanceof PDField)
                 {
-                    if (!validateField(ctx, (PDFieldTreeNode) obj))
+                    if (!validateField(ctx, (PDField) obj))
                     {
                         return false;
                     }
@@ -141,7 +141,7 @@ public class AcroFormValidationProcess e
      * @return the result of the check for A or AA entries.
      * @throws IOException
      */
-    protected boolean validateField(PreflightContext ctx, PDFieldTreeNode aField) throws IOException
+    protected boolean validateField(PreflightContext ctx, PDField aField) throws IOException
     {
         boolean res = true;
         PDFormFieldAdditionalActions aa = aField.getActions();