public abstract class PDButton extends PDTerminalField
Modifier and Type | Field and Description |
---|---|
(package private) static int |
FLAG_PUSHBUTTON
A Ff flag.
|
(package private) static int |
FLAG_RADIO
A Ff flag.
|
(package private) static int |
FLAG_RADIOS_IN_UNISON
A Ff flag.
|
Constructor and Description |
---|
PDButton(PDAcroForm acroForm) |
PDButton(PDAcroForm acroForm,
COSDictionary field,
PDNonTerminalField parent)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
checkValue(java.lang.String value)
Checks value.
|
(package private) void |
constructAppearances()
Constructs appearance streams and appearance dictionaries for all widget annotations.
|
java.lang.String |
getDefaultValue()
Returns the default value, if any.
|
java.util.List<java.lang.String> |
getExportValues()
This will get the (optional) export values.
|
private java.lang.String |
getOnValue(int index) |
private java.lang.String |
getOnValueForWidget(PDAnnotationWidget widget) |
java.util.Set<java.lang.String> |
getOnValues()
Get the values to set individual buttons within a group to the on state.
|
java.lang.String |
getValue()
Returns the selected value.
|
java.lang.String |
getValueAsString()
Returns a string representation of the "V" entry, or an empty string.
|
boolean |
isPushButton()
Determines if push button bit is set.
|
boolean |
isRadioButton()
Determines if radio button bit is set.
|
void |
setDefaultValue(java.lang.String value)
Sets the default value.
|
void |
setExportValues(java.util.List<java.lang.String> values)
This will set the export values.
|
void |
setPushButton(boolean pushbutton)
Set the push button bit.
|
void |
setRadioButton(boolean radiobutton)
Set the radio button bit.
|
void |
setValue(java.lang.String value)
Sets the selected option given its name.
|
private void |
updateByOption(java.lang.String value) |
private void |
updateByValue(java.lang.String value) |
applyChange, exportFDF, getFieldFlags, getFieldType, getWidget, getWidgets, importFDF, setActions, setWidgets
findKid, fromDictionary, getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, toString
static final int FLAG_RADIO
static final int FLAG_PUSHBUTTON
static final int FLAG_RADIOS_IN_UNISON
public PDButton(PDAcroForm acroForm)
acroForm
- The acroform.PDField.PDField(PDAcroForm)
PDButton(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
acroForm
- The form that this field is part of.field
- the PDF object to represent as a field.parent
- the parent node of the nodepublic boolean isPushButton()
public void setPushButton(boolean pushbutton)
pushbutton
- if true the button field is treated as a push button field.public boolean isRadioButton()
public void setRadioButton(boolean radiobutton)
radiobutton
- if true the button field is treated as a radio button field.public java.lang.String getValue()
Off is the default value which will also be returned if the value hasn't been set at all.
public void setValue(java.lang.String value) throws java.io.IOException
PDAcroForm.getNeedAppearances()
is true.public java.lang.String getDefaultValue()
public void setDefaultValue(java.lang.String value)
value
- Name of option to selectjava.lang.IllegalArgumentException
- if the value is not a valid option.public java.lang.String getValueAsString()
PDField
getValueAsString
in class PDField
public java.util.List<java.lang.String> getExportValues()
The export values are defined in the field dictionaries /Opt key.
The option values are used to define the export values for the field to
getOnValues()
public void setExportValues(java.util.List<java.lang.String> values)
values
- List containing all possible export values. Supplying null or an empty list will remove the Opt entry.getExportValues()
void constructAppearances() throws java.io.IOException
PDTerminalField
PDTerminalField.applyChange()
.constructAppearances
in class PDTerminalField
java.io.IOException
- if the appearance couldn't be generatedpublic java.util.Set<java.lang.String> getOnValues()
The On value could be an arbitrary string as long as it is within the limitations of a PDF name object. The Off value shall always be 'Off'. If not set or not part of the normal appearance keys 'Off' is the default
private java.lang.String getOnValue(int index)
private java.lang.String getOnValueForWidget(PDAnnotationWidget widget)
void checkValue(java.lang.String value)
value
- Name of radio button to selectjava.lang.IllegalArgumentException
- if the value is not a valid option.private void updateByValue(java.lang.String value) throws java.io.IOException
java.io.IOException
private void updateByOption(java.lang.String value) throws java.io.IOException
java.io.IOException