java.lang.Object
org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
org.sejda.sambox.pdmodel.interactive.form.PDField
org.sejda.sambox.pdmodel.interactive.form.PDTerminalField
org.sejda.sambox.pdmodel.interactive.form.PDButton
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDCheckBox,PDPushButton,PDRadioButton
A button field represents an interactive control on the screen that the user can manipulate with
the mouse.
- Author:
- sug
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the default value, if any.This will get the export values.Get the values to set individual buttons within a group to the on state.getValue()Returns the selected value.Returns a string representation of the "V" entry, or an empty string.booleanbooleanDetermines if push button bit is set.booleanDetermines if radio button bit is set.voidsetDefaultValue(String value) Sets the default value.voidsetExportValues(List<String> values) This will set the export values.voidsetIgnoreExportOptions(boolean ignoreExportOptions) voidsetPushButton(boolean pushbutton) Deprecated.voidsetRadioButton(boolean radiobutton) Deprecated.usePDRadioButtoninsteadvoidsetValue(int index) Set the selected option given its index, and try to update the visual appearance.voidSets the selected option given its name.Methods inherited from class org.sejda.sambox.pdmodel.interactive.form.PDTerminalField
addWidgetIfMissing, applyChange, getFieldFlags, getFieldType, getWidgets, isTerminal, removeWidget, setActions, setWidgetsMethods inherited from class org.sejda.sambox.pdmodel.interactive.form.PDField
getAcroForm, getActions, getAlternateFieldName, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, isNoExport, isReadonly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadonly, setRequired, toStringMethods inherited from class org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
equals, getCOSObject, hashCode
-
Constructor Details
-
PDButton
- Parameters:
acroForm- The acroform.- See Also:
-
PDField(PDAcroForm)
-
-
Method Details
-
isPushButton
public boolean isPushButton()Determines if push button bit is set.- Returns:
- true if type of button field is a push button.
-
setPushButton
Deprecated.usePDPushButtoninsteadSet the push button bit.- Parameters:
pushbutton- if true the button field is treated as a push button field.
-
isRadioButton
public boolean isRadioButton()Determines if radio button bit is set.- Returns:
- true if type of button field is a radio button.
-
setRadioButton
Deprecated.usePDRadioButtoninsteadSet the radio button bit.- Parameters:
radiobutton- if true the button field is treated as a radio button field.
-
getValue
Returns the selected value.Off is the default value which will also be returned if the value hasn't been set at all.
- Returns:
- A non-null string.
-
setValue
Sets the selected option given its name. It also tries to update the visual appearance, unlessPDAcroForm.isNeedAppearances()is true.- Specified by:
setValuein classPDField- Parameters:
value- Name of option to select- Throws:
IOException- if the value could not be setIllegalArgumentException- if the value is not a valid option.
-
setValue
Set the selected option given its index, and try to update the visual appearance.NOTE: this method is only usable if there are export values and used for radio buttons with FLAG_RADIOS_IN_UNISON not set.
- Parameters:
index- index of option to be selected- Throws:
IOException- if the value could not be setIllegalArgumentException- if the index provided is not a valid index.
-
getDefaultValue
Returns the default value, if any.- Returns:
- A non-null string.
-
setDefaultValue
Sets the default value.- Parameters:
value- Name of option to select- Throws:
IllegalArgumentException- if the value is not a valid option.
-
getValueAsString
Description copied from class:PDFieldReturns a string representation of the "V" entry, or an empty string.- Specified by:
getValueAsStringin classPDField- Returns:
- A non-null string.
-
getExportValues
This will get the export values.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
- hold values in non-Latin writing systems as name objects, which represent the field value, are limited to PDFDocEncoding
- allow radio buttons having the same export value to be handled independently
- Returns:
- List containing all possible export values. If there is no Opt entry an empty list will be returned.
-
setExportValues
This will set the export values.- Parameters:
values- List containing all possible export values. Supplying null or an empty list will remove the Opt entry.- See Also:
-
getOnValues
Get the values to set individual buttons within a group to the on state.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
- Returns:
- the potential values setting the check box to the On state. If an empty Set is returned there is no appearance definition.
-
getNormalAppearanceValues
-
getOnValueForWidget
-
isIgnoreExportOptions
public boolean isIgnoreExportOptions() -
setIgnoreExportOptions
public void setIgnoreExportOptions(boolean ignoreExportOptions)
-
PDPushButtoninstead