pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1831900 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers: PDAbstractAppearanceHandler.java PDLineAppearanceHandler.java
Date Sat, 19 May 2018 15:21:47 GMT
Author: tilman
Date: Sat May 19 15:21:47 2018
New Revision: 1831900

URL: http://svn.apache.org/viewvc?rev=1831900&view=rev
Log:
PDFBOX-3353: move styles sets up to abstract class because it will also be used by polyline
handler

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java?rev=1831900&r1=1831899&r2=1831900&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
Sat May 19 15:21:47 2018
@@ -19,6 +19,9 @@ package org.apache.pdfbox.pdmodel.intera
 
 import java.awt.geom.AffineTransform;
 import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.pdmodel.PDResources;
@@ -28,6 +31,7 @@ import org.apache.pdfbox.pdmodel.graphic
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationSquareCircle;
 import org.apache.pdfbox.pdmodel.PDAppearanceContentStream;
+import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLine;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceEntry;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
@@ -42,7 +46,39 @@ import org.apache.pdfbox.pdmodel.interac
 public abstract class PDAbstractAppearanceHandler implements PDAppearanceHandler
 {
     private final PDAnnotation annotation;
-    
+
+    /**
+     * Line ending styles where the line has to be drawn shorter (minus line width).
+     */
+    protected static final Set<String> SHORT_STYLES = createShortStyles();
+
+    /**
+     * Line ending styles where there is an interior color.
+     */
+    protected static final Set<String> INTERIOR_COLOR_STYLES = createInteriorColorStyles();
+
+    private static Set<String> createShortStyles()
+    {
+        Set<String> shortStyles = new HashSet<>();
+        shortStyles.add(PDAnnotationLine.LE_OPEN_ARROW);
+        shortStyles.add(PDAnnotationLine.LE_CLOSED_ARROW);
+        shortStyles.add(PDAnnotationLine.LE_SQUARE);
+        shortStyles.add(PDAnnotationLine.LE_CIRCLE);
+        shortStyles.add(PDAnnotationLine.LE_DIAMOND);
+        return Collections.unmodifiableSet(shortStyles);
+    }
+
+    private static Set<String> createInteriorColorStyles()
+    {
+        Set<String> interiorColorStyles = new HashSet<>();
+        interiorColorStyles.add(PDAnnotationLine.LE_CLOSED_ARROW);
+        interiorColorStyles.add(PDAnnotationLine.LE_CIRCLE);
+        interiorColorStyles.add(PDAnnotationLine.LE_DIAMOND);
+        interiorColorStyles.add(PDAnnotationLine.LE_R_CLOSED_ARROW);
+        interiorColorStyles.add(PDAnnotationLine.LE_SQUARE);
+        return Collections.unmodifiableSet(interiorColorStyles);
+    }
+
     public PDAbstractAppearanceHandler(PDAnnotation annotation)
     {
         this.annotation = annotation;

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java?rev=1831900&r1=1831899&r2=1831900&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java
Sat May 19 15:21:47 2018
@@ -17,8 +17,6 @@
 package org.apache.pdfbox.pdmodel.interactive.annotation.handlers;
 
 import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
@@ -39,31 +37,6 @@ public class PDLineAppearanceHandler ext
     static final double ARROW_ANGLE = Math.toRadians(30);
     static final int FONT_SIZE = 9;
 
-    /**
-     * styles where the line has to be drawn shorter (minus line width).
-     */
-    private static final Set<String> SHORT_STYLES = new HashSet<>();
-
-    /**
-     * styles where there is an interior color.
-     */
-    private static final Set<String> INTERIOR_COLOR_STYLES = new HashSet<>();
-
-    static
-    {
-        SHORT_STYLES.add(PDAnnotationLine.LE_OPEN_ARROW);
-        SHORT_STYLES.add(PDAnnotationLine.LE_CLOSED_ARROW);
-        SHORT_STYLES.add(PDAnnotationLine.LE_SQUARE);
-        SHORT_STYLES.add(PDAnnotationLine.LE_CIRCLE);
-        SHORT_STYLES.add(PDAnnotationLine.LE_DIAMOND);
-
-        INTERIOR_COLOR_STYLES.add(PDAnnotationLine.LE_CLOSED_ARROW);
-        INTERIOR_COLOR_STYLES.add(PDAnnotationLine.LE_CIRCLE);
-        INTERIOR_COLOR_STYLES.add(PDAnnotationLine.LE_DIAMOND);
-        INTERIOR_COLOR_STYLES.add(PDAnnotationLine.LE_R_CLOSED_ARROW);
-        INTERIOR_COLOR_STYLES.add(PDAnnotationLine.LE_SQUARE);
-    }
-
     public PDLineAppearanceHandler(PDAnnotation annotation)
     {
         super(annotation);



Mime
View raw message