Package com.pdftools.toolbox.pdf.forms
Class ComboBox
- java.lang.Object
-
public class ComboBox extends ChoiceField
A combo box field
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ComboBox
create(Document targetDocument)
Create a combo box form fieldboolean
getCanEdit()
Has an editable item (Getter)ChoiceItem
getChosenItem()
The selected combo box item (Getter)java.lang.String
getEditableItemName()
The name of the editable item (Getter)void
setCanEdit(boolean value)
Has an editable item (Setter)void
setChosenItem(ChoiceItem value)
The selected combo box item (Setter)void
setEditableItemName(java.lang.String value)
The name of the editable item (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 ComboBox create(Document targetDocument)
Create a combo 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 combo 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
-
getCanEdit
public boolean getCanEdit()
Has an editable item (Getter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
setCanEdit
public void setCanEdit(boolean value)
Has an editable item (Setter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.UnsupportedOperationException
- if the document is read-only
-
getChosenItem
public ChoiceItem getChosenItem()
The selected combo box item (Getter)
If this property isnull
then thegetEditableItemName()
is the selected value. Setting this property automatically setsgetEditableItemName()
tonull
.- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
setChosenItem
public void setChosenItem(ChoiceItem value)
The selected combo box item (Setter)
If this property isnull
then thegetEditableItemName()
is the selected value. Setting this property automatically setsgetEditableItemName()
tonull
.- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.UnsupportedOperationException
- if the document is read-onlyjava.lang.IllegalArgumentException
- if the provided choice item object does not belong to the combo box fieldjava.lang.IllegalStateException
- if the form field is marked as read-onlyjava.lang.IllegalStateException
- if the form field has widgets
-
getEditableItemName
public java.lang.String getEditableItemName()
The name of the editable item (Getter)
This property isnull
if any of the combo box items is selected, i.e., ifgetChosenItem()
is notnull
. Setting this property automatically setsgetChosenItem()
tonull
.- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
setEditableItemName
public void setEditableItemName(java.lang.String value)
The name of the editable item (Setter)
This property isnull
if any of the combo box items is selected, i.e., ifgetChosenItem()
is notnull
. Setting this property automatically setsgetChosenItem()
tonull
.- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.UnsupportedOperationException
- if the document is read-onlyjava.lang.IllegalStateException
- if the form field has no editable item (getCanEdit()
property isfalse
)java.lang.IllegalStateException
- if the form field is marked as read-onlyjava.lang.IllegalStateException
- if the form field has widgets
-
-