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.LoggerLOGGERprivate java.lang.StringselectedExportValue-
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 voidaddOption(SelectFieldItem option)Add an option to the element.private voidclearSelected()AccessibilityPropertiesgetAccessibilityProperties()Gets theaccessibility properties.java.lang.StringgetSelectedExportValue()Gets the export value of the selected option.SelectFieldItemgetSelectedOption()Gets the selected option.protected IRenderermakeNewRenderer()Creates a new renderer instance.ComboBoxFieldsetSelected(int index)Selects an option by its index.ComboBoxFieldsetSelected(SelectFieldItem item)Selects an option by its value.ComboBoxFieldsetSelected(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, setAlternativeDescription, 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, getTransparentStrokeColor, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, 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
ComboBoxFieldinstance. - 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
ComboBoxFieldinstance.
-
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
ComboBoxFieldinstance.
-
addOption
public void addOption(SelectFieldItem option)
Add an option to the element.- Overrides:
addOptionin 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:AbstractElementCreates a new renderer instance.- Specified by:
makeNewRendererin classAbstractElement<AbstractSelectField>- Returns:
- new
IRenderer
-
clearSelected
private void clearSelected()
-
-