Package com.itextpdf.forms.form.element
Class ComboBoxField
- java.lang.Object
-
- com.itextpdf.commons.actions.sequence.AbstractIdentifiableElement
-
- com.itextpdf.layout.ElementPropertyContainer<T>
-
- com.itextpdf.layout.element.AbstractElement<T>
-
- com.itextpdf.forms.form.element.FormField<AbstractSelectField>
-
- com.itextpdf.forms.form.element.AbstractSelectField
-
- com.itextpdf.forms.form.element.ComboBoxField
-
- All Implemented Interfaces:
IFormField
,IAbstractElement
,IBlockElement
,IElement
,IPropertyContainer
,IAccessibleElement
public class ComboBoxField extends AbstractSelectField
A field that represents a control for selecting one of the provided options.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
LOGGER
private java.lang.String
selectedExportValue
-
Fields inherited from class com.itextpdf.forms.form.element.AbstractSelectField
options
-
Fields inherited from class com.itextpdf.forms.form.element.FormField
tagProperties
-
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
-
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
-
Constructor Summary
Constructors Constructor Description ComboBoxField(java.lang.String id)
Creates a new select field box.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOption(SelectFieldItem option)
Add an option to the element.private void
clearSelected()
AccessibilityProperties
getAccessibilityProperties()
Gets theaccessibility properties
.java.lang.String
getSelectedExportValue()
Gets the export value of the selected option.SelectFieldItem
getSelectedOption()
Gets the selected option.protected IRenderer
makeNewRenderer()
Creates new renderer instance.ComboBoxField
setSelected(int index)
Selects an option by its index.ComboBoxField
setSelected(SelectFieldItem item)
Selects an option by its value.ComboBoxField
setSelected(java.lang.String value)
Selects an option by its export value.-
Methods inherited from class com.itextpdf.forms.form.element.AbstractSelectField
addOption, getOption, getOptions, hasExportAndDisplayValues, hasOptions, optionsCount
-
Methods inherited from class com.itextpdf.forms.form.element.FormField
getDefaultProperty, getId, setHeight, setInteractive, setSize, setValue, setWidth
-
Methods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, getRenderer, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
-
Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.itextpdf.layout.element.IAbstractElement
getChildren
-
Methods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, getRenderer, setNextRenderer
-
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
-
-
-
Method Detail
-
getSelectedExportValue
public java.lang.String getSelectedExportValue()
Gets the export value of the selected option.- Returns:
- the export value of the selected option. This may be null if no value has been selected.
-
setSelected
public ComboBoxField setSelected(int index)
Selects an option by its index. The index is zero-based.- Parameters:
index
- the index of the option to select.- Returns:
- this
ComboBoxField
instance. - Throws:
java.lang.IndexOutOfBoundsException
- if the index is out of bounds.
-
setSelected
public ComboBoxField setSelected(java.lang.String value)
Selects an option by its export value.- Parameters:
value
- the export value of the option to select.- Returns:
- this
ComboBoxField
instance.
-
setSelected
public ComboBoxField setSelected(SelectFieldItem item)
Selects an option by its value. This will use the export value of the option to match it to existing options.- Parameters:
item
- the option to select.- Returns:
- this
ComboBoxField
instance.
-
addOption
public void addOption(SelectFieldItem option)
Add an option to the element.- Overrides:
addOption
in classAbstractSelectField
- Parameters:
option
- aSelectFieldItem
.
-
getSelectedOption
public SelectFieldItem getSelectedOption()
Gets the selected option.- Returns:
- the selected option. This may be null if no option has been selected.
-
getAccessibilityProperties
public AccessibilityProperties getAccessibilityProperties()
Gets theaccessibility properties
. See alsoIAccessibleElement
.- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
protected IRenderer makeNewRenderer()
Description copied from class:AbstractElement
Creates new renderer instance.- Specified by:
makeNewRenderer
in classAbstractElement<AbstractSelectField>
- Returns:
- new
IRenderer
-
clearSelected
private void clearSelected()
-
-