public abstract class PDButton extends PDTerminalField
Constructor and Description |
---|
PDButton(PDAcroForm acroForm) |
Modifier and Type | Method and Description |
---|---|
String |
getDefaultValue()
Returns the default value, if any.
|
List<String> |
getExportValues()
This will get the (optional) export values.
|
Set<String> |
getOnValues()
Get the values to set individual buttons within a group to the on state.
|
String |
getValue()
Returns the selected value.
|
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(String value)
Sets the default value.
|
void |
setExportValues(List<String> values)
This will set the export values.
|
void |
setPushButton(boolean pushbutton)
Deprecated.
use
PDPushButton instead |
void |
setRadioButton(boolean radiobutton)
Deprecated.
use
PDRadioButton instead |
void |
setValue(int index)
Set the selected option given its index, and try to update the visual appearance.
|
void |
setValue(String value)
Sets the selected option given its name.
|
applyChange, getFieldFlags, getFieldType, getWidget, getWidgets, importFDF, setActions, setWidgets
getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, toString
public PDButton(PDAcroForm acroForm)
acroForm
- The acroform.PDField.PDField(PDAcroForm)
public boolean isPushButton()
@Deprecated public void setPushButton(boolean pushbutton)
PDPushButton
insteadpushbutton
- if true the button field is treated as a push button field.public boolean isRadioButton()
@Deprecated public void setRadioButton(boolean radiobutton)
PDRadioButton
insteadradiobutton
- if true the button field is treated as a radio button field.public String getValue()
Off is the default value which will also be returned if the value hasn't been set at all.
public void setValue(String value) throws IOException
PDAcroForm.getNeedAppearances()
is true.setValue
in class PDField
value
- Name of option to selectIOException
- if the value could not be setIllegalArgumentException
- if the value is not a valid option.public void setValue(int index) throws IOException
index
- index of option to be selectedIOException
- if the value could not be setIllegalArgumentException
- if the index provided is not a valid index.public String getDefaultValue()
public void setDefaultValue(String value)
value
- Name of option to selectIllegalArgumentException
- if the value is not a valid option.public String getValueAsString()
PDField
getValueAsString
in class PDField
public List<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(List<String> values)
values
- List containing all possible export values. Supplying null or an empty list will remove the Opt entry.getExportValues()
public Set<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
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.