pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1643678 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java
Date Sun, 07 Dec 2014 14:05:23 GMT
Author: msahyoun
Date: Sun Dec  7 14:05:22 2014
New Revision: 1643678

URL: http://svn.apache.org/r1643678
Log:
PDFBOX-2516 fix inheritable for the DA (default appearance) attribute

Modified:
    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/PDVariableText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java?rev=1643678&r1=1643677&r2=1643678&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 Dec  7 14:05:22 2014
@@ -213,40 +213,28 @@ public abstract class PDVariableText ext
     /**
      * Get the default appearance.
      * 
+     * This is an inheritable attribute.
+     * 
+     * The default appearance contains a set of default graphics and text operators
+     * to define the field’s text size and color.
+     * 
      * @return the DA element of the dictionary object
      */
     public COSString getDefaultAppearance()
     {
-        if (defaultAppearance == null)
-        {
-            COSBase daValue =  getDictionary().getItem(COSName.DA);
-            if (daValue != null)
-            {
-                defaultAppearance = (COSString)daValue;
-            }
-        }
-        // the default appearance is inheritable
-        // maybe the parent provides a default appearance
-        if (defaultAppearance == null)
-        {
-            PDFieldTreeNode parent = getParent();
-            if (parent instanceof PDVariableText)
-            {
-                defaultAppearance = ((PDVariableText)parent).getDefaultAppearance();
-            }
-        }
-        // the default appearance is inheritable
-        // the acroform should provide a default appearance
-        if (defaultAppearance == null)
-        {
-            defaultAppearance = getAcroForm().getDefaultAppearance(); 
-        }
+        COSBase daValue = getInheritableAttribute(getDictionary(),COSName.DA);
+        defaultAppearance = (COSString) daValue;
         return defaultAppearance;
     }
 
     /**
      * Set the default appearance.
      * 
+     * This will set the local default appearance for the variable text field only not 
+     * affecting a default appearance in the parent hierarchy.
+     * 
+     * Providing null as the value will remove the local default appearance.
+     * 
      * @param daValue a string describing the default appearance
      */
     public void setDefaultAppearance(String daValue)



Mime
View raw message