Class PDNonTerminalField
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.form.PDField
org.apache.pdfbox.pdmodel.interactive.form.PDNonTerminalField
- All Implemented Interfaces:
COSObjectable
A non terminal field in an interactive form.
A non terminal field is a node in the fields tree node whose descendants
are fields.
The attributes such as FT (field type) or V (field value) do not logically
belong to the non terminal field but are inheritable attributes
for descendant terminal fields.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns this field's children.Returns the default value of this field.int
This will get the flags for this field.Get the FT entry of the field.getValue()
Get the field value.Returns a string representation of the "V" entry, or an empty string.Returns the widget annotations associated with this field.void
setChildren
(List<PDField> children) Sets the child fields.void
setDefaultValue
(COSBase value) Sets the default of this field.void
Sets the plain text value of this field.void
Sets the value of this field.Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDField
getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, toString
-
Constructor Details
-
PDNonTerminalField
Constructor.- Parameters:
acroForm
- The form that this field is part of.
-
-
Method Details
-
getFieldFlags
public int getFieldFlags()Description copied from class:PDField
This will get the flags for this field.- Specified by:
getFieldFlags
in classPDField
- Returns:
- flags The set of flags.
-
getChildren
Returns this field's children. These may be either terminal or non-terminal fields.- Returns:
- the list of child fields. Be aware that this list is not backed by the
children of the field, so adding or deleting has no effect on the PDF document until you call
setChildren()
with the modified list.
-
setChildren
Sets the child fields.- Parameters:
children
- The list of child fields.
-
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.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
- Specified by:
getFieldType
in classPDField
- Returns:
- The Field type.
-
getValue
Get the field value.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
-
getValueAsString
Returns a string representation of the "V" entry, or an empty string.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
- Specified by:
getValueAsString
in classPDField
- Returns:
- The list of widget annotations.
-
setValue
Sets the value of this field. This may be of any kind which is valid for this field's children.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
- Parameters:
object
-- Throws:
IOException
-
setValue
Sets the plain text value of this field.- Specified by:
setValue
in classPDField
- Parameters:
value
- Plain text- Throws:
IOException
- if the value could not be set
-
getDefaultValue
Returns the default value of this field. This may be of any kind which is valid for this field's children.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
-
setDefaultValue
Sets the default of this field. This may be of any kind which is valid for this field's children.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
- Parameters:
value
-
-
getWidgets
Description copied from class:PDField
Returns the widget annotations associated with this field. ForPDNonTerminalField
the list will be empty as non terminal fields have no visual representation in the form.- Specified by:
getWidgets
in classPDField
- Returns:
- a List of
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. ForPDTerminalField
you'd have to callsetWidgets()
with the modified list.
-