org.apache.pdfbox.pdmodel.fdf

## Class FDFField

- java.lang.Object
- - org.apache.pdfbox.pdmodel.fdf.FDFField

All Implemented Interfaces:
  COSObjectable

    public class FDFField
    extends Object
    implements COSObjectable

This represents an FDF field that is part of the FDF document.

Author:
  Ben Litchfield

### Constructor Summary

Constructors
Constructor and Description
`FDFField()` Default constructor.
`FDFField(COSDictionary f)` Constructor.
`FDFField(Element fieldXML)` This will create an FDF field from an XFDF XML document.

### Method Summary

All Methods Instance Methods Concrete Methods
`PDAction` `getAction()` This will get the action that is associated with this field.
`PDAdditionalActions` `getAdditionalActions()` This will get a list of additional actions that will get executed based on events.
`PDAppearanceDictionary` `getAppearanceDictionary()` This will get the appearance dictionary that specifies the appearance of a pushbutton field.
`FDFNamedPageReference` `getAppearanceStreamReference()` This will get named page references.
`Integer` `getClearFieldFlags()` This will get the 'ClrFf' entry of the FDF field dictionary.
`Integer` `getClearWidgetFieldFlags()` This will get the 'ClrF' entry of the FDF field dictionary.
`COSDictionary` `getCOSObject()` Convert this standard java object to a COS object.
`COSBase` `getCOSValue()` Returns the COS value of this field.
`Integer` `getFieldFlags()` This will get the 'Ff' entry of the FDF field dictionary.
`FDFIconFit` `getIconFit()` This will get the icon fit that is associated with this field.
`List<FDFField>` `getKids()` This will get the list of kids.
`List<Object>` `getOptions()` This will return a list of options for a choice field.
`String` `getPartialFieldName()` This will get the "T" entry in the field dictionary.
`String` `getRichText()` This will set the rich text that is associated with this field.
`Integer` `getSetFieldFlags()` This will get the 'SetFf' entry of the FDF field dictionary.
`Integer` `getSetWidgetFieldFlags()` This will get the 'SetF' entry of the FDF field dictionary.
`Object` `getValue()` This will get the value for the field.
`Integer` `getWidgetFieldFlags()` This will get the 'F' entry of the FDF field dictionary.
`void` `setAction(PDAction a)` This will set the action that is associated with this field.
`void` `setAdditionalActions(PDAdditionalActions aa)` This will set the additional actions that are associated with this field.
`void` `setAppearanceDictionary(PDAppearanceDictionary ap)` This will set the appearance dictionary.
`void` `setAppearanceStreamReference(FDFNamedPageReference ref)` This will set the named page references.
`void` `setClearFieldFlags(int ff)` This will set the field flags that are associated with this field.
`void` `setClearFieldFlags(Integer ff)` This will set the field flags that are associated with this field.
`void` `setClearWidgetFieldFlags(int ff)` This will set the field flags that are associated with this field.
`void` `setClearWidgetFieldFlags(Integer ff)` This will set the field flags that are associated with this field.
`void` `setFieldFlags(int ff)` This will set the field flags that are associated with this field.
`void` `setFieldFlags(Integer ff)` This will set the field flags that are associated with this field.
`void` `setIconFit(FDFIconFit fit)` This will set the icon fit 'IF' entry.
`void` `setKids(List<FDFField> kids)` This will set the list of kids.
`void` `setOptions(List<Object> options)` This will set the options for the choice field.
`void` `setPartialFieldName(String partial)` This will set the partial field name.
`void` `setRichText(COSStream rv)` This will set the rich text value.
`void` `setRichText(COSString rv)` This will set the rich text value.
`void` `setSetFieldFlags(int ff)` This will set the field flags that are associated with this field.
`void` `setSetFieldFlags(Integer ff)` This will set the field flags that are associated with this field.
`void` `setSetWidgetFieldFlags(int ff)` This will set the widget field flags that are associated with this field.
`void` `setSetWidgetFieldFlags(Integer ff)` This will set the widget field flags that are associated with this field.
`void` `setValue(COSBase value)` Sets the COS value of this field.
`void` `setValue(Object value)` You should pass a String, or a List<String> to set the value.
`void` `setWidgetFieldFlags(int f)` This will set the field flags that are associated with this field.
`void` `setWidgetFieldFlags(Integer f)` This will set the widget field flags that are associated with this field.
`void` `writeXML(Writer output)` This will write this element as an XML document.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FDFField

    public FDFField()

Default constructor.

#### FDFField

    public FDFField(COSDictionary f)

Constructor.

Parameters:
  `f` - The FDF field.

#### FDFField

    public FDFField(Element fieldXML)
             throws IOException

This will create an FDF field from an XFDF XML document.

Parameters:
  `fieldXML` - The XML document that contains the XFDF data.
Throws:
  `IOException` - If there is an error reading from the dom.

### Method Detail

#### writeXML

    public void writeXML(Writer output)
                  throws IOException

This will write this element as an XML document.

Parameters:
  `output` - The stream to write the xml to.
Throws:
  `IOException` - If there is an error writing the XML.

#### getCOSObject

    public COSDictionary getCOSObject()

Convert this standard java object to a COS object.

Specified by:
  `getCOSObject` in interface `COSObjectable`
Returns:
  The cos object that matches this Java object.

#### getKids

    public List<FDFField> getKids()

This will get the list of kids. This will return a list of FDFField objects. This will return null if the underlying list is null.

Returns:
  The list of kids.

#### setKids

    public final void setKids(List<FDFField> kids)

This will set the list of kids.

Parameters:
  `kids` - A list of FDFField objects.

#### getPartialFieldName

    public String getPartialFieldName()

This will get the "T" entry in the field dictionary. A partial field name. Where the fully qualified field name is a concatenation of the parent's fully qualified field name and "." as a separator. For example
Address.State
Address.City

Returns:
  The partial field name.

#### setPartialFieldName

    public void setPartialFieldName(String partial)

This will set the partial field name.

Parameters:
  `partial` - The partial field name.

#### getValue

    public Object getValue()
                    throws IOException

This will get the value for the field. The return type will either be:

- String: for Checkboxes, Radio Button, Textfields
- List<String>: for a Choice Field

Returns:
  The value of the field.
Throws:
  `IOException` - If there is an error getting the value.

#### getCOSValue

    public COSBase getCOSValue()
                        throws IOException

Returns the COS value of this field.

Returns:
  The COS value of the field, maybe `null`.
Throws:
  `IOException` - If there is an error getting the value.

#### setValue

    public void setValue(Object value)
                  throws IOException

You should pass a String, or a List<String> to set the value.

Parameters:
  `value` - The value that should populate when imported.
Throws:
  `IOException` - If there is an error setting the value.

#### setValue

    public void setValue(COSBase value)

Sets the COS value of this field.

Parameters:
  `value` - COS value.

#### getFieldFlags

    public Integer getFieldFlags()

This will get the 'Ff' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:
  The field flags.

#### setFieldFlags

    public void setFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'Ff' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the field flags.

#### setFieldFlags

    public void setFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'Ff' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the field flags.

#### getSetFieldFlags

    public Integer getSetFieldFlags()

This will get the 'SetFf' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:
  The field flags.

#### setSetFieldFlags

    public void setSetFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'SetFf' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "set field flags".

#### setSetFieldFlags

    public void setSetFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'SetFf' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "set field flags".

#### getClearFieldFlags

    public Integer getClearFieldFlags()

This will get the 'ClrFf' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:
  The field flags.

#### setClearFieldFlags

    public void setClearFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'ClrFf' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "clear field flags".

#### setClearFieldFlags

    public void setClearFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'ClrFf' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "clear field flags".

#### getWidgetFieldFlags

    public Integer getWidgetFieldFlags()

This will get the 'F' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:
  The widget field flags.

#### setWidgetFieldFlags

    public void setWidgetFieldFlags(Integer f)

This will set the widget field flags that are associated with this field. The 'F' entry in the FDF field dictionary.

Parameters:
  `f` - The new value for the field flags.

#### setWidgetFieldFlags

    public void setWidgetFieldFlags(int f)

This will set the field flags that are associated with this field. The 'F' entry in the FDF field dictionary.

Parameters:
  `f` - The new value for the field flags.

#### getSetWidgetFieldFlags

    public Integer getSetWidgetFieldFlags()

This will get the 'SetF' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:
  The field flags.

#### setSetWidgetFieldFlags

    public void setSetWidgetFieldFlags(Integer ff)

This will set the widget field flags that are associated with this field. The 'SetF' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "set widget field flags".

#### setSetWidgetFieldFlags

    public void setSetWidgetFieldFlags(int ff)

This will set the widget field flags that are associated with this field. The 'SetF' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "set widget field flags".

#### getClearWidgetFieldFlags

    public Integer getClearWidgetFieldFlags()

This will get the 'ClrF' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:
  The widget field flags.

#### setClearWidgetFieldFlags

    public void setClearWidgetFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'ClrF' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "clear widget field flags".

#### setClearWidgetFieldFlags

    public void setClearWidgetFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'ClrF' entry in the FDF field dictionary.

Parameters:
  `ff` - The new value for the "clear field flags".

#### getAppearanceDictionary

    public PDAppearanceDictionary getAppearanceDictionary()

This will get the appearance dictionary that specifies the appearance of a pushbutton field.

Returns:
  The AP entry of this dictionary.

#### setAppearanceDictionary

    public void setAppearanceDictionary(PDAppearanceDictionary ap)

This will set the appearance dictionary.

Parameters:
  `ap` - The appearance dictionary.

#### getAppearanceStreamReference

    public FDFNamedPageReference getAppearanceStreamReference()

This will get named page references.

Returns:
  The named page references or `null`.

#### setAppearanceStreamReference

    public void setAppearanceStreamReference(FDFNamedPageReference ref)

This will set the named page references.

Parameters:
  `ref` - The named page references.

#### getIconFit

    public FDFIconFit getIconFit()

This will get the icon fit that is associated with this field.

Returns:
  The 'IF' entry.

#### setIconFit

    public void setIconFit(FDFIconFit fit)

This will set the icon fit 'IF' entry.

Parameters:
  `fit` - The icon fit object.

#### getOptions

    public List<Object> getOptions()

This will return a list of options for a choice field. The values in the list will be 1 of 2 types:

- `String`
- `FDFOptionElement`

Returns:
  A list of all options.

#### setOptions

    public void setOptions(List<Object> options)

This will set the options for the choice field. The objects in the list should either be `String` or `FDFOptionElement`.

Parameters:
  `options` - The options to set.

#### getAction

    public PDAction getAction()

This will get the action that is associated with this field.

Returns:
  The 'A' entry in the FDF field dictionary.

#### setAction

    public void setAction(PDAction a)

This will set the action that is associated with this field.

Parameters:
  `a` - The new action.

#### getAdditionalActions

    public PDAdditionalActions getAdditionalActions()

This will get a list of additional actions that will get executed based on events.

Returns:
  The 'AA' entry in this FDF field dictionary or null.

#### setAdditionalActions

    public void setAdditionalActions(PDAdditionalActions aa)

This will set the additional actions that are associated with this field.

Parameters:
  `aa` - The additional actions.

#### getRichText

    public String getRichText()

This will set the rich text that is associated with this field.

Returns:
  The rich text XHTML stream.

#### setRichText

    public void setRichText(COSString rv)

This will set the rich text value.

Parameters:
  `rv` - The rich text value for the stream.

#### setRichText

    public void setRichText(COSStream rv)

This will set the rich text value.

Parameters:
  `rv` - The rich text value for the stream.