You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/07/01 17:24:21 UTC

svn commit: r1688669 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form: PDButton.java PDRadioButton.java

Author: tilman
Date: Wed Jul  1 15:24:21 2015
New Revision: 1688669

URL: http://svn.apache.org/r1688669
Log:
PDFBOX-2849: field with no widgets is itself the widget

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/PDRadioButton.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=1688669&r1=1688668&r2=1688669&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 Wed Jul  1 15:24:21 2015
@@ -27,6 +27,8 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
+import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
 
 /**
  * A button field represents an interactive control on the screen
@@ -221,22 +223,16 @@ public abstract class PDButton extends P
     @Override
     void constructAppearances() throws IOException
     {
-        boolean hasAppearance = false;
-        COSBase apBase = dictionary.getDictionaryObject(COSName.AP);
-        if (apBase instanceof COSDictionary)
-        {
-            COSDictionary apDict = (COSDictionary) apBase;
-            COSBase nBase = apDict.getDictionaryObject(COSName.N);
-            if (nBase instanceof COSDictionary)
-            {
-                COSDictionary nDict = (COSDictionary) apBase;
-                hasAppearance = nDict.size() > 0;
-            }            
-        }
-        if (!hasAppearance)
+        for (PDAnnotationWidget widget : getWidgets())
         {
-            // TODO: implement appearance generation for buttons
-            throw new UnsupportedOperationException("Appearance generation is not implemented yet, see PDFBOX-2849");
+            PDAppearanceDictionary appearance = widget.getAppearance();
+            if (appearance == null || appearance.getNormalAppearance() == null)
+            {
+                // TODO: implement appearance generation for radio buttons
+                throw new UnsupportedOperationException("Appearance generation is not implemented yet, see PDFBOX-2849");
+            }
         }
-    }
+    }  
+
+    
 }

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=1688669&r1=1688668&r2=1688669&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 Wed Jul  1 15:24:21 2015
@@ -23,7 +23,6 @@ import org.apache.pdfbox.cos.COSDictiona
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
-import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceEntry;
 
 /**
@@ -199,20 +198,6 @@ public final class PDRadioButton extends
         applyChange();
     }
     
-    @Override
-    void constructAppearances() throws IOException
-    {
-        for (PDAnnotationWidget widget : getWidgets())
-        {
-            PDAppearanceDictionary appearance = widget.getAppearance();
-            if (appearance == null || appearance.getNormalAppearance() == null)
-            {
-                // TODO: implement appearance generation for radio buttons
-                throw new UnsupportedOperationException("Appearance generation is not implemented yet, see PDFBOX-2849");
-            }
-        }
-    }  
-
     /**
      * Sets the default value.
      *