Class PDNonTerminalField
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.form.PDField
-
- org.apache.pdfbox.pdmodel.interactive.form.PDNonTerminalField
-
- All Implemented Interfaces:
COSObjectable
public class PDNonTerminalField extends PDField
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.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.LogLOG
-
Constructor Summary
Constructors Constructor Description PDNonTerminalField(PDAcroForm acroForm)Constructor.PDNonTerminalField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) FDFFieldexportFDF()Exports this field and its children as FDF.java.util.List<PDField>getChildren()Returns this field's children.COSBasegetDefaultValue()Returns the default value of this field.intgetFieldFlags()This will get the flags for this field.java.lang.StringgetFieldType()Get the FT entry of the field.COSBasegetValue()Returns the COSBase value of the "V" entry.java.lang.StringgetValueAsString()Returns a string representation of the "V" entry, or an empty string.java.util.List<PDAnnotationWidget>getWidgets()Returns the widget annotations associated with this field.(package private) voidimportFDF(FDFField fdfField)This will import a fdf field from a fdf document.voidsetChildren(java.util.List<PDField> children)Sets the child fields.voidsetDefaultValue(COSBase value)Sets the default of this field.voidsetValue(java.lang.String value)Sets the plain text value of this field.voidsetValue(COSBase object)Sets the value of this field.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDField
findKid, fromDictionary, getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, toString
-
-
-
-
Constructor Detail
-
PDNonTerminalField
public PDNonTerminalField(PDAcroForm acroForm)
Constructor.- Parameters:
acroForm- The form that this field is part of.
-
PDNonTerminalField
PDNonTerminalField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
Constructor.- Parameters:
acroForm- The form that this field is part of.field- the PDF object to represent as a field.parent- the parent node of the node to be created
-
-
Method Detail
-
getFieldFlags
public int getFieldFlags()
Description copied from class:PDFieldThis will get the flags for this field.- Specified by:
getFieldFlagsin classPDField- Returns:
- flags The set of flags.
-
importFDF
void importFDF(FDFField fdfField) throws java.io.IOException
Description copied from class:PDFieldThis will import a fdf field from a fdf document.
-
exportFDF
FDFField exportFDF() throws java.io.IOException
Description copied from class:PDFieldExports this field and its children as FDF.
-
getChildren
public java.util.List<PDField> 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
public void setChildren(java.util.List<PDField> children)
Sets the child fields.- Parameters:
children- The list of child fields.
-
getFieldType
public java.lang.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.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
- Specified by:
getFieldTypein classPDField- Returns:
- The Field type.
-
getValue
public COSBase getValue()
Returns the COSBase value of the "V" entry.Note: while non-terminal fields do inherit field values, this method returns the local value, without inheritance.
- Returns:
- the COSBase value of the "V" entry
-
getValueAsString
public java.lang.String 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:
getValueAsStringin classPDField- Returns:
- The list of widget annotations.
-
setValue
public void setValue(COSBase object)
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- the new value
-
setValue
public void setValue(java.lang.String value) throws java.io.IOExceptionSets the plain text value of this field.
-
getDefaultValue
public COSBase 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.
- Returns:
- the new default value
-
setDefaultValue
public void setDefaultValue(COSBase value)
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- the default value
-
getWidgets
public java.util.List<PDAnnotationWidget> getWidgets()
Description copied from class:PDFieldReturns the widget annotations associated with this field. ForPDNonTerminalFieldthe list will be empty as non terminal fields have no visual representation in the form.- Specified by:
getWidgetsin classPDField- Returns:
- a List of
PDAnnotationWidgetannotations. 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. ForPDTerminalFieldyou'd have to callsetWidgets()with the modified list.
-
-