Package com.itextpdf.forms.form.element
Class AbstractSelectField
- 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
-
- All Implemented Interfaces:
IFormField
,IAbstractElement
,IBlockElement
,IElement
,IPropertyContainer
,IAccessibleElement
- Direct Known Subclasses:
ComboBoxField
,ListBoxField
public abstract class AbstractSelectField extends FormField<AbstractSelectField>
An abstract class for fields that represents a control for selecting one or several of the provided options.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<SelectFieldItem>
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 Modifier Constructor Description protected
AbstractSelectField(java.lang.String id)
Instantiates a newAbstractSelectField
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addOption(SelectFieldItem option)
Add an option to the element.void
addOption(SelectFieldItem option, boolean selected)
Add an option to the element.void
addOption(IBlockElement optionElement)
Deprecated.starting from 8.0.1.java.util.List<SelectFieldItem>
getItems()
Get a list ofSelectFieldItem
.SelectFieldItem
getOption(java.lang.String value)
Get an optionSelectFieldItem
by its string value.java.util.List<IBlockElement>
getOptions()
Deprecated.starting from 8.0.1.boolean
hasExportAndDisplayValues()
Checks if the field has options with export and display values.boolean
hasOptions()
Checks if the element has any options.int
optionsCount()
Gets the total amount of options available.private java.lang.String
tryAndExtractText(IBlockElement optionElement)
-
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, makeNewRenderer, 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, setBold, 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, setItalic, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing
-
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.tagging.IAccessibleElement
getAccessibilityProperties
-
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
-
-
-
-
Field Detail
-
options
protected java.util.List<SelectFieldItem> options
-
-
Constructor Detail
-
AbstractSelectField
protected AbstractSelectField(java.lang.String id)
Instantiates a newAbstractSelectField
instance.- Parameters:
id
- the id of the field
-
-
Method Detail
-
addOption
@Deprecated public void addOption(IBlockElement optionElement)
Deprecated.starting from 8.0.1.Add a container with options. This might be a container for options group.- Parameters:
optionElement
- a container with options
-
addOption
public void addOption(SelectFieldItem option)
Add an option to the element.- Parameters:
option
- aSelectFieldItem
-
addOption
public void addOption(SelectFieldItem option, boolean selected)
Add an option to the element.- Parameters:
option
- aSelectFieldItem
selected
-true
is the option if selected,false
otherwise
-
getItems
public java.util.List<SelectFieldItem> getItems()
Get a list ofSelectFieldItem
.- Returns:
- a list of options.
-
optionsCount
public int optionsCount()
Gets the total amount of options available.- Returns:
- the number of options in the element.
-
hasOptions
public boolean hasOptions()
Checks if the element has any options.- Returns:
- true if the element has options, false otherwise.
-
getOption
public SelectFieldItem getOption(java.lang.String value)
Get an optionSelectFieldItem
by its string value.- Parameters:
value
- string value to find an option by- Returns:
- a
SelectFieldItem
.
-
getOptions
@Deprecated public java.util.List<IBlockElement> getOptions()
Deprecated.starting from 8.0.1.Gets a list of containers with option(s). Every container might be a container for options group.- Returns:
- a list of containers with options.
-
hasExportAndDisplayValues
public boolean hasExportAndDisplayValues()
Checks if the field has options with export and display values.- Returns:
true
if the field has options with export and display values,false
otherwise.
-
tryAndExtractText
private java.lang.String tryAndExtractText(IBlockElement optionElement)
-
-