public abstract class PDField extends java.lang.Object implements COSObjectable
Modifier and Type | Field and Description |
---|---|
private PDAcroForm |
acroForm |
private COSDictionary |
dictionary |
private static int |
FLAG_NO_EXPORT |
private static int |
FLAG_READ_ONLY |
private static int |
FLAG_REQUIRED |
private PDNonTerminalField |
parent |
Constructor and Description |
---|
PDField(PDAcroForm acroForm)
Constructor.
|
PDField(PDAcroForm acroForm,
COSDictionary field,
PDNonTerminalField parent)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) abstract FDFField |
exportFDF()
Exports this field and its children as FDF.
|
(package private) PDField |
findKid(java.lang.String[] name,
int nameIndex)
This will find one of the child elements.
|
(package private) static PDField |
fromDictionary(PDAcroForm form,
COSDictionary field,
PDNonTerminalField parent)
Creates a COSField subclass from the given COS field.
|
PDAcroForm |
getAcroForm()
This will get the acroform that this field is part of.
|
PDFormFieldAdditionalActions |
getActions()
Get the additional actions for this field.
|
java.lang.String |
getAlternateFieldName()
Gets the alternate name of the field ("shall be used in place of the actual field name
wherever the field shall be identified in the user interface (such as in error or status
messages referring to the field)").
|
COSDictionary |
getCOSObject()
This will get the dictionary associated with this field.
|
abstract int |
getFieldFlags()
This will get the flags for this field.
|
abstract java.lang.String |
getFieldType()
Get the FT entry of the field.
|
java.lang.String |
getFullyQualifiedName()
Returns the fully qualified name of the field, which is a concatenation of the names of all the parents fields.
|
protected COSBase |
getInheritableAttribute(COSName key)
Returns the given attribute, inheriting from parent nodes if necessary.
|
java.lang.String |
getMappingName()
Gets the mapping name of the field.
|
PDNonTerminalField |
getParent()
Get the parent field to this field, or null if none exists.
|
java.lang.String |
getPartialName()
Returns the partial name of the field.
|
abstract java.lang.String |
getValueAsString()
Returns a string representation of the "V" entry, or an empty string.
|
abstract java.util.List<PDAnnotationWidget> |
getWidgets()
Returns the widget annotations associated with this field.
|
(package private) void |
importFDF(FDFField fdfField)
This will import a fdf field from a fdf document.
|
boolean |
isNoExport() |
boolean |
isReadOnly() |
boolean |
isRequired() |
void |
setAlternateFieldName(java.lang.String alternateFieldName)
This will set the alternate name of the field ("shall be used in place of the actual field
name wherever the field shall be identified in the user interface (such as in error or status
messages referring to the field)").
|
void |
setFieldFlags(int flags)
This will set the flags for this field.
|
void |
setMappingName(java.lang.String mappingName)
This will set the mapping name of the field.
|
void |
setNoExport(boolean noExport)
sets the field to be not exported.
|
void |
setPartialName(java.lang.String name)
This will set the partial name of the field.
|
void |
setReadOnly(boolean readonly)
sets the field to be read-only.
|
void |
setRequired(boolean required)
sets the flag whether the field is to be required to have a value at the time it is exported
by a submit-form action.
|
abstract void |
setValue(java.lang.String value)
Sets the value of the field.
|
java.lang.String |
toString() |
private static final int FLAG_READ_ONLY
private static final int FLAG_REQUIRED
private static final int FLAG_NO_EXPORT
private final PDAcroForm acroForm
private final PDNonTerminalField parent
private final COSDictionary dictionary
PDField(PDAcroForm acroForm)
acroForm
- The form that this field is part of.PDField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
acroForm
- The form that this field is part of.field
- the PDF object to represent as a field.parent
- the parent node of the nodestatic PDField fromDictionary(PDAcroForm form, COSDictionary field, PDNonTerminalField parent)
form
- the form that the field is part offield
- the dictionary representing a field elementparent
- the parent node of the node to be created, or null if root.protected COSBase getInheritableAttribute(COSName key)
key
- the key to look uppublic abstract java.lang.String getFieldType()
public abstract java.lang.String getValueAsString()
public abstract void setValue(java.lang.String value) throws java.io.IOException
value
- the new field value.java.io.IOException
- if the value could not be setpublic abstract java.util.List<PDAnnotationWidget> getWidgets()
PDNonTerminalField
the list will be empty as non terminal fields
have no visual representation in the form.PDAnnotationWidget
annotations. Be aware that this list is
not backed by the actual widget collection of the field, so adding or deleting has no
effect on the PDF document. For PDTerminalField
you'd have to call
setWidgets()
with the modified list.public void setReadOnly(boolean readonly)
readonly
- The new flag for readonly.public boolean isReadOnly()
public void setRequired(boolean required)
required
- The new flag for required.public boolean isRequired()
public void setNoExport(boolean noExport)
noExport
- The new flag for noExport.public boolean isNoExport()
public abstract int getFieldFlags()
public void setFieldFlags(int flags)
flags
- The new flags.public PDFormFieldAdditionalActions getActions()
void importFDF(FDFField fdfField) throws java.io.IOException
fdfField
- The fdf field to import.java.io.IOException
- If there is an error importing the data for this field.abstract FDFField exportFDF() throws java.io.IOException
java.io.IOException
public PDNonTerminalField getParent()
PDField findKid(java.lang.String[] name, int nameIndex)
name
- An array that picks the path to the field.nameIndex
- The index into the array.public PDAcroForm getAcroForm()
public COSDictionary getCOSObject()
getCOSObject
in interface COSObjectable
public java.lang.String getPartialName()
public void setPartialName(java.lang.String name)
name
- The new name for the field.public java.lang.String getFullyQualifiedName()
public java.lang.String getAlternateFieldName()
public void setAlternateFieldName(java.lang.String alternateFieldName)
alternateFieldName
- the alternate name of the field.public java.lang.String getMappingName()
public void setMappingName(java.lang.String mappingName)
mappingName
- the mapping name of the fieldpublic java.lang.String toString()
toString
in class java.lang.Object