Class PDField
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.interactive.form.PDField
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDNonTerminalField,PDTerminalField
public abstract class PDField extends Object implements COSObjectable
A field in an interactive form.
-
-
Field Summary
Fields Modifier and Type Field Description protected PDAcroFormacroFormprotected COSDictionarydictionaryprotected PDNonTerminalFieldparent
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PDAcroFormgetAcroForm()This will get the acroform that this field is part of.PDFormFieldAdditionalActionsgetActions()Get the additional actions for this field.StringgetAlternateFieldName()Gets the alternate name of the field.COSDictionarygetCOSObject()This will get the dictionary associated with this field.abstract intgetFieldFlags()This will get the flags for this field.abstract StringgetFieldType()Get the FT entry of the field.StringgetFullyQualifiedName()Returns the fully qualified name of the field, which is a concatenation of the names of all the parents fields.protected COSBasegetInheritableAttribute(COSName key)Returns the given attribute, inheriting from parent nodes if necessary.StringgetMappingName()Gets the mapping name of the field.PDNonTerminalFieldgetParent()Get the parent field to this field, or null if none exists.StringgetPartialName()Returns the partial name of the field.abstract StringgetValueAsString()Returns a string representation of the "V" entry, or an empty string.booleanisNoExport()booleanisReadOnly()booleanisRequired()voidsetAlternateFieldName(String alternateFieldName)This will set the alternate name of the field.voidsetFieldFlags(int flags)This will set the flags for this field.voidsetMappingName(String mappingName)This will set the mapping name of the field.voidsetNoExport(boolean noExport)sets the field to be not exported.voidsetPartialName(String name)This will set the partial name of the field.voidsetReadOnly(boolean readonly)sets the field to be read-only.voidsetRequired(boolean required)sets the field to be required.StringtoString()
-
-
-
Field Detail
-
acroForm
protected final PDAcroForm acroForm
-
parent
protected final PDNonTerminalField parent
-
dictionary
protected final COSDictionary dictionary
-
-
Method Detail
-
getInheritableAttribute
protected COSBase getInheritableAttribute(COSName key)
Returns the given attribute, inheriting from parent nodes if necessary.- Parameters:
key- the key to look up- Returns:
- COS value for the given key
-
getFieldType
public abstract String getFieldType()
Get the FT entry of the field. This is a read only field and is set depending on the actual type. The field type is an inheritable attribute.- Returns:
- The Field type.
-
getValueAsString
public abstract String getValueAsString()
Returns a string representation of the "V" entry, or an empty string.- Returns:
- A non-null string.
-
setReadOnly
public void setReadOnly(boolean readonly)
sets the field to be read-only.- Parameters:
readonly- The new flag for readonly.
-
isReadOnly
public boolean isReadOnly()
- Returns:
- true if the field is readonly
-
setRequired
public void setRequired(boolean required)
sets the field to be required.- Parameters:
required- The new flag for required.
-
isRequired
public boolean isRequired()
- Returns:
- true if the field is required
-
setNoExport
public void setNoExport(boolean noExport)
sets the field to be not exported.- Parameters:
noExport- The new flag for noExport.
-
isNoExport
public boolean isNoExport()
- Returns:
- true if the field is not to be exported.
-
getFieldFlags
public abstract int getFieldFlags()
This will get the flags for this field.- Returns:
- flags The set of flags.
-
setFieldFlags
public void setFieldFlags(int flags)
This will set the flags for this field.- Parameters:
flags- The new flags.
-
getActions
public PDFormFieldAdditionalActions getActions()
Get the additional actions for this field. This will return null if there are no additional actions for this field.- Returns:
- The actions of the field.
-
getParent
public PDNonTerminalField getParent()
Get the parent field to this field, or null if none exists.- Returns:
- The parent field.
-
getAcroForm
public PDAcroForm getAcroForm()
This will get the acroform that this field is part of.- Returns:
- The form this field is on.
-
getCOSObject
public COSDictionary getCOSObject()
This will get the dictionary associated with this field.- Specified by:
getCOSObjectin interfaceCOSObjectable- Returns:
- the dictionary that this class wraps.
-
getPartialName
public String getPartialName()
Returns the partial name of the field.- Returns:
- the name of the field
-
setPartialName
public void setPartialName(String name)
This will set the partial name of the field.- Parameters:
name- The new name for the field.
-
getFullyQualifiedName
public String getFullyQualifiedName()
Returns the fully qualified name of the field, which is a concatenation of the names of all the parents fields.- Returns:
- the name of the field
-
getAlternateFieldName
public String getAlternateFieldName()
Gets the alternate name of the field.- Returns:
- the alternate name of the field
-
setAlternateFieldName
public void setAlternateFieldName(String alternateFieldName)
This will set the alternate name of the field.- Parameters:
alternateFieldName- the alternate name of the field
-
getMappingName
public String getMappingName()
Gets the mapping name of the field. The mapping name shall be used when exporting interactive form field data from the document.- Returns:
- the mapping name of the field
-
setMappingName
public void setMappingName(String mappingName)
This will set the mapping name of the field.- Parameters:
mappingName- the mapping name of the field
-
-