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/06/11 17:02:36 UTC

svn commit: r1684913 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf: FDFAnnotationPolygon.java FDFAnnotationPolyline.java

Author: tilman
Date: Thu Jun 11 15:02:35 2015
New Revision: 1684913

URL: http://svn.apache.org/r1684913
Log:
PDFBOX-2576: split long constructor

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java?rev=1684913&r1=1684912&r2=1684913&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java Thu Jun 11 15:02:35 2015
@@ -75,6 +75,17 @@ public class FDFAnnotationPolygon extend
         super(element);
         annot.setName(COSName.SUBTYPE, SUBTYPE);
 
+        initVertices(element);
+        String color = element.getAttribute("interior-color");
+        if (color != null && color.length() == 7 && color.charAt(0) == '#')
+        {
+            int colorValue = Integer.parseInt(color.substring(1, 7), 16);
+            setInteriorColor(new Color(colorValue));
+        }
+    }
+
+    private void initVertices(Element element) throws IOException, NumberFormatException
+    {
         XPath xpath = XPathFactory.newInstance().newXPath();
         try
         {
@@ -95,12 +106,6 @@ public class FDFAnnotationPolygon extend
         {
             LOG.debug("Error while evaluating XPath expression for polygon vertices");
         }
-        String color = element.getAttribute("interior-color");
-        if (color != null && color.length() == 7 && color.charAt(0) == '#')
-        {
-            int colorValue = Integer.parseInt(color.substring(1, 7), 16);
-            setInteriorColor(new Color(colorValue));
-        }
     }
 
     /**

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java?rev=1684913&r1=1684912&r2=1684913&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java Thu Jun 11 15:02:35 2015
@@ -76,6 +76,12 @@ public class FDFAnnotationPolyline exten
         super(element);
         annot.setName(COSName.SUBTYPE, SUBTYPE);
 
+        initVertices(element);
+        initStyles(element);
+    }
+
+    private void initVertices(Element element) throws IOException, NumberFormatException
+    {
         XPath xpath = XPathFactory.newInstance().newXPath();
         try
         {
@@ -96,7 +102,10 @@ public class FDFAnnotationPolyline exten
         {
             LOG.debug("Error while evaluating XPath expression for polyline vertices");
         }
+    }
 
+    private void initStyles(Element element) throws NumberFormatException
+    {
         String startStyle = element.getAttribute("head");
         if (startStyle != null && !startStyle.isEmpty())
         {