com.snowtide.pdf.forms
Class AcroCheckboxField

java.lang.Object
  extended bycom.snowtide.pdf.forms.BaseAcroFormField
      extended bycom.snowtide.pdf.forms.AcroButtonField
          extended bycom.snowtide.pdf.forms.AcroCheckboxField
All Implemented Interfaces:
AcroFormField, FormField

public class AcroCheckboxField
extends AcroButtonField

Instances of this class represent individual checkboxes in an interactive forms. Refer to AcroButtonField and AcroFormField for overview documentation.

In addition to the standard AcroFormField.setValue(String) function, AcroCheckboxField instances provide a setValue(boolean) function, making it easy to set the state of a checkbox form field without the extra indirection of having to determine what String value needs to be used to set it to the "checked" state.

Since:
v2.1
Version:
©2004-2008 Snowtide Informatics Systems, Inc.

Field Summary
 
Fields inherited from class com.snowtide.pdf.forms.AcroButtonField
BUTTON_TYPE_CHECKBOX, BUTTON_TYPE_PUSHBUTTON, BUTTON_TYPE_RADIO_GROUP, callback, DEFAULT_UNSELECTED_VALUE
 
Fields inherited from interface com.snowtide.pdf.forms.AcroFormField
FIELD_TYPE_BUTTON, FIELD_TYPE_CHOICE, FIELD_TYPE_OTHER, FIELD_TYPE_SIGNATURE, FIELD_TYPE_TEXT
 
Method Summary
 boolean canChangeValue()
          This function always returns true.
 java.lang.String getCheckedValue()
          Returns the value that represents the checked state for this checkbox.
 boolean isChecked()
          Returns true only if this checkbox is checked (i.e.
 boolean setValue(boolean checked)
           Sets the value of this checkbox field to be checked (true) or unchecked (false).
 boolean setValue(java.lang.String value)
           Sets the value of this checkbox directly.
 
Methods inherited from class com.snowtide.pdf.forms.AcroButtonField
getButtonType, getDefaultValue, getExportValue, getExportValues, getFullName, getLocalName, getMappingName, getName, getType, getUIName, getValue, hasValueChanged, isReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCheckedValue

public java.lang.String getCheckedValue()
Returns the value that represents the checked state for this checkbox. (The string "/Off" represents the unchecked state for all checkboxes.) If this is null, then the name of the checked state for this checkbox could not be determined.


setValue

public boolean setValue(boolean checked)

Sets the value of this checkbox field to be checked (true) or unchecked (false). If this function call results in the actual value of the checkbox changing, then true will be returned. False will be returned only if:


isChecked

public boolean isChecked()
Returns true only if this checkbox is checked (i.e. AcroButtonField.getValue().equals(getCheckedValue())).


setValue

public boolean setValue(java.lang.String value)
                 throws java.lang.IllegalArgumentException

Sets the value of this checkbox directly. The provided value must be one of: null (unchecks the checkbox), AcroButtonField.DEFAULT_UNSELECTED_VALUE (unchecks the checkbox), or the checked value for this checkbox (which will check the checkbox). Using the setValue(boolean) function instead of this one is recommended.

If this function call results in the actual value of the checkbox changing, then true will be returned. False will be returned only if the checkbox field already has the specified value.

Throws:
java.lang.IllegalArgumentException - - if an invalid value is provided as described above.

canChangeValue

public boolean canChangeValue()
This function always returns true.