You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2011/01/29 18:51:05 UTC

svn commit: r1065086 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox: cos/ pdmodel/fdf/ pdmodel/interactive/annotation/ pdmodel/interactive/documentnavigation/outline/ pdmodel/interactive/form/ util/

Author: lehmi
Date: Sat Jan 29 17:51:04 2011
New Revision: 1065086

URL: http://svn.apache.org/viewvc?rev=1065086&view=rev
Log:
PDFBOX-952: using both the name and the abbreviated name to get the parent entry, added some more COSName constants

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem.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/PDRadioCollection.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDVariableText.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/BitFlagHelper.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java Sat Jan 29 17:51:04 2011
@@ -78,8 +78,16 @@ public final class COSName extends COSBa
     /**
     * A common COSName value.
     */
+    public static final COSName ANNOT = new COSName( "Annot" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName ANNOTS = new COSName( "Annots" );
     /**
+     * A common COSName value.
+     */
+    public static final COSName AP_REF = new COSName( "APRef" );
+    /**
      * "Artifact"
      */
     public static final COSName ARTIFACT = new COSName("Artifact");
@@ -90,6 +98,10 @@ public final class COSName extends COSBa
     /**
     * A common COSName value.
     */
+    public static final COSName AS = new COSName( "AS" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName ASCII85_DECODE = new COSName( "ASCII85Decode" );
     /**
     * A common COSName value.
@@ -269,6 +281,14 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName CLR_F = new COSName( "ClrF" );
+    /**
+     * A common COSName value.
+     */
+    public static final COSName CLR_FF = new COSName( "ClrFf" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName CREATION_DATE = new COSName( "CreationDate" );
     /**
      * A common COSName value.
@@ -293,6 +313,10 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName DA = new COSName( "DA" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName DCT_DECODE = new COSName( "DCTDecode" );
     /**
      * A common COSName value.
@@ -420,6 +444,10 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName FF = new COSName( "Ff" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName FIELDS = new COSName( "Fields" );
     /**
     * A common COSName value.
@@ -500,6 +528,10 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName FT = new COSName( "FT" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName FUNCTION_TYPE = new COSName( "FunctionType" );
     /**
      * A common COSName value.
@@ -632,6 +664,10 @@ public final class COSName extends COSBa
     */
     public static final COSName LZW_DECODE_ABBREVIATION = new COSName( "LZW" );
     /**
+     * A common COSName value.
+     */
+    public static final COSName M = new COSName( "M" );
+    /**
     * A common COSName value.
     */
     public static final COSName MAC_ROMAN_ENCODING = new COSName( "MacRomanEncoding" );
@@ -691,6 +727,14 @@ public final class COSName extends COSBa
     /** "Names" */
     public static final COSName NAMES = new COSName( "Names" );
 
+    /**
+     * A common COSName value.
+     */
+    public static final COSName NEXT = new COSName( "Next" );
+    /**
+     * A common COSName value.
+     */
+    public static final COSName NM = new COSName( "NM" );
     /** "Nums" */
     public static final COSName NUMS = new COSName( "Nums" );
 
@@ -730,6 +774,10 @@ public final class COSName extends COSBa
      * A common COSName value.
      */
     public static final COSName OPM = new COSName( "OPM" );
+    /**
+     * A common COSName value.
+     */
+    public static final COSName OPT = new COSName( "Opt" );
     /** "Outlines" */
     public static final COSName OUTLINES = new COSName("Outlines");
 
@@ -808,6 +856,10 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName Q = new COSName( "Q" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName R = new COSName( "R" );
     /**
      * A common COSName value.
@@ -820,6 +872,10 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName RECT = new COSName( "Rect" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName REGISTRY = new COSName( "Registry" );
     /**
     * A common COSName value.
@@ -854,6 +910,10 @@ public final class COSName extends COSBa
     */
     public static final COSName RUN_LENGTH_DECODE_ABBREVIATION = new COSName( "RL" );
     /**
+     * A common COSName value.
+     */
+    public static final COSName RV = new COSName( "RV" );
+    /**
      * "S"
      */
     public static final COSName S = new COSName("S");
@@ -862,9 +922,21 @@ public final class COSName extends COSBa
      */
     public static final COSName SA = new COSName( "SA" );
     /**
-    * A common COSName value.
-    */
+     * A common COSName value.
+     */
+    public static final COSName SE = new COSName( "SE" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName SEPARATION = new COSName( "Separation" );
+    /**
+     * A common COSName value.
+     */
+    public static final COSName SET_F = new COSName( "SetF" );
+    /**
+     * A common COSName value.
+     */
+    public static final COSName SET_FF = new COSName( "SetFf" );
 
     /** "Shading" */
     public static final COSName SHADING = new COSName( "Shading" );
@@ -914,6 +986,10 @@ public final class COSName extends COSBa
     /**
     * A common COSName value.
     */
+    public static final COSName SUBJ = new COSName( "Subj" );
+    /**
+     * A common COSName value.
+     */
     public static final COSName SUBJECT = new COSName( "Subject" );
     /**
      * A common COSName value.
@@ -957,6 +1033,10 @@ public final class COSName extends COSBa
     */
     public static final COSName TO_UNICODE = new COSName( "ToUnicode" );
     /**
+     * A common COSName value.
+     */
+    public static final COSName TU = new COSName("TU" );
+    /**
     * A common COSName value.
     */
     public static final COSName TYPE = new COSName( "Type" );

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java Sat Jan 29 17:51:04 2011
@@ -23,7 +23,6 @@ import java.util.Calendar;
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSNumber;
 
@@ -304,7 +303,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isInvisible()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_INVISIBLE );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_INVISIBLE );
     }
 
     /**
@@ -314,7 +313,7 @@ public abstract class FDFAnnotation impl
      */
     public void setInvisible( boolean invisible )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_INVISIBLE, invisible );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_INVISIBLE, invisible );
     }
 
     /**
@@ -324,7 +323,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isHidden()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_HIDDEN );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_HIDDEN );
     }
 
     /**
@@ -334,7 +333,7 @@ public abstract class FDFAnnotation impl
      */
     public void setHidden( boolean hidden )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_HIDDEN, hidden );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_HIDDEN, hidden );
     }
 
     /**
@@ -344,7 +343,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isPrinted()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_PRINTED );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_PRINTED );
     }
 
     /**
@@ -354,7 +353,7 @@ public abstract class FDFAnnotation impl
      */
     public void setPrinted( boolean printed )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_PRINTED, printed );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_PRINTED, printed );
     }
 
     /**
@@ -364,7 +363,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isNoZoom()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_NO_ZOOM );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_NO_ZOOM );
     }
 
     /**
@@ -374,7 +373,7 @@ public abstract class FDFAnnotation impl
      */
     public void setNoZoom( boolean noZoom )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_NO_ZOOM, noZoom );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_NO_ZOOM, noZoom );
     }
 
     /**
@@ -384,7 +383,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isNoRotate()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_NO_ROTATE );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_NO_ROTATE );
     }
 
     /**
@@ -394,7 +393,7 @@ public abstract class FDFAnnotation impl
      */
     public void setNoRotate( boolean noRotate )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_NO_ROTATE, noRotate );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_NO_ROTATE, noRotate );
     }
 
     /**
@@ -404,7 +403,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isNoView()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_NO_VIEW );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_NO_VIEW );
     }
 
     /**
@@ -414,7 +413,7 @@ public abstract class FDFAnnotation impl
      */
     public void setNoView( boolean noView )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_NO_VIEW, noView );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_NO_VIEW, noView );
     }
 
     /**
@@ -424,7 +423,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isReadOnly()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_READ_ONLY );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_READ_ONLY );
     }
 
     /**
@@ -434,7 +433,7 @@ public abstract class FDFAnnotation impl
      */
     public void setReadOnly( boolean readOnly )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_READ_ONLY, readOnly );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_READ_ONLY, readOnly );
     }
 
     /**
@@ -444,7 +443,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isLocked()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_LOCKED );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_LOCKED );
     }
 
     /**
@@ -454,7 +453,7 @@ public abstract class FDFAnnotation impl
      */
     public void setLocked( boolean locked )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_LOCKED, locked );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_LOCKED, locked );
     }
 
     /**
@@ -464,7 +463,7 @@ public abstract class FDFAnnotation impl
      */
     public boolean isToggleNoView()
     {
-        return BitFlagHelper.getFlag( annot, "F", PDAnnotation.FLAG_TOGGLE_NO_VIEW );
+        return BitFlagHelper.getFlag( annot, COSName.F, PDAnnotation.FLAG_TOGGLE_NO_VIEW );
     }
 
     /**
@@ -474,7 +473,7 @@ public abstract class FDFAnnotation impl
      */
     public void setToggleNoView( boolean toggleNoView )
     {
-        BitFlagHelper.setFlag( annot, "F", PDAnnotation.FLAG_TOGGLE_NO_VIEW, toggleNoView );
+        BitFlagHelper.setFlag( annot, COSName.F, PDAnnotation.FLAG_TOGGLE_NO_VIEW, toggleNoView );
     }
 
     /**
@@ -484,7 +483,7 @@ public abstract class FDFAnnotation impl
      */
     public void setName( String name )
     {
-        annot.setString( "NM", name );
+        annot.setString( COSName.NM, name );
     }
 
     /**
@@ -494,7 +493,7 @@ public abstract class FDFAnnotation impl
      */
     public String getName()
     {
-        return annot.getString( "NM" );
+        return annot.getString( COSName.NM );
     }
 
     /**
@@ -504,7 +503,7 @@ public abstract class FDFAnnotation impl
      */
     public void setRectangle( PDRectangle rectangle )
     {
-        annot.setItem( "Rect", rectangle );
+        annot.setItem( COSName.RECT, rectangle );
     }
 
     /**
@@ -515,7 +514,7 @@ public abstract class FDFAnnotation impl
     public PDRectangle getRectangle()
     {
         PDRectangle retval = null;
-        COSArray rectArray = (COSArray)annot.getDictionaryObject( "Rect" );
+        COSArray rectArray = (COSArray)annot.getDictionaryObject( COSName.RECT );
         if( rectArray != null )
         {
             retval = new PDRectangle( rectArray );
@@ -531,7 +530,7 @@ public abstract class FDFAnnotation impl
      */
     public void setTitle( String title )
     {
-        annot.setString( "T", title );
+        annot.setString( COSName.T, title );
     }
 
     /**
@@ -541,7 +540,7 @@ public abstract class FDFAnnotation impl
      */
     public String getTitle()
     {
-        return annot.getString( "T" );
+        return annot.getString( COSName.T );
     }
 
     /**
@@ -553,7 +552,7 @@ public abstract class FDFAnnotation impl
      */
     public Calendar getCreationDate() throws IOException
     {
-        return annot.getDate( "CreationDate" );
+        return annot.getDate( COSName.CREATION_DATE );
     }
 
     /**
@@ -563,7 +562,7 @@ public abstract class FDFAnnotation impl
      */
     public void setCreationDate( Calendar date )
     {
-        annot.setDate( "CreationDate", date );
+        annot.setDate( COSName.CREATION_DATE, date );
     }
 
     /**
@@ -573,7 +572,7 @@ public abstract class FDFAnnotation impl
      */
     public void setOpacity( float opacity )
     {
-        annot.setFloat( "CA", opacity );
+        annot.setFloat( COSName.CA, opacity );
     }
 
     /**
@@ -583,7 +582,7 @@ public abstract class FDFAnnotation impl
      */
     public float getOpacity()
     {
-        return annot.getFloat( "CA", 1f );
+        return annot.getFloat( COSName.CA, 1f );
 
     }
 
@@ -594,7 +593,7 @@ public abstract class FDFAnnotation impl
      */
     public void setSubject( String subject )
     {
-        annot.setString( "Subj", subject );
+        annot.setString( COSName.SUBJ, subject );
     }
 
     /**
@@ -604,6 +603,6 @@ public abstract class FDFAnnotation impl
      */
     public String getSubject()
     {
-        return annot.getString( "Subj" );
+        return annot.getString( COSName.SUBJ );
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java Sat Jan 29 17:51:04 2011
@@ -86,7 +86,7 @@ public class FDFField implements COSObje
         this();
         this.setPartialFieldName( fieldXML.getAttribute( "name" ) );
         NodeList nodeList = fieldXML.getChildNodes();
-        List kids = new ArrayList();
+        List<FDFField> kids = new ArrayList<FDFField>();
         for( int i=0; i<nodeList.getLength(); i++ )
         {
             Node node = nodeList.item( i );
@@ -134,7 +134,7 @@ public class FDFField implements COSObje
         {
             output.write( "<value-richtext>" + rt.getAsString() + "</value-richtext>\n" );
         }
-        List kids = getKids();
+        List<FDFField> kids = getKids();
         if( kids != null )
         {
             for( int i=0; i<kids.size(); i++ )
@@ -171,13 +171,13 @@ public class FDFField implements COSObje
      *
      * @return The list of kids.
      */
-    public List getKids()
+    public List<FDFField> getKids()
     {
-        COSArray kids = (COSArray)field.getDictionaryObject( "Kids" );
-        List retval = null;
+        COSArray kids = (COSArray)field.getDictionaryObject( COSName.KIDS );
+        List<FDFField> retval = null;
         if( kids != null )
         {
-            List actuals = new ArrayList();
+            List<FDFField> actuals = new ArrayList<FDFField>();
             for( int i=0; i<kids.size(); i++ )
             {
                 actuals.add( new FDFField( (COSDictionary)kids.getObject( i ) ) );
@@ -192,9 +192,9 @@ public class FDFField implements COSObje
      *
      * @param kids A list of FDFField objects.
      */
-    public void setKids( List kids )
+    public void setKids( List<FDFField> kids )
     {
-        field.setItem( "Kids", COSArrayList.converterToCOSArray( kids ) );
+        field.setItem( COSName.KIDS, COSArrayList.converterToCOSArray( kids ) );
     }
 
     /**
@@ -208,7 +208,7 @@ public class FDFField implements COSObje
      */
     public String getPartialFieldName()
     {
-        return field.getString( "T" );
+        return field.getString( COSName.T );
     }
 
     /**
@@ -218,7 +218,7 @@ public class FDFField implements COSObje
      */
     public void setPartialFieldName( String partial )
     {
-        field.setString( "T", partial );
+        field.setString( COSName.T, partial );
     }
 
     /**
@@ -234,7 +234,7 @@ public class FDFField implements COSObje
     public Object getValue() throws IOException
     {
         Object retval = null;
-        COSBase value = field.getDictionaryObject( "V" );
+        COSBase value = field.getDictionaryObject( COSName.V );
         if( value instanceof COSName )
         {
             retval = ((COSName)value).getName();
@@ -289,7 +289,7 @@ public class FDFField implements COSObje
         {
             throw new IOException( "Error:Unknown type for field import" + value );
         }
-        field.setItem( "V", cos );
+        field.setItem( COSName.V, cos );
     }
 
     /**
@@ -301,7 +301,7 @@ public class FDFField implements COSObje
     public Integer getFieldFlags()
     {
         Integer retval = null;
-        COSNumber ff = (COSNumber)field.getDictionaryObject( "Ff" );
+        COSNumber ff = (COSNumber)field.getDictionaryObject( COSName.FF );
         if( ff != null )
         {
             retval = new Integer( ff.intValue() );
@@ -322,7 +322,7 @@ public class FDFField implements COSObje
         {
             value = COSInteger.get( ff );
         }
-        field.setItem( "Ff", value );
+        field.setItem( COSName.FF, value );
     }
 
     /**
@@ -333,7 +333,7 @@ public class FDFField implements COSObje
      */
     public void setFieldFlags( int ff )
     {
-        field.setInt( "Ff", ff );
+        field.setInt( COSName.FF, ff );
     }
 
     /**
@@ -345,7 +345,7 @@ public class FDFField implements COSObje
     public Integer getSetFieldFlags()
     {
         Integer retval = null;
-        COSNumber ff = (COSNumber)field.getDictionaryObject( "SetFf" );
+        COSNumber ff = (COSNumber)field.getDictionaryObject( COSName.SET_FF );
         if( ff != null )
         {
             retval = new Integer( ff.intValue() );
@@ -366,7 +366,7 @@ public class FDFField implements COSObje
         {
             value = COSInteger.get( ff );
         }
-        field.setItem( "SetFf", value );
+        field.setItem( COSName.SET_FF, value );
     }
 
     /**
@@ -377,7 +377,7 @@ public class FDFField implements COSObje
      */
     public void setSetFieldFlags( int ff )
     {
-        field.setInt( "SetFf", ff );
+        field.setInt( COSName.SET_FF, ff );
     }
 
     /**
@@ -389,7 +389,7 @@ public class FDFField implements COSObje
     public Integer getClearFieldFlags()
     {
         Integer retval = null;
-        COSNumber ff = (COSNumber)field.getDictionaryObject( "ClrFf" );
+        COSNumber ff = (COSNumber)field.getDictionaryObject( COSName.CLR_FF );
         if( ff != null )
         {
             retval = new Integer( ff.intValue() );
@@ -410,7 +410,7 @@ public class FDFField implements COSObje
         {
             value = COSInteger.get( ff );
         }
-        field.setItem( "ClrFf", value );
+        field.setItem( COSName.CLR_FF, value );
     }
 
     /**
@@ -421,7 +421,7 @@ public class FDFField implements COSObje
      */
     public void setClearFieldFlags( int ff )
     {
-        field.setInt( "ClrFf", ff );
+        field.setInt( COSName.CLR_FF, ff );
     }
 
     /**
@@ -454,7 +454,7 @@ public class FDFField implements COSObje
         {
             value = COSInteger.get( f );
         }
-        field.setItem( "F", value );
+        field.setItem( COSName.F, value );
     }
 
     /**
@@ -465,7 +465,7 @@ public class FDFField implements COSObje
      */
     public void setWidgetFieldFlags( int f )
     {
-        field.setInt( "F", f );
+        field.setInt( COSName.F, f );
     }
 
     /**
@@ -477,7 +477,7 @@ public class FDFField implements COSObje
     public Integer getSetWidgetFieldFlags()
     {
         Integer retval = null;
-        COSNumber ff = (COSNumber)field.getDictionaryObject( "SetF" );
+        COSNumber ff = (COSNumber)field.getDictionaryObject( COSName.SET_F );
         if( ff != null )
         {
             retval = new Integer( ff.intValue() );
@@ -498,7 +498,7 @@ public class FDFField implements COSObje
         {
             value = COSInteger.get( ff );
         }
-        field.setItem( "SetF", value );
+        field.setItem( COSName.SET_F, value );
     }
 
     /**
@@ -509,7 +509,7 @@ public class FDFField implements COSObje
      */
     public void setSetWidgetFieldFlags( int ff )
     {
-        field.setInt( "SetF", ff );
+        field.setInt( COSName.SET_F, ff );
     }
 
     /**
@@ -521,7 +521,7 @@ public class FDFField implements COSObje
     public Integer getClearWidgetFieldFlags()
     {
         Integer retval = null;
-        COSNumber ff = (COSNumber)field.getDictionaryObject( "ClrF" );
+        COSNumber ff = (COSNumber)field.getDictionaryObject( COSName.CLR_F );
         if( ff != null )
         {
             retval = new Integer( ff.intValue() );
@@ -542,7 +542,7 @@ public class FDFField implements COSObje
         {
             value = COSInteger.get( ff );
         }
-        field.setItem( "ClrF", value );
+        field.setItem( COSName.CLR_F, value );
     }
 
     /**
@@ -553,7 +553,7 @@ public class FDFField implements COSObje
      */
     public void setClearWidgetFieldFlags( int ff )
     {
-        field.setInt( "ClrF", ff );
+        field.setInt( COSName.CLR_F, ff );
     }
 
     /**
@@ -565,7 +565,7 @@ public class FDFField implements COSObje
     public PDAppearanceDictionary getAppearanceDictionary()
     {
         PDAppearanceDictionary retval = null;
-        COSDictionary dict = (COSDictionary)field.getDictionaryObject( "AP" );
+        COSDictionary dict = (COSDictionary)field.getDictionaryObject( COSName.AP );
         if( dict != null )
         {
             retval = new PDAppearanceDictionary( dict );
@@ -580,7 +580,7 @@ public class FDFField implements COSObje
      */
     public void setAppearanceDictionary( PDAppearanceDictionary ap )
     {
-        field.setItem( "AP", ap );
+        field.setItem( COSName.AP, ap );
     }
 
     /**
@@ -591,7 +591,7 @@ public class FDFField implements COSObje
     public FDFNamedPageReference getAppearanceStreamReference()
     {
         FDFNamedPageReference retval = null;
-        COSDictionary ref = (COSDictionary)field.getDictionaryObject( "APRef" );
+        COSDictionary ref = (COSDictionary)field.getDictionaryObject( COSName.AP_REF );
         if( ref != null )
         {
             retval = new FDFNamedPageReference( ref );
@@ -606,7 +606,7 @@ public class FDFField implements COSObje
      */
     public void setAppearanceStreamReference( FDFNamedPageReference ref )
     {
-        field.setItem( "APRef", ref );
+        field.setItem( COSName.AP_REF, ref );
     }
 
     /**
@@ -644,7 +644,7 @@ public class FDFField implements COSObje
     public List getOptions()
     {
         List retval = null;
-        COSArray array = (COSArray)field.getDictionaryObject( "Opt" );
+        COSArray array = (COSArray)field.getDictionaryObject( COSName.OPT );
         if( array != null )
         {
             List objects = new ArrayList();
@@ -675,7 +675,7 @@ public class FDFField implements COSObje
     public void setOptions( List options )
     {
         COSArray value = COSArrayList.converterToCOSArray( options );
-        field.setItem( "Opt", value );
+        field.setItem( COSName.OPT, value );
     }
 
     /**
@@ -685,7 +685,7 @@ public class FDFField implements COSObje
      */
     public PDAction getAction()
     {
-        return PDActionFactory.createAction( (COSDictionary)field.getDictionaryObject( "A" ) );
+        return PDActionFactory.createAction( (COSDictionary)field.getDictionaryObject( COSName.A ) );
     }
 
     /**
@@ -695,7 +695,7 @@ public class FDFField implements COSObje
      */
     public void setAction( PDAction a )
     {
-        field.setItem( "A", a );
+        field.setItem( COSName.A, a );
     }
 
     /**
@@ -707,7 +707,7 @@ public class FDFField implements COSObje
     public PDAdditionalActions getAdditionalActions()
     {
         PDAdditionalActions retval = null;
-        COSDictionary dict = (COSDictionary)field.getDictionaryObject( "AA" );
+        COSDictionary dict = (COSDictionary)field.getDictionaryObject( COSName.AA );
         if( dict != null )
         {
             retval = new PDAdditionalActions( dict );
@@ -723,7 +723,7 @@ public class FDFField implements COSObje
      */
     public void setAdditionalActions( PDAdditionalActions aa )
     {
-        field.setItem( "AA", aa );
+        field.setItem( COSName.AA, aa );
     }
 
     /**
@@ -733,7 +733,7 @@ public class FDFField implements COSObje
      */
     public PDTextStream getRichText()
     {
-        COSBase rv = field.getDictionaryObject( "RV" );
+        COSBase rv = field.getDictionaryObject( COSName.RV );
         return PDTextStream.createTextStream( rv );
     }
 
@@ -744,6 +744,6 @@ public class FDFField implements COSObje
      */
     public void setRichText( PDTextStream rv )
     {
-        field.setItem( "RV", rv );
+        field.setItem( COSName.RV, rv );
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java Sat Jan 29 17:51:04 2011
@@ -166,7 +166,7 @@ public abstract class PDAnnotation imple
     public PDAnnotation()
     {
         dictionary = new COSDictionary();
-        dictionary.setItem( COSName.TYPE, COSName.getPDFName( "Annot" ) );
+        dictionary.setItem( COSName.TYPE, COSName.ANNOT );
     }
 
     /**
@@ -198,7 +198,7 @@ public abstract class PDAnnotation imple
      */
     public PDRectangle getRectangle()
     {
-        COSArray rectArray = (COSArray)dictionary.getDictionaryObject( COSName.getPDFName( "Rect" ) );
+        COSArray rectArray = (COSArray)dictionary.getDictionaryObject( COSName.RECT );
         PDRectangle rectangle = null;
         if( rectArray != null )
         {
@@ -214,7 +214,7 @@ public abstract class PDAnnotation imple
      */
     public void setRectangle( PDRectangle rectangle )
     {
-        dictionary.setItem( COSName.getPDFName( "Rect" ), rectangle.getCOSArray() );
+        dictionary.setItem( COSName.RECT, rectangle.getCOSArray() );
     }
 
    /**
@@ -224,7 +224,7 @@ public abstract class PDAnnotation imple
      */
     public int getAnnotationFlags()
     {
-        return getDictionary().getInt( "F", 0 );
+        return getDictionary().getInt( COSName.F, 0 );
     }
 
     /**
@@ -234,7 +234,7 @@ public abstract class PDAnnotation imple
      */
     public void setAnnotationFlags( int flags )
     {
-        getDictionary().setInt( "F", flags );
+        getDictionary().setInt( COSName.F, flags );
     }
 
     /**
@@ -255,7 +255,7 @@ public abstract class PDAnnotation imple
     public String getAppearanceStream()
     {
         String retval = null;
-        COSName name = (COSName)getDictionary().getDictionaryObject( COSName.getPDFName( "AS" ) );
+        COSName name = (COSName)getDictionary().getDictionaryObject( COSName.AS );
         if( name != null )
         {
             retval = name.getName();
@@ -272,11 +272,11 @@ public abstract class PDAnnotation imple
     {
         if( as == null )
         {
-            getDictionary().removeItem( COSName.getPDFName( "AS" ) );
+            getDictionary().removeItem( COSName.AS );
         }
         else
         {
-            getDictionary().setItem( COSName.getPDFName( "AS" ), COSName.getPDFName( as ) );
+            getDictionary().setItem( COSName.AS, COSName.getPDFName( as ) );
         }
     }
 
@@ -289,7 +289,7 @@ public abstract class PDAnnotation imple
     public PDAppearanceDictionary getAppearance()
     {
         PDAppearanceDictionary ap = null;
-        COSDictionary apDic = (COSDictionary)dictionary.getDictionaryObject( COSName.getPDFName( "AP" ) );
+        COSDictionary apDic = (COSDictionary)dictionary.getDictionaryObject( COSName.AP );
         if( apDic != null )
         {
             ap = new PDAppearanceDictionary( apDic );
@@ -309,7 +309,7 @@ public abstract class PDAnnotation imple
         {
             ap = appearance.getDictionary();
         }
-        dictionary.setItem( COSName.getPDFName( "AP" ), ap );
+        dictionary.setItem( COSName.AP, ap );
     }
 
     /**
@@ -319,7 +319,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isInvisible()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_INVISIBLE );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_INVISIBLE );
     }
 
     /**
@@ -329,7 +329,7 @@ public abstract class PDAnnotation imple
      */
     public void setInvisible( boolean invisible )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_INVISIBLE, invisible );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_INVISIBLE, invisible );
     }
 
     /**
@@ -339,7 +339,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isHidden()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_HIDDEN );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_HIDDEN );
     }
 
     /**
@@ -349,7 +349,7 @@ public abstract class PDAnnotation imple
      */
     public void setHidden( boolean hidden )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_HIDDEN, hidden );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_HIDDEN, hidden );
     }
 
     /**
@@ -359,7 +359,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isPrinted()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_PRINTED );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_PRINTED );
     }
 
     /**
@@ -369,7 +369,7 @@ public abstract class PDAnnotation imple
      */
     public void setPrinted( boolean printed )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_PRINTED, printed );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_PRINTED, printed );
     }
 
     /**
@@ -379,7 +379,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isNoZoom()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_NO_ZOOM );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_NO_ZOOM );
     }
 
     /**
@@ -389,7 +389,7 @@ public abstract class PDAnnotation imple
      */
     public void setNoZoom( boolean noZoom )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_NO_ZOOM, noZoom );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_NO_ZOOM, noZoom );
     }
 
     /**
@@ -399,7 +399,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isNoRotate()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_NO_ROTATE );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_NO_ROTATE );
     }
 
     /**
@@ -409,7 +409,7 @@ public abstract class PDAnnotation imple
      */
     public void setNoRotate( boolean noRotate )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_NO_ROTATE, noRotate );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_NO_ROTATE, noRotate );
     }
 
     /**
@@ -419,7 +419,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isNoView()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_NO_VIEW );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_NO_VIEW );
     }
 
     /**
@@ -429,7 +429,7 @@ public abstract class PDAnnotation imple
      */
     public void setNoView( boolean noView )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_NO_VIEW, noView );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_NO_VIEW, noView );
     }
 
     /**
@@ -439,7 +439,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isReadOnly()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_READ_ONLY );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_READ_ONLY );
     }
 
     /**
@@ -449,7 +449,7 @@ public abstract class PDAnnotation imple
      */
     public void setReadOnly( boolean readOnly )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_READ_ONLY, readOnly );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_READ_ONLY, readOnly );
     }
 
     /**
@@ -459,7 +459,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isLocked()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_LOCKED );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_LOCKED );
     }
 
     /**
@@ -469,7 +469,7 @@ public abstract class PDAnnotation imple
      */
     public void setLocked( boolean locked )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_LOCKED, locked );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_LOCKED, locked );
     }
 
     /**
@@ -479,7 +479,7 @@ public abstract class PDAnnotation imple
      */
     public boolean isToggleNoView()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "F", FLAG_TOGGLE_NO_VIEW );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_TOGGLE_NO_VIEW );
     }
 
     /**
@@ -489,7 +489,7 @@ public abstract class PDAnnotation imple
      */
     public void setToggleNoView( boolean toggleNoView )
     {
-        BitFlagHelper.setFlag( getDictionary(), "F", FLAG_TOGGLE_NO_VIEW, toggleNoView );
+        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_TOGGLE_NO_VIEW, toggleNoView );
     }
 
     /**
@@ -519,7 +519,7 @@ public abstract class PDAnnotation imple
      */
     public String getModifiedDate()
     {
-        return getDictionary().getString( "M" );
+        return getDictionary().getString( COSName.M );
     }
 
     /**
@@ -530,7 +530,7 @@ public abstract class PDAnnotation imple
      */
     public void setModifiedDate( String m )
     {
-        getDictionary().setString( "M", m );
+        getDictionary().setString( COSName.M, m );
     }
 
     /**
@@ -542,7 +542,7 @@ public abstract class PDAnnotation imple
      */
     public String getAnnotationName()
     {
-        return getDictionary().getString( "NM" );
+        return getDictionary().getString( COSName.NM );
     }
 
     /**
@@ -554,7 +554,7 @@ public abstract class PDAnnotation imple
      */
     public void setAnnotationName( String nm )
     {
-        getDictionary().setString( "NM", nm );
+        getDictionary().setString( COSName.NM, nm );
     }
 
     /**
@@ -571,7 +571,7 @@ public abstract class PDAnnotation imple
      */
     public void setColour( PDGamma c )
     {
-        getDictionary().setItem( "C", c );
+        getDictionary().setItem( COSName.C, c );
     }
 
     /**
@@ -587,7 +587,7 @@ public abstract class PDAnnotation imple
      */
     public PDGamma getColour()
     {
-        COSArray c = (COSArray) getDictionary().getItem(COSName.getPDFName( "C" ) );
+        COSArray c = (COSArray) getDictionary().getItem(COSName.C );
         if (c != null)
         {
             return new PDGamma( c );

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItem.java Sat Jan 29 17:51:04 2011
@@ -23,6 +23,7 @@ import java.util.List;
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSFloat;
+import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.exceptions.OutlineNotLocalException;
 import org.apache.pdfbox.pdmodel.PDDestinationNameTreeNode;
 import org.apache.pdfbox.pdmodel.PDDocument;
@@ -105,7 +106,7 @@ public class PDOutlineItem extends PDOut
     public PDOutlineItem getPreviousSibling()
     {
         PDOutlineItem last = null;
-        COSDictionary lastDic = (COSDictionary)node.getDictionaryObject( "Prev" );
+        COSDictionary lastDic = (COSDictionary)node.getDictionaryObject( COSName.PREV );
         if( lastDic != null )
         {
             last = new PDOutlineItem( lastDic );
@@ -120,7 +121,7 @@ public class PDOutlineItem extends PDOut
      */
     protected void setPreviousSibling( PDOutlineNode outlineNode )
     {
-        node.setItem( "Prev", outlineNode );
+        node.setItem( COSName.PREV, outlineNode );
     }
 
     /**
@@ -131,7 +132,7 @@ public class PDOutlineItem extends PDOut
     public PDOutlineItem getNextSibling()
     {
         PDOutlineItem last = null;
-        COSDictionary lastDic = (COSDictionary)node.getDictionaryObject( "Next" );
+        COSDictionary lastDic = (COSDictionary)node.getDictionaryObject( COSName.NEXT );
         if( lastDic != null )
         {
             last = new PDOutlineItem( lastDic );
@@ -146,7 +147,7 @@ public class PDOutlineItem extends PDOut
      */
     protected void setNextSibling( PDOutlineNode outlineNode )
     {
-        node.setItem( "Next", outlineNode );
+        node.setItem( COSName.NEXT, outlineNode );
     }
 
     /**
@@ -156,7 +157,7 @@ public class PDOutlineItem extends PDOut
      */
     public String getTitle()
     {
-        return node.getString( "Title" );
+        return node.getString( COSName.TITLE );
     }
 
     /**
@@ -166,7 +167,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setTitle( String title )
     {
-        node.setString( "Title", title );
+        node.setString( COSName.TITLE, title );
     }
 
     /**
@@ -177,7 +178,7 @@ public class PDOutlineItem extends PDOut
      */
     public PDDestination getDestination() throws IOException
     {
-        return PDDestination.create( node.getDictionaryObject( "Dest" ) );
+        return PDDestination.create( node.getDictionaryObject( COSName.DEST ) );
     }
 
     /**
@@ -187,7 +188,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setDestination( PDDestination dest )
     {
-        node.setItem( "Dest", dest );
+        node.setItem( COSName.DEST, dest );
     }
 
     /**
@@ -290,7 +291,7 @@ public class PDOutlineItem extends PDOut
      */
     public PDAction getAction()
     {
-        return PDActionFactory.createAction( (COSDictionary)node.getDictionaryObject( "A" ) );
+        return PDActionFactory.createAction( (COSDictionary)node.getDictionaryObject( COSName.A ) );
     }
 
     /**
@@ -300,7 +301,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setAction( PDAction action )
     {
-        node.setItem( "A", action );
+        node.setItem( COSName.A, action );
     }
 
     /**
@@ -311,7 +312,7 @@ public class PDOutlineItem extends PDOut
     public PDStructureElement getStructureElement()
     {
         PDStructureElement se = null;
-        COSDictionary dic = (COSDictionary)node.getDictionaryObject( "SE" );
+        COSDictionary dic = (COSDictionary)node.getDictionaryObject( COSName.SE );
         if( dic != null )
         {
             se = new PDStructureElement( dic );
@@ -326,7 +327,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setStructuredElement( PDStructureElement structureElement )
     {
-        node.setItem( "SE", structureElement );
+        node.setItem( COSName.SE, structureElement );
     }
 
     /**
@@ -338,12 +339,12 @@ public class PDOutlineItem extends PDOut
     public PDColorState getTextColor()
     {
         PDColorState retval = null;
-        COSArray csValues = (COSArray)node.getDictionaryObject( "C" );
+        COSArray csValues = (COSArray)node.getDictionaryObject( COSName.C );
         if( csValues == null )
         {
             csValues = new COSArray();
             csValues.growToSize( 3, new COSFloat( 0 ) );
-            node.setItem( "C", csValues );
+            node.setItem( COSName.C, csValues );
         }
         retval = new PDColorState(csValues);
         retval.setColorSpace( PDDeviceRGB.INSTANCE );
@@ -357,7 +358,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setTextColor( PDColorState textColor )
     {
-        node.setItem( "C", textColor.getCOSColorSpaceValue() );
+        node.setItem( COSName.C, textColor.getCOSColorSpaceValue() );
     }
 
     /**
@@ -371,7 +372,7 @@ public class PDOutlineItem extends PDOut
         array.add( new COSFloat( textColor.getRed()/255f));
         array.add( new COSFloat( textColor.getGreen()/255f));
         array.add( new COSFloat( textColor.getBlue()/255f));
-        node.setItem( "C", array );
+        node.setItem( COSName.C, array );
     }
 
     /**
@@ -381,7 +382,7 @@ public class PDOutlineItem extends PDOut
      */
     public boolean isItalic()
     {
-        return BitFlagHelper.getFlag( node, "F", ITALIC_FLAG );
+        return BitFlagHelper.getFlag( node, COSName.F, ITALIC_FLAG );
     }
 
     /**
@@ -391,7 +392,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setItalic( boolean italic )
     {
-        BitFlagHelper.setFlag( node, "F", ITALIC_FLAG, italic );
+        BitFlagHelper.setFlag( node, COSName.F, ITALIC_FLAG, italic );
     }
 
     /**
@@ -401,7 +402,7 @@ public class PDOutlineItem extends PDOut
      */
     public boolean isBold()
     {
-        return BitFlagHelper.getFlag( node, "F", BOLD_FLAG );
+        return BitFlagHelper.getFlag( node, COSName.F, BOLD_FLAG );
     }
 
     /**
@@ -411,7 +412,7 @@ public class PDOutlineItem extends PDOut
      */
     public void setBold( boolean bold )
     {
-        BitFlagHelper.setFlag( node, "F", BOLD_FLAG, bold );
+        BitFlagHelper.setFlag( node, COSName.F, BOLD_FLAG, bold );
     }
 
 }

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=1065086&r1=1065085&r2=1065086&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 Sat Jan 29 17:51:04 2011
@@ -98,7 +98,7 @@ public abstract class PDField implements
      */
     public String getPartialName()
     {
-        return getDictionary().getString( "T" );
+        return getDictionary().getString( COSName.T );
     }
 
     /**
@@ -108,7 +108,7 @@ public abstract class PDField implements
      */
     public void setPartialName( String name )
     {
-        getDictionary().setString( "T", name );
+        getDictionary().setString( COSName.T, name );
     }
 
     /**
@@ -142,7 +142,7 @@ public abstract class PDField implements
      */
     public String getAlternateFieldName()
     {
-        return this.getDictionary().getString("TU");
+        return this.getDictionary().getString(COSName.TU);
     }
 
     /**
@@ -152,7 +152,7 @@ public abstract class PDField implements
      */
     public void setAlternateFieldName(String alternateFieldName)
     {
-        this.getDictionary().setString("TU", alternateFieldName);
+        this.getDictionary().setString(COSName.TU, alternateFieldName);
     }
 
     /**
@@ -167,7 +167,7 @@ public abstract class PDField implements
      */
     public String getFieldType()
     {
-        return getDictionary().getNameAsString( "FT" );
+        return getDictionary().getNameAsString( COSName.FT );
     }
 
     /**
@@ -186,10 +186,10 @@ public abstract class PDField implements
 
     private String findFieldType( COSDictionary dic )
     {
-        String retval = dic.getNameAsString( "FT" );
+        String retval = dic.getNameAsString( COSName.FT );
         if( retval == null )
         {
-            COSDictionary parent = (COSDictionary)dic.getDictionaryObject( "Parent", "P" );
+            COSDictionary parent = (COSDictionary)dic.getDictionaryObject( COSName.PARENT, COSName.P );
             if( parent != null )
             {
                 retval = findFieldType( parent );
@@ -225,7 +225,7 @@ public abstract class PDField implements
      */
     public void setReadonly(boolean readonly)
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_READ_ONLY, readonly );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_READ_ONLY, readonly );
     }
 
     /**
@@ -234,7 +234,7 @@ public abstract class PDField implements
      */
     public boolean isReadonly()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_READ_ONLY );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_READ_ONLY );
     }
 
     /**
@@ -244,7 +244,7 @@ public abstract class PDField implements
      */
     public void setRequired(boolean required)
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_REQUIRED, required );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_REQUIRED, required );
     }
 
     /**
@@ -253,7 +253,7 @@ public abstract class PDField implements
      */
     public boolean isRequired()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_REQUIRED );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_REQUIRED );
     }
 
     /**
@@ -263,7 +263,7 @@ public abstract class PDField implements
      */
     public void setNoExport(boolean noExport)
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_NO_EXPORT, noExport );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_NO_EXPORT, noExport );
     }
 
     /**
@@ -272,7 +272,7 @@ public abstract class PDField implements
      */
     public boolean isNoExport()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_NO_EXPORT );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_NO_EXPORT );
     }
 
     /**
@@ -283,7 +283,7 @@ public abstract class PDField implements
     public int getFieldFlags()
     {
         int retval = 0;
-        COSInteger ff = (COSInteger)getDictionary().getDictionaryObject( COSName.getPDFName( "Ff" ) );
+        COSInteger ff = (COSInteger)getDictionary().getDictionaryObject( COSName.FF );
         if( ff != null )
         {
             retval = ff.intValue();
@@ -298,7 +298,7 @@ public abstract class PDField implements
      */
     public void setFieldFlags( int flags )
     {
-        getDictionary().setInt( COSName.getPDFName( "Ff" ), flags );
+        getDictionary().setInt( COSName.FF, flags );
     }
 
     /**
@@ -400,11 +400,11 @@ public abstract class PDField implements
                 }
             }
         }
-        List fdfKids = fdfField.getKids();
-        List pdKids = getKids();
+        List<FDFField> fdfKids = fdfField.getKids();
+        List<COSObjectable> pdKids = getKids();
         for( int i=0; fdfKids != null && i<fdfKids.size(); i++ )
         {
-            FDFField fdfChild = (FDFField)fdfKids.get( i );
+            FDFField fdfChild = fdfKids.get( i );
             String fdfName = fdfChild.getPartialFieldName();
             for( int j=0; j<pdKids.size(); j++ )
             {
@@ -434,7 +434,7 @@ public abstract class PDField implements
     public PDAnnotationWidget getWidget() throws IOException
     {
         PDAnnotationWidget retval = null;
-        List kids = getKids();
+        List<COSObjectable> kids = getKids();
         if( kids == null )
         {
             retval = new PDAnnotationWidget( getDictionary() );
@@ -468,7 +468,7 @@ public abstract class PDField implements
     public PDField getParent() throws IOException
     {
         PDField parent = null;
-        COSDictionary parentDic = (COSDictionary)getDictionary().getDictionaryObject( "Parent" );
+        COSDictionary parentDic = (COSDictionary)getDictionary().getDictionaryObject( COSName.PARENT, COSName.P );
         if( parentDic != null )
         {
             parent = PDFieldFactory.createField( getAcroForm(), parentDic );
@@ -527,23 +527,23 @@ public abstract class PDField implements
      * @return A list of either PDWidget or PDField objects.
      * @throws IOException If there is an error retrieving the kids.
      */
-    public List getKids() throws IOException
+    public List<COSObjectable> getKids() throws IOException
     {
-        List retval = null;
+        List<COSObjectable> retval = null;
         COSArray kids = (COSArray)getDictionary().getDictionaryObject(COSName.KIDS);
         if( kids != null )
         {
-            List kidsList = new ArrayList();
+            List<COSObjectable> kidsList = new ArrayList<COSObjectable>();
             for (int i = 0; i < kids.size(); i++)
             {
                 COSDictionary kidDictionary = (COSDictionary)kids.getObject(i);
-                COSDictionary parent = (COSDictionary)kidDictionary.getDictionaryObject( "Parent" );
-                if( kidDictionary.getDictionaryObject( "FT" ) != null ||
-                    (parent != null && parent.getDictionaryObject( "FT" ) != null ) )
+                COSDictionary parent = (COSDictionary)kidDictionary.getDictionaryObject( COSName.PARENT, COSName.P );
+                if( kidDictionary.getDictionaryObject( COSName.FT ) != null ||
+                    (parent != null && parent.getDictionaryObject( COSName.FT ) != null ) )
                 {
                     kidsList.add( PDFieldFactory.createField( acroForm, kidDictionary ));
                 }
-                else if( "Widget".equals( kidDictionary.getNameAsString( "Subtype" ) ) )
+                else if( "Widget".equals( kidDictionary.getNameAsString( COSName.SUBTYPE ) ) )
                 {
                     kidsList.add( new PDAnnotationWidget( kidDictionary ) );
                 }
@@ -563,7 +563,7 @@ public abstract class PDField implements
      *
      * @param kids The list of child widgets.
      */
-    public void setKids( List kids )
+    public void setKids( List<COSObjectable> kids )
     {
         COSArray kidsArray = COSArrayList.converterToCOSArray( kids );
         getDictionary().setItem( COSName.KIDS, kidsArray );
@@ -576,7 +576,7 @@ public abstract class PDField implements
      */
     public String toString()
     {
-        return "" + getDictionary().getDictionaryObject( COSName.getPDFName( "V" ) );
+        return "" + getDictionary().getDictionaryObject( COSName.V );
     }
 
     /**
@@ -627,7 +627,7 @@ public abstract class PDField implements
      */
     public PDFormFieldAdditionalActions getActions()
     {
-        COSDictionary aa = (COSDictionary)dictionary.getDictionaryObject( "AA" );
+        COSDictionary aa = (COSDictionary)dictionary.getDictionaryObject( COSName.AA );
         PDFormFieldAdditionalActions retval = null;
         if( aa != null )
         {
@@ -643,6 +643,6 @@ public abstract class PDField implements
      */
     public void setActions( PDFormFieldAdditionalActions actions )
     {
-        dictionary.setItem( "AA", actions );
+        dictionary.setItem( COSName.AA, actions );
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioCollection.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioCollection.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioCollection.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDRadioCollection.java Sat Jan 29 17:51:04 2011
@@ -65,7 +65,7 @@ public class PDRadioCollection extends P
      */
     public void setRadiosInUnison(boolean radiosInUnison)
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_RADIOS_IN_UNISON, radiosInUnison );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_RADIOS_IN_UNISON, radiosInUnison );
     }
 
     /**
@@ -74,7 +74,7 @@ public class PDRadioCollection extends P
      */
     public boolean isRadiosInUnison()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_RADIOS_IN_UNISON );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_RADIOS_IN_UNISON );
     }
 
     /**
@@ -88,7 +88,7 @@ public class PDRadioCollection extends P
      */
     public void setValue(String value) throws IOException
     {
-        getDictionary().setString( "V", value );
+        getDictionary().setString( COSName.V, value );
         List kids = getKids();
         for (int i = 0; i < kids.size(); i++)
         {
@@ -133,7 +133,7 @@ public class PDRadioCollection extends P
         }
         if( retval == null )
         {
-            retval = getDictionary().getNameAsString( "V" );
+            retval = getDictionary().getNameAsString( COSName.V );
         }
         return retval;
     }

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=1065086&r1=1065085&r2=1065086&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 Sat Jan 29 17:51:04 2011
@@ -105,7 +105,7 @@ public abstract class PDVariableText ext
     public PDVariableText( PDAcroForm theAcroForm, COSDictionary field)
     {
         super( theAcroForm, field);
-        da = (COSString) field.getDictionaryObject(COSName.getPDFName("DA"));
+        da = (COSString) field.getDictionaryObject(COSName.DA);
     }
 
     /**
@@ -118,7 +118,7 @@ public abstract class PDVariableText ext
     public void setValue(String value) throws IOException
     {
         COSString fieldValue = new COSString(value);
-        getDictionary().setItem( COSName.getPDFName( "V" ), fieldValue );
+        getDictionary().setItem( COSName.V, fieldValue );
 
         //hmm, not sure what the case where the DV gets set to the field
         //value, for now leave blank until we can come up with a case
@@ -140,7 +140,7 @@ public abstract class PDVariableText ext
      */
     public String getValue() throws IOException
     {
-        return getDictionary().getString( "V" );
+        return getDictionary().getString( COSName.V );
     }
 
     /**
@@ -148,7 +148,7 @@ public abstract class PDVariableText ext
      */
     public boolean isMultiline()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_MULTILINE );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_MULTILINE );
     }
 
     /**
@@ -158,7 +158,7 @@ public abstract class PDVariableText ext
      */
     public void setMultiline( boolean multiline )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_MULTILINE, multiline );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_MULTILINE, multiline );
     }
 
     /**
@@ -166,7 +166,7 @@ public abstract class PDVariableText ext
      */
     public boolean isPassword()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_PASSWORD );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_PASSWORD );
     }
 
     /**
@@ -176,7 +176,7 @@ public abstract class PDVariableText ext
      */
     public void setPassword( boolean password )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_PASSWORD, password );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_PASSWORD, password );
     }
 
     /**
@@ -184,7 +184,7 @@ public abstract class PDVariableText ext
      */
     public boolean isFileSelect()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_FILE_SELECT );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_FILE_SELECT );
     }
 
     /**
@@ -194,7 +194,7 @@ public abstract class PDVariableText ext
      */
     public void setFileSelect( boolean fileSelect )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_FILE_SELECT, fileSelect );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_FILE_SELECT, fileSelect );
     }
 
     /**
@@ -202,7 +202,7 @@ public abstract class PDVariableText ext
      */
     public boolean doNotSpellCheck()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_DO_NOT_SPELL_CHECK );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_DO_NOT_SPELL_CHECK );
     }
 
     /**
@@ -212,7 +212,7 @@ public abstract class PDVariableText ext
      */
     public void setDoNotSpellCheck( boolean doNotSpellCheck )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_DO_NOT_SPELL_CHECK, doNotSpellCheck );
     }
 
     /**
@@ -220,7 +220,7 @@ public abstract class PDVariableText ext
      */
     public boolean doNotScroll()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_DO_NOT_SCROLL );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_DO_NOT_SCROLL );
     }
 
     /**
@@ -230,7 +230,7 @@ public abstract class PDVariableText ext
      */
     public void setDoNotScroll( boolean doNotScroll )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_DO_NOT_SCROLL, doNotScroll );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_DO_NOT_SCROLL, doNotScroll );
     }
 
     /**
@@ -238,7 +238,7 @@ public abstract class PDVariableText ext
      */
     public boolean shouldComb()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_COMB );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_COMB );
     }
 
     /**
@@ -248,7 +248,7 @@ public abstract class PDVariableText ext
      */
     public void setComb( boolean comb )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_COMB, comb );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_COMB, comb );
     }
 
     /**
@@ -256,7 +256,7 @@ public abstract class PDVariableText ext
      */
     public boolean isRichText()
     {
-        return BitFlagHelper.getFlag( getDictionary(), "Ff", FLAG_RICH_TEXT );
+        return BitFlagHelper.getFlag( getDictionary(), COSName.FF, FLAG_RICH_TEXT );
     }
 
     /**
@@ -266,7 +266,7 @@ public abstract class PDVariableText ext
      */
     public void setRichText( boolean richText )
     {
-        BitFlagHelper.setFlag( getDictionary(), "Ff", FLAG_RICH_TEXT, richText );
+        BitFlagHelper.setFlag( getDictionary(), COSName.FF, FLAG_RICH_TEXT, richText );
     }
 
     /**
@@ -289,7 +289,7 @@ public abstract class PDVariableText ext
     public int getQ()
     {
         int retval = 0;
-        COSNumber number = (COSNumber)getDictionary().getDictionaryObject( COSName.getPDFName( "Q" ) );
+        COSNumber number = (COSNumber)getDictionary().getDictionaryObject( COSName.Q );
         if( number != null )
         {
             retval = number.intValue();
@@ -304,7 +304,7 @@ public abstract class PDVariableText ext
      */
     public void setQ( int q )
     {
-        getDictionary().setInt( COSName.getPDFName( "Q" ), q );
+        getDictionary().setInt( COSName.Q, q );
     }
 
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/BitFlagHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/BitFlagHelper.java?rev=1065086&r1=1065085&r2=1065086&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/BitFlagHelper.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/BitFlagHelper.java Sat Jan 29 17:51:04 2011
@@ -17,6 +17,7 @@
 package org.apache.pdfbox.util;
 
 import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
 
 /**
  * This class will be used for bit flag operations.
@@ -38,9 +39,24 @@ public class BitFlagHelper
      * @param field The name of the field to set the value into.
      * @param bitFlag the bit position to set the value in.
      * @param value the value the bit position should have.
+     * 
+     * @deprecated  use {@link #setFlag(COSDictionary, COSName, int, boolean)} using COSName constants instead
      */
     public static final void setFlag( COSDictionary dic, String field, int bitFlag, boolean value )
     {
+       setFlag(dic, COSName.getPDFName(field), bitFlag, value);
+    }
+    
+    /**
+     * Sets the given boolean value at bitPos in the flags.
+     *
+     * @param dic The dictionary to set the value into.
+     * @param field The COSName of the field to set the value into.
+     * @param bitFlag the bit position to set the value in.
+     * @param value the value the bit position should have.
+     */
+    public static final void setFlag( COSDictionary dic, COSName field, int bitFlag, boolean value )
+    {
         int currentFlags = dic.getInt( field, 0 );
         if( value )
         {
@@ -62,9 +78,26 @@ public class BitFlagHelper
      * @param bitFlag the bitPosition to get the value from.
      *
      * @return true if the number at bitPos is '1'
+     *
+     * @deprecated  use {@link #getFlag(COSDictionary, COSName, boolean)} using COSName constants instead
      */
     public static final boolean getFlag(COSDictionary dic, String field, int bitFlag)
     {
+        return getFlag(dic, COSName.getPDFName(field), bitFlag);
+    }
+    
+    /**
+     * Gets the boolean value from the flags at the given bit
+     * position.
+     *
+     * @param dic The dictionary to get the field from.
+     * @param field The COSName of the field to get the flag from.
+     * @param bitFlag the bitPosition to get the value from.
+     *
+     * @return true if the number at bitPos is '1'
+     */
+    public static final boolean getFlag(COSDictionary dic, COSName field, int bitFlag)
+    {
         int ff = dic.getInt( field, 0 );
         return (ff & bitFlag) == bitFlag;
     }