Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.form

public final Class PDRadioButton

extends PDButton
Class Inheritance
Imports
java.util.ArrayList, .List, org.apache.pdfbox.cos.COSDictionary, .COSName, org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget

Radio button fields contain a set of related buttons that can each be on or off.
Author
sug

Field Summary

Modifier and TypeField and Description
private static final int
Inherited from org.apache.pdfbox.pdmodel.interactive.form.PDButton:
FLAG_PUSHBUTTONFLAG_RADIOFLAG_RADIOS_IN_UNISON

Constructor Summary

AccessConstructor and Description
public
PDRadioButton(PDAcroForm
The acroform.
acroForm
)

pack-priv
PDRadioButton(PDAcroForm
The form that this field is part of.
acroForm
,
COSDictionary
the PDF object to represent as a field.
field
,
PDNonTerminalField
the parent node of the node
parent
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public List<String>

Returns:

the export value of the field.
getSelectedExportValues
()

This will get the selected export values.

public int

Returns:

the first selected index or -1.
getSelectedIndex
()

This will get the selected index.

public boolean

Returns:

true If the flag is set for radios in unison.
isRadiosInUnison
()

public void
setRadiosInUnison(boolean
The new flag for radiosInUnison.
radiosInUnison
)

From the PDF Spec If set, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked.

Inherited from org.apache.pdfbox.pdmodel.interactive.form.PDButton:
checkValueconstructAppearancesgetDefaultValuegetExportValuesgetOnValuesgetValuegetValueAsStringisPushButtonisRadioButtonsetDefaultValuesetExportValuessetValuesetValue

Field Detail

FLAG_NO_TOGGLE_TO_OFFback to summary
private static final int FLAG_NO_TOGGLE_TO_OFF

A Ff flag.

Constructor Detail

PDRadioButtonback to summary
public PDRadioButton(PDAcroForm acroForm)
Parameters
acroForm:PDAcroForm

The acroform.

See Also
PDField#PDField(PDAcroForm)
PDRadioButtonback to summary
pack-priv PDRadioButton(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)

Constructor.

Parameters
acroForm:PDAcroForm

The form that this field is part of.

field:COSDictionary

the PDF object to represent as a field.

parent:PDNonTerminalField

the parent node of the node

Method Detail

getSelectedExportValuesback to summary
public List<String> getSelectedExportValues()

This will get the selected export values.

A RadioButton might have an export value to allow field values which can not be encoded as PDFDocEncoding or for the same export value being assigned to multiple RadioButtons in a group.
To define an export value the RadioButton must define options setExportValues(List) which correspond to the individual items within the RadioButton.

The method will either return the corresponding values from the options entry or in case there is no such entry the fields value

Returns:List<String>

the export value of the field.

getSelectedIndexback to summary
public int getSelectedIndex()

This will get the selected index.

A RadioButton might have multiple same value options which are not selected jointly if they are not set in unison isRadiosInUnison().

The method will return the first selected index or -1 if no option is selected.

Returns:int

the first selected index or -1.

isRadiosInUnisonback to summary
public boolean isRadiosInUnison()
Returns:boolean

true If the flag is set for radios in unison.

setRadiosInUnisonback to summary
public void setRadiosInUnison(boolean radiosInUnison)

From the PDF Spec
If set, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked. If clear, the buttons are mutually exclusive (the same behavior as HTML radio buttons).

Parameters
radiosInUnison:boolean

The new flag for radiosInUnison.