pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1704113 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/
Date Sun, 20 Sep 2015 09:30:49 GMT
Author: msahyoun
Date: Sun Sep 20 09:30:48 2015
New Revision: 1704113

URL: http://svn.apache.org/viewvc?rev=1704113&view=rev
Log:
PDFBOX-2852: make fields private; use accessor methods

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDCheckbox.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDComboBox.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDListBox.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDNonTerminalField.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioButton.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTextField.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java?rev=1704113&r1=1704112&r2=1704113&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
Sun Sep 20 09:30:48 2015
@@ -62,7 +62,7 @@ public abstract class PDButton extends P
     public PDButton(PDAcroForm acroForm)
     {
         super(acroForm);
-        dictionary.setItem(COSName.FT, COSName.BTN);
+        getCOSObject().setItem(COSName.FT, COSName.BTN);
     }
     
     /**
@@ -84,7 +84,7 @@ public abstract class PDButton extends P
      */
     public boolean isPushButton()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_PUSHBUTTON);
+        return getCOSObject().getFlag(COSName.FF, FLAG_PUSHBUTTON);
     }
 
     /**
@@ -94,7 +94,7 @@ public abstract class PDButton extends P
      */
     public void setPushButton(boolean pushbutton)
     {
-        dictionary.setFlag(COSName.FF, FLAG_PUSHBUTTON, pushbutton);
+        getCOSObject().setFlag(COSName.FF, FLAG_PUSHBUTTON, pushbutton);
     }
 
     /**
@@ -104,7 +104,7 @@ public abstract class PDButton extends P
      */
     public boolean isRadioButton()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_RADIO);
+        return getCOSObject().getFlag(COSName.FF, FLAG_RADIO);
     }
 
     /**
@@ -114,7 +114,7 @@ public abstract class PDButton extends P
      */
     public void setRadioButton(boolean radiobutton)
     {
-        dictionary.setFlag(COSName.FF, FLAG_RADIO, radiobutton);
+        getCOSObject().setFlag(COSName.FF, FLAG_RADIO, radiobutton);
     }
     
     /**
@@ -163,11 +163,11 @@ public abstract class PDButton extends P
         if (values != null && !values.isEmpty())
         {
             cosValues = COSArrayList.convertStringListToCOSStringCOSArray(values);
-            dictionary.setItem(COSName.OPT, cosValues);
+            getCOSObject().setItem(COSName.OPT, cosValues);
         }
         else
         {
-            dictionary.removeItem(COSName.OPT);
+            getCOSObject().removeItem(COSName.OPT);
         }
     }
     

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDCheckbox.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDCheckbox.java?rev=1704113&r1=1704112&r2=1704113&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDCheckbox.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDCheckbox.java
Sun Sep 20 09:30:48 2015
@@ -156,7 +156,7 @@ public final class PDCheckbox extends PD
             // Update the field value and the appearance state.
             // Both are necessary to work properly with different viewers.
             COSName name = COSName.getPDFName(value);
-            dictionary.setItem(COSName.V, name);
+            getCOSObject().setItem(COSName.V, name);
             for (PDAnnotationWidget widget : getWidgets())
             {
                 widget.setAppearanceState(value);
@@ -179,7 +179,7 @@ public final class PDCheckbox extends PD
         }
         else
         {
-            dictionary.setName(COSName.DV, value);
+            getCOSObject().setName(COSName.DV, value);
         }
     }
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.java?rev=1704113&r1=1704112&r2=1704113&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDChoice.java
Sun Sep 20 09:30:48 2015
@@ -53,7 +53,7 @@ public abstract class PDChoice extends P
     public PDChoice(PDAcroForm acroForm)
     {
         super(acroForm);
-        dictionary.setItem(COSName.FT, COSName.CH);
+        getCOSObject().setItem(COSName.FT, COSName.CH);
     }
 
     /**
@@ -87,7 +87,7 @@ public abstract class PDChoice extends P
      */
     public List<String> getOptions()
     {
-        COSBase values = dictionary.getDictionaryObject(COSName.OPT);
+        COSBase values = getCOSObject().getDictionaryObject(COSName.OPT);
         return FieldUtils.getPairableItems(values, 0);
     }
 
@@ -114,11 +114,11 @@ public abstract class PDChoice extends P
             {
                 Collections.sort(displayValues);
             }
-            dictionary.setItem(COSName.OPT, COSArrayList.convertStringListToCOSStringCOSArray(displayValues));
+            getCOSObject().setItem(COSName.OPT, COSArrayList.convertStringListToCOSStringCOSArray(displayValues));
         }
         else
         {
-            dictionary.removeItem(COSName.OPT);
+            getCOSObject().removeItem(COSName.OPT);
         }
     }
 
@@ -166,12 +166,12 @@ public abstract class PDChoice extends P
                     entry.add(new COSString(keyValuePairs.get(i).getValue()));
                     options.add(entry);
                 }
-                dictionary.setItem(COSName.OPT, options);
+                getCOSObject().setItem(COSName.OPT, options);
             }
         }
         else
         {
-            dictionary.removeItem(COSName.OPT);
+            getCOSObject().removeItem(COSName.OPT);
         }      
     }
 
@@ -189,7 +189,7 @@ public abstract class PDChoice extends P
      */
     public List<String> getOptionsDisplayValues()
     {
-        COSBase values = dictionary.getDictionaryObject(COSName.OPT);
+        COSBase values = getCOSObject().getDictionaryObject(COSName.OPT);
         return FieldUtils.getPairableItems(values, 1);
     }
 
@@ -223,7 +223,7 @@ public abstract class PDChoice extends P
      */
     public List<Integer> getSelectedOptionsIndex()
     {
-        COSBase value = dictionary.getDictionaryObject(COSName.I);
+        COSBase value = getCOSObject().getDictionaryObject(COSName.I);
         if (value != null)
         {
             return COSArrayList.convertIntegerCOSArrayToList((COSArray) value);
@@ -255,11 +255,11 @@ public abstract class PDChoice extends P
                 throw new IllegalArgumentException(
                         "Setting the indices is not allowed for choice fields not allowing
multiple selections.");
             }
-            dictionary.setItem(COSName.I, COSArrayList.converterToCOSArray(values));
+            getCOSObject().setItem(COSName.I, COSArrayList.converterToCOSArray(values));
         }
         else
         {
-            dictionary.removeItem(COSName.I);
+            getCOSObject().removeItem(COSName.I);
         }
     }
 
@@ -276,7 +276,7 @@ public abstract class PDChoice extends P
      */
     public boolean isSort()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_SORT);
+        return getCOSObject().getFlag(COSName.FF, FLAG_SORT);
     }
 
     /**
@@ -287,7 +287,7 @@ public abstract class PDChoice extends P
      */
     public void setSort(boolean sort)
     {
-        dictionary.setFlag(COSName.FF, FLAG_SORT, sort);
+        getCOSObject().setFlag(COSName.FF, FLAG_SORT, sort);
     }
 
     /**
@@ -297,7 +297,7 @@ public abstract class PDChoice extends P
      */
     public boolean isMultiSelect()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_MULTI_SELECT);
+        return getCOSObject().getFlag(COSName.FF, FLAG_MULTI_SELECT);
     }
 
     /**
@@ -307,7 +307,7 @@ public abstract class PDChoice extends P
      */
     public void setMultiSelect(boolean multiSelect)
     {
-        dictionary.setFlag(COSName.FF, FLAG_MULTI_SELECT, multiSelect);
+        getCOSObject().setFlag(COSName.FF, FLAG_MULTI_SELECT, multiSelect);
     }
 
     /**
@@ -317,7 +317,7 @@ public abstract class PDChoice extends P
      */
     public boolean isDoNotSpellCheck()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK);
+        return getCOSObject().getFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK);
     }
 
     /**
@@ -327,7 +327,7 @@ public abstract class PDChoice extends P
      */
     public void setDoNotSpellCheck(boolean doNotSpellCheck)
     {
-        dictionary.setFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck);
+        getCOSObject().setFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck);
     }
 
     /**
@@ -337,7 +337,7 @@ public abstract class PDChoice extends P
      */
     public boolean isCommitOnSelChange()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_COMMIT_ON_SEL_CHANGE);
+        return getCOSObject().getFlag(COSName.FF, FLAG_COMMIT_ON_SEL_CHANGE);
     }
 
     /**
@@ -347,7 +347,7 @@ public abstract class PDChoice extends P
      */
     public void setCommitOnSelChange(boolean commitOnSelChange)
     {
-        dictionary.setFlag(COSName.FF, FLAG_COMMIT_ON_SEL_CHANGE, commitOnSelChange);
+        getCOSObject().setFlag(COSName.FF, FLAG_COMMIT_ON_SEL_CHANGE, commitOnSelChange);
     }
 
     /**
@@ -357,7 +357,7 @@ public abstract class PDChoice extends P
      */
     public boolean isCombo()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_COMBO);
+        return getCOSObject().getFlag(COSName.FF, FLAG_COMBO);
     }
 
     /**
@@ -367,7 +367,7 @@ public abstract class PDChoice extends P
      */
     public void setCombo(boolean combo)
     {
-        dictionary.setFlag(COSName.FF, FLAG_COMBO, combo);
+        getCOSObject().setFlag(COSName.FF, FLAG_COMBO, combo);
     }
 
     /**
@@ -378,7 +378,7 @@ public abstract class PDChoice extends P
      */
     public void setValue(String value) throws IOException
     {
-        dictionary.setString(COSName.V, value);
+        getCOSObject().setString(COSName.V, value);
         
         // remove I key for single valued choice field
         setSelectedOptionsIndex(null);
@@ -394,7 +394,7 @@ public abstract class PDChoice extends P
      */
     public void setDefaultValue(String value) throws IOException
     {
-        dictionary.setString(COSName.DV, value);
+        getCOSObject().setString(COSName.DV, value);
     }
     
     /**
@@ -415,12 +415,12 @@ public abstract class PDChoice extends P
             {
                 throw new IllegalArgumentException("The values are not contained in the selectable
options.");
             }
-            dictionary.setItem(COSName.V, COSArrayList.convertStringListToCOSStringCOSArray(values));
+            getCOSObject().setItem(COSName.V, COSArrayList.convertStringListToCOSStringCOSArray(values));
             updateSelectedOptionsIndex(values);
         }
         else
         {
-            dictionary.removeItem(COSName.V);
+            getCOSObject().removeItem(COSName.V);
         }
         applyChange();
     }
@@ -452,7 +452,7 @@ public abstract class PDChoice extends P
      */
     private List<String> getValueFor(COSName name)
     {
-        COSBase value = dictionary.getDictionaryObject(name);
+        COSBase value = getCOSObject().getDictionaryObject(name);
         if (value instanceof COSString)
         {
             List<String> array = new ArrayList<String>();

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDComboBox.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDComboBox.java?rev=1704113&r1=1704112&r2=1704113&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDComboBox.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDComboBox.java
Sun Sep 20 09:30:48 2015
@@ -62,7 +62,7 @@ public final class PDComboBox extends PD
      */
     public boolean isEdit()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_EDIT);
+        return getCOSObject().getFlag(COSName.FF, FLAG_EDIT);
     }
 
     /**
@@ -72,7 +72,7 @@ public final class PDComboBox extends PD
      */
     public void setEdit(boolean edit)
     {
-        dictionary.setFlag(COSName.FF, FLAG_EDIT, edit);
+        getCOSObject().setFlag(COSName.FF, FLAG_EDIT, edit);
     }
     
     @Override

Modified: 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/PDField.java?rev=1704113&r1=1704112&r2=1704113&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/PDField.java
Sun Sep 20 09:30:48 2015
@@ -47,9 +47,9 @@ public abstract class PDField implements
         return PDFieldFactory.createField(form, field, parent);
     }
 
-    protected final PDAcroForm acroForm;
-    protected final PDNonTerminalField parent;
-    protected final COSDictionary dictionary;
+    private final PDAcroForm acroForm;
+    private final PDNonTerminalField parent;
+    private final COSDictionary dictionary;
 
     /**
      * Constructor.

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDListBox.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDListBox.java?rev=1704113&r1=1704112&r2=1704113&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDListBox.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDListBox.java
Sun Sep 20 09:30:48 2015
@@ -58,7 +58,7 @@ public final class PDListBox extends PDC
      */
     public int getTopIndex()
     {
-        return dictionary.getInt(COSName.TI, 0);
+        return getCOSObject().getInt(COSName.TI, 0);
     }
 
     /**
@@ -70,11 +70,11 @@ public final class PDListBox extends PDC
     {
         if (topIndex != null)
         {
-            dictionary.setInt(COSName.TI, topIndex);
+            getCOSObject().setInt(COSName.TI, topIndex);
         }
         else
         {
-            dictionary.removeItem(COSName.TI);
+            getCOSObject().removeItem(COSName.TI);
         }
     }
     

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=1704113&r1=1704112&r2=1704113&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
Sun Sep 20 09:30:48 2015
@@ -66,7 +66,7 @@ public class PDNonTerminalField extends
     public int getFieldFlags()
     {
         int retval = 0;
-        COSInteger ff = (COSInteger) dictionary.getDictionaryObject(COSName.FF);
+        COSInteger ff = (COSInteger) getCOSObject().getDictionaryObject(COSName.FF);
         if (ff != null)
         {
             retval = ff.intValue();
@@ -126,10 +126,10 @@ public class PDNonTerminalField extends
     public List<PDField> getChildren()
     {
         List<PDField> children = new ArrayList<PDField>();
-        COSArray kids = (COSArray)dictionary.getDictionaryObject(COSName.KIDS);
+        COSArray kids = (COSArray)getCOSObject().getDictionaryObject(COSName.KIDS);
         for (int i = 0; i < kids.size(); i++)
         {
-            PDField field = PDField.fromDictionary(acroForm, (COSDictionary)kids.getObject(i),
this);
+            PDField field = PDField.fromDictionary(getAcroForm(), (COSDictionary)kids.getObject(i),
this);
             if (field != null)
             {
                 children.add(field);
@@ -146,7 +146,7 @@ public class PDNonTerminalField extends
     public void setChildren(List<PDField> children)
     {
         COSArray kidsArray = COSArrayList.converterToCOSArray(children);
-        dictionary.setItem(COSName.KIDS, kidsArray);
+        getCOSObject().setItem(COSName.KIDS, kidsArray);
     }
 
     /**
@@ -158,7 +158,7 @@ public class PDNonTerminalField extends
     @Override
     public String getFieldType()
     {
-        return dictionary.getNameAsString(COSName.FT);
+        return getCOSObject().getNameAsString(COSName.FT);
     }
 
     /**
@@ -169,7 +169,7 @@ public class PDNonTerminalField extends
      */
     public COSBase getValue()
     {
-        return dictionary.getDictionaryObject(COSName.V);
+        return getCOSObject().getDictionaryObject(COSName.V);
     }
 
     /**
@@ -181,7 +181,7 @@ public class PDNonTerminalField extends
     @Override
     public String getValueAsString()
     {
-        COSBase fieldValue = dictionary.getDictionaryObject(COSName.V);
+        COSBase fieldValue = getCOSObject().getDictionaryObject(COSName.V);
         return fieldValue != null ? fieldValue.toString() : "";
     }
 
@@ -194,7 +194,7 @@ public class PDNonTerminalField extends
      */
     public void setValue(COSBase object) throws IOException
     {
-        dictionary.setItem(COSName.V, object);
+        getCOSObject().setItem(COSName.V, object);
         // todo: propagate change event to children?
         // todo: construct appearances of children?
     }
@@ -208,7 +208,7 @@ public class PDNonTerminalField extends
      */
     public COSBase getDefaultValue()
     {
-        return dictionary.getDictionaryObject(COSName.DV);
+        return getCOSObject().getDictionaryObject(COSName.DV);
     }
 
     /**
@@ -220,6 +220,6 @@ public class PDNonTerminalField extends
      */
     public void setDefaultValue(COSBase value)
     {
-        dictionary.setItem(COSName.V, value);
+        getCOSObject().setItem(COSName.V, value);
     }
 }

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=1704113&r1=1704112&r2=1704113&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
Sun Sep 20 09:30:48 2015
@@ -74,7 +74,7 @@ public final class PDRadioButton extends
      */
     public void setRadiosInUnison(boolean radiosInUnison)
     {
-        dictionary.setFlag(COSName.FF, FLAG_RADIOS_IN_UNISON, radiosInUnison);
+        getCOSObject().setFlag(COSName.FF, FLAG_RADIOS_IN_UNISON, radiosInUnison);
     }
 
     /**
@@ -83,7 +83,7 @@ public final class PDRadioButton extends
      */
     public boolean isRadiosInUnison()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_RADIOS_IN_UNISON);
+        return getCOSObject().getFlag(COSName.FF, FLAG_RADIOS_IN_UNISON);
     }
 
     /**
@@ -179,7 +179,7 @@ public final class PDRadioButton extends
     public void setValue(String value) throws IOException
     {
         checkValue(value);        
-        dictionary.setName(COSName.V, value);
+        getCOSObject().setName(COSName.V, value);
         // update the appearance state (AS)
         for (PDAnnotationWidget widget : getWidgets())
         {
@@ -205,7 +205,7 @@ public final class PDRadioButton extends
     public void setDefaultValue(String value)
     {
         checkValue(value);        
-        dictionary.setName(COSName.DV, value);
+        getCOSObject().setName(COSName.DV, value);
     }    
 
     /**

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=1704113&r1=1704112&r2=1704113&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
Sun Sep 20 09:30:48 2015
@@ -44,7 +44,7 @@ public class PDSignatureField extends PD
     public PDSignatureField(PDAcroForm acroForm) throws IOException
     {
         super(acroForm);
-        dictionary.setItem(COSName.FT, COSName.SIG);
+        getCOSObject().setItem(COSName.FT, COSName.SIG);
         getWidgets().get(0).setLocked(true);
         getWidgets().get(0).setPrinted(true);
         setPartialName(generatePartialName());
@@ -72,7 +72,7 @@ public class PDSignatureField extends PD
         String fieldName = "Signature";
         Set<String> sigNames = new HashSet<String>();
         // fixme: this ignores non-terminal fields, so will miss any descendant signatures
-        for (PDField field : acroForm.getFields())
+        for (PDField field : getAcroForm().getFields())
         {
             if(field instanceof PDSignatureField)
             {
@@ -117,7 +117,7 @@ public class PDSignatureField extends PD
      */
     public void setValue(PDSignature value) throws IOException
     {
-        dictionary.setItem(COSName.V, value);
+        getCOSObject().setItem(COSName.V, value);
         applyChange();
     }
 
@@ -128,7 +128,7 @@ public class PDSignatureField extends PD
      */
     public void setDefaultValue(PDSignature value) throws IOException
     {
-        dictionary.setItem(COSName.DV, value);
+        getCOSObject().setItem(COSName.DV, value);
     }
 
     /**
@@ -138,7 +138,7 @@ public class PDSignatureField extends PD
      */
     public PDSignature getValue()
     {
-        COSBase value = dictionary.getDictionaryObject(COSName.V);
+        COSBase value = getCOSObject().getDictionaryObject(COSName.V);
         if (value == null)
         {
             return null;
@@ -153,7 +153,7 @@ public class PDSignatureField extends PD
      */
     public PDSignature getDefaultValue()
     {
-        COSBase value = dictionary.getDictionaryObject(COSName.DV);
+        COSBase value = getCOSObject().getDictionaryObject(COSName.DV);
         if (value == null)
         {
             return null;
@@ -177,7 +177,7 @@ public class PDSignatureField extends PD
      */
     public PDSeedValue getSeedValue()
     {
-        COSDictionary dict = (COSDictionary) dictionary.getDictionaryObject(COSName.SV);
+        COSDictionary dict = (COSDictionary) getCOSObject().getDictionaryObject(COSName.SV);
         PDSeedValue sv = null;
         if (dict != null)
         {
@@ -197,7 +197,7 @@ public class PDSignatureField extends PD
     {
         if (sv != null)
         {
-            dictionary.setItem(COSName.SV, sv);
+            getCOSObject().setItem(COSName.SV, sv);
         }
     }
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java?rev=1704113&r1=1704112&r2=1704113&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDTerminalField.java
Sun Sep 20 09:30:48 2015
@@ -66,21 +66,21 @@ public abstract class PDTerminalField ex
      */
     public void setActions(PDFormFieldAdditionalActions actions)
     {
-        dictionary.setItem(COSName.AA, actions);
+        getCOSObject().setItem(COSName.AA, actions);
     }
     
     @Override
     public int getFieldFlags()
     {
         int retval = 0;
-        COSInteger ff = (COSInteger) dictionary.getDictionaryObject(COSName.FF);
+        COSInteger ff = (COSInteger) getCOSObject().getDictionaryObject(COSName.FF);
         if (ff != null)
         {
             retval = ff.intValue();
         }
-        else if (parent != null)
+        else if (getParent() != null)
         {
-            retval = parent.getFieldFlags();
+            retval = getParent().getFieldFlags();
         }
         return retval;
     }
@@ -88,10 +88,10 @@ public abstract class PDTerminalField ex
     @Override
     public String getFieldType()
     {
-        String fieldType = dictionary.getNameAsString(COSName.FT);
-        if (fieldType == null && parent != null)
+        String fieldType = getCOSObject().getNameAsString(COSName.FT);
+        if (fieldType == null && getParent() != null)
         {
-            fieldType = parent.getFieldType();
+            fieldType = getParent().getFieldType();
         }
         return fieldType;
     }
@@ -145,7 +145,7 @@ public abstract class PDTerminalField ex
     {
         FDFField fdfField = new FDFField();
         fdfField.setPartialFieldName(getPartialName());
-        fdfField.setValue(dictionary.getDictionaryObject(COSName.V));
+        fdfField.setValue(getCOSObject().getDictionaryObject(COSName.V));
 
         // fixme: the old code which was here assumed that Kids were PDField instances,
         //        which is never true. They're annotation widgets.
@@ -161,11 +161,11 @@ public abstract class PDTerminalField ex
     public List<PDAnnotationWidget> getWidgets()
     {
         List<PDAnnotationWidget> widgets = new ArrayList<PDAnnotationWidget>();
-        COSArray kids = (COSArray)dictionary.getDictionaryObject(COSName.KIDS);
+        COSArray kids = (COSArray)getCOSObject().getDictionaryObject(COSName.KIDS);
         if (kids == null)
         {
             // the field itself is a widget
-            widgets.add(new PDAnnotationWidget(dictionary));
+            widgets.add(new PDAnnotationWidget(getCOSObject()));
         }
         else if (kids.size() > 0)
         {
@@ -190,7 +190,7 @@ public abstract class PDTerminalField ex
     public void setWidgets(List<PDAnnotationWidget> children)
     {
         COSArray kidsArray = COSArrayList.converterToCOSArray(children);
-        dictionary.setItem(COSName.KIDS, kidsArray);
+        getCOSObject().setItem(COSName.KIDS, kidsArray);
     }
     
     /**
@@ -215,7 +215,7 @@ public abstract class PDTerminalField ex
      */
     protected final void applyChange() throws IOException
     {
-        if (!acroForm.getNeedAppearances())
+        if (!getAcroForm().getNeedAppearances())
         {
             constructAppearances();
         }

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=1704113&r1=1704112&r2=1704113&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
Sun Sep 20 09:30:48 2015
@@ -44,7 +44,7 @@ public final class PDTextField extends P
     public PDTextField(PDAcroForm acroForm)
     {
         super(acroForm);
-        dictionary.setItem(COSName.FT, COSName.TX);
+        getCOSObject().setItem(COSName.FT, COSName.TX);
     }
 
     /**
@@ -64,7 +64,7 @@ public final class PDTextField extends P
      */
     public boolean isMultiline()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_MULTILINE);
+        return getCOSObject().getFlag(COSName.FF, FLAG_MULTILINE);
     }
 
     /**
@@ -74,7 +74,7 @@ public final class PDTextField extends P
      */
     public void setMultiline(boolean multiline)
     {
-        dictionary.setFlag(COSName.FF, FLAG_MULTILINE, multiline);
+        getCOSObject().setFlag(COSName.FF, FLAG_MULTILINE, multiline);
     }
 
     /**
@@ -82,7 +82,7 @@ public final class PDTextField extends P
      */
     public boolean isPassword()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_PASSWORD);
+        return getCOSObject().getFlag(COSName.FF, FLAG_PASSWORD);
     }
 
     /**
@@ -92,7 +92,7 @@ public final class PDTextField extends P
      */
     public void setPassword(boolean password)
     {
-        dictionary.setFlag(COSName.FF, FLAG_PASSWORD, password);
+        getCOSObject().setFlag(COSName.FF, FLAG_PASSWORD, password);
     }
 
     /**
@@ -100,7 +100,7 @@ public final class PDTextField extends P
      */
     public boolean isFileSelect()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_FILE_SELECT);
+        return getCOSObject().getFlag(COSName.FF, FLAG_FILE_SELECT);
     }
 
     /**
@@ -110,7 +110,7 @@ public final class PDTextField extends P
      */
     public void setFileSelect(boolean fileSelect)
     {
-        dictionary.setFlag(COSName.FF, FLAG_FILE_SELECT, fileSelect);
+        getCOSObject().setFlag(COSName.FF, FLAG_FILE_SELECT, fileSelect);
     }
 
     /**
@@ -118,7 +118,7 @@ public final class PDTextField extends P
      */
     public boolean doNotSpellCheck()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK);
+        return getCOSObject().getFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK);
     }
 
     /**
@@ -128,7 +128,7 @@ public final class PDTextField extends P
      */
     public void setDoNotSpellCheck(boolean doNotSpellCheck)
     {
-        dictionary.setFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck);
+        getCOSObject().setFlag(COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck);
     }
 
     /**
@@ -136,7 +136,7 @@ public final class PDTextField extends P
      */
     public boolean doNotScroll()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_DO_NOT_SCROLL);
+        return getCOSObject().getFlag(COSName.FF, FLAG_DO_NOT_SCROLL);
     }
 
     /**
@@ -146,7 +146,7 @@ public final class PDTextField extends P
      */
     public void setDoNotScroll(boolean doNotScroll)
     {
-        dictionary.setFlag(COSName.FF, FLAG_DO_NOT_SCROLL, doNotScroll);
+        getCOSObject().setFlag(COSName.FF, FLAG_DO_NOT_SCROLL, doNotScroll);
     }
 
     /**
@@ -154,7 +154,7 @@ public final class PDTextField extends P
      */
     public boolean isComb()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_COMB);
+        return getCOSObject().getFlag(COSName.FF, FLAG_COMB);
     }
 
     /**
@@ -164,7 +164,7 @@ public final class PDTextField extends P
      */
     public void setComb(boolean comb)
     {
-        dictionary.setFlag(COSName.FF, FLAG_COMB, comb);
+        getCOSObject().setFlag(COSName.FF, FLAG_COMB, comb);
     }
 
     /**
@@ -172,7 +172,7 @@ public final class PDTextField extends P
      */
     public boolean isRichText()
     {
-        return dictionary.getFlag(COSName.FF, FLAG_RICH_TEXT);
+        return getCOSObject().getFlag(COSName.FF, FLAG_RICH_TEXT);
     }
 
     /**
@@ -182,7 +182,7 @@ public final class PDTextField extends P
      */
     public void setRichText(boolean richText)
     {
-        dictionary.setFlag(COSName.FF, FLAG_RICH_TEXT, richText);
+        getCOSObject().setFlag(COSName.FF, FLAG_RICH_TEXT, richText);
     }
     
     /**
@@ -192,7 +192,7 @@ public final class PDTextField extends P
      */
     public int getMaxLen()
     {
-        return dictionary.getInt(COSName.MAX_LEN);
+        return getCOSObject().getInt(COSName.MAX_LEN);
     }
 
     /**
@@ -202,7 +202,7 @@ public final class PDTextField extends P
      */
     public void setMaxLen(int maxLen)
     {
-        dictionary.setInt(COSName.MAX_LEN, maxLen);
+        getCOSObject().setInt(COSName.MAX_LEN, maxLen);
     }
 
     /**
@@ -213,7 +213,7 @@ public final class PDTextField extends P
      */
     public void setValue(String value) throws IOException
     {
-        dictionary.setString(COSName.V, value);
+        getCOSObject().setString(COSName.V, value);
         applyChange();
     }
 
@@ -225,7 +225,7 @@ public final class PDTextField extends P
      */
     public void setDefaultValue(String value) throws IOException
     {
-        dictionary.setString(COSName.DV, value);
+        getCOSObject().setString(COSName.DV, value);
     }
 
     /**

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=1704113&r1=1704112&r2=1704113&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
Sun Sep 20 09:30:48 2015
@@ -105,7 +105,7 @@ public abstract class PDVariableText ext
      */
     public void setDefaultAppearance(String daValue)
     {
-        dictionary.setString(COSName.DA, daValue);
+        getCOSObject().setString(COSName.DA, daValue);
     }
 
     /**
@@ -118,7 +118,7 @@ public abstract class PDVariableText ext
      */
     public String getDefaultStyleString()
     {
-        COSString defaultStyleString = (COSString) dictionary.getDictionaryObject(COSName.DS);
+        COSString defaultStyleString = (COSString) getCOSObject().getDictionaryObject(COSName.DS);
         return defaultStyleString.getString();
     }
 
@@ -133,11 +133,11 @@ public abstract class PDVariableText ext
     {
         if (defaultStyleString != null)
         {
-            dictionary.setItem(COSName.DS, new COSString(defaultStyleString));
+            getCOSObject().setItem(COSName.DS, new COSString(defaultStyleString));
         }
         else
         {
-            dictionary.removeItem(COSName.DS);
+            getCOSObject().removeItem(COSName.DS);
         }
     }    
 
@@ -173,7 +173,7 @@ public abstract class PDVariableText ext
      */
     public void setQ(int q)
     {
-        dictionary.setInt(COSName.Q, q);
+        getCOSObject().setInt(COSName.Q, q);
     }
     
     /**
@@ -206,11 +206,11 @@ public abstract class PDVariableText ext
     {
         if (richTextValue != null)
         {
-            dictionary.setItem(COSName.RV, new COSString(richTextValue));
+            getCOSObject().setItem(COSName.RV, new COSString(richTextValue));
         }
         else
         {
-            dictionary.removeItem(COSName.RV);
+            getCOSObject().removeItem(COSName.RV);
         }        
     }
 



Mime
View raw message