Package com.pdftools.toolbox.pdf.forms
Class ListBox
- java.lang.Object
-
public class ListBox extends ChoiceField
A list box field
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ListBox
create(Document targetDocument)
Create a list box form fieldboolean
getAllowMultiSelect()
Allow multiple items to be selected (Getter)ChoiceItemList
getChosenItems()
The selected choice items (Getter)void
setAllowMultiSelect(boolean value)
Allow multiple items to be selected (Setter)-
Methods inherited from class com.pdftools.toolbox.pdf.forms.ChoiceField
addNewItem, getItems
-
Methods inherited from class com.pdftools.toolbox.pdf.forms.Field
addNewWidget, getDoNotExport, getReadOnly, getRequired, getWidgets, setDoNotExport, setReadOnly, setRequired
-
Methods inherited from class com.pdftools.toolbox.pdf.forms.FieldNode
copy, getDisplayName, getExportName, setDisplayName, setExportName
-
Methods inherited from class com.pdftools.toolbox.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
create
public static ListBox create(Document targetDocument)
Create a list box form field
The returned form field object is not yet used, but it is associated with the given target document.- Parameters:
targetDocument
- the output document with which the returned object is associated- Returns:
- the newly created list box field
- Throws:
java.lang.IllegalArgumentException
- if thetargetDocument
argument has already been closedjava.lang.IllegalArgumentException
- if thetargetDocument
argument is read-onlyjava.lang.IllegalArgumentException
- the target document contains form fields that have been implicitly copied by a call totoolbox.pdf.Page.copy
with an argumentoptions
in whichtoolbox.pdf.PageCopyOptions.setFormFields
was set toFormFieldCopyStrategy.COPY
java.lang.IllegalArgumentException
- the target document contains unsigned signatures that have been implicitly copied by a call totoolbox.pdf.Page.copy
with an argumentoptions
in whichtoolbox.pdf.PageCopyOptions.setUnsignedSignatures
was set totoolbox.pdf.CopyStrategy.COPY
.java.lang.IllegalArgumentException
- iftargetDocument
isnull
-
getAllowMultiSelect
public boolean getAllowMultiSelect()
Allow multiple items to be selected (Getter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
setAllowMultiSelect
public void setAllowMultiSelect(boolean value)
Allow multiple items to be selected (Setter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.UnsupportedOperationException
- if the document is read-only
-
getChosenItems
public ChoiceItemList getChosenItems()
The selected choice items (Getter)
Adding to this list results in an error:
-
IllegalState
- if the list has already been closed
- if the choice field is marked a read-only
- if this list is not empty and the list box field is not marked as multi-select
- if the choice field has widgets
- UnsupportedOperation if the document is read-only
-
IllegalArgument
-
if the given choice item is
null
- if the given choice item has already been closed
- if the given choice item is already present in this list
- if the given choice item does not belong to the list box field's choice items
-
if the given choice item is
Removing items or clearing the list results in an IllegalState error if the form field is marked as read-only, or if it has widgets.
- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
IllegalState
-
-