FormWidgetInfo.Builder


public static final class FormWidgetInfo.Builder
extends Object

java.lang.Object
   ↳ android.graphics.pdf.models.FormWidgetInfo.Builder


Builder for FormWidgetInfo

Summary

Public constructors

Builder(int widgetType, int widgetIndex, Rect widgetRect, String textValue, String accessibilityLabel)

Creates an instance

Public methods

FormWidgetInfo build()

Builds a FormWidgetInfo

FormWidgetInfo.Builder setEditableText(boolean editableText)

Sets whether this widget contains editable text.

FormWidgetInfo.Builder setFontSize(float fontSize)

Sets the font size for this widget.

FormWidgetInfo.Builder setListItems(List<ListItem> listItems)

Sets the choice options for this widget.

FormWidgetInfo.Builder setMaxLength(int maxLength)

Sets the maximum character length of input text supported by this widget.

FormWidgetInfo.Builder setMultiLineText(boolean multiLineText)

Sets whether this widget supports multi-line text input.

FormWidgetInfo.Builder setMultiSelect(boolean multiSelect)

Sets whether this widget supports multiple choice selections.

FormWidgetInfo.Builder setReadOnly(boolean readOnly)

Sets whether this widget is read-only

Inherited methods

Public constructors

Builder

public Builder (int widgetType, 
                int widgetIndex, 
                Rect widgetRect, 
                String textValue, 
                String accessibilityLabel)

Creates an instance

Parameters
widgetType int: the type of widget Value is FormWidgetInfo.WIDGET_TYPE_UNKNOWN, FormWidgetInfo.WIDGET_TYPE_PUSHBUTTON, FormWidgetInfo.WIDGET_TYPE_CHECKBOX, FormWidgetInfo.WIDGET_TYPE_RADIOBUTTON, FormWidgetInfo.WIDGET_TYPE_COMBOBOX, FormWidgetInfo.WIDGET_TYPE_LISTBOX, FormWidgetInfo.WIDGET_TYPE_TEXTFIELD, or FormWidgetInfo.WIDGET_TYPE_SIGNATURE

widgetIndex int: the index of the widget in the page's "Annot" array in the PDF Value is 0 or greater

widgetRect Rect: the Rect in page coordinates occupied by the widget This value cannot be null.

textValue String: the widget's text value This value cannot be null.

accessibilityLabel String: the field's accessibility label This value cannot be null.

Throws
NullPointerException if any of widgetRect, textValue, or accessibilityLabel are null

Public methods

build

public FormWidgetInfo build ()

Builds a FormWidgetInfo

Returns
FormWidgetInfo This value cannot be null.

setEditableText

public FormWidgetInfo.Builder setEditableText (boolean editableText)

Sets whether this widget contains editable text. Only supported for comboboxes and text fields

Parameters
editableText boolean

Returns
FormWidgetInfo.Builder This value cannot be null.

Throws
IllegalArgumentException if this is not a combobox or text field type widget

setFontSize

public FormWidgetInfo.Builder setFontSize (float fontSize)

Sets the font size for this widget. Only supported for text fields and comboboxes

Parameters
fontSize float: Value is 0f or greater

Returns
FormWidgetInfo.Builder This value cannot be null.

Throws
IllegalArgumentException if this is not a combobox or text field, or if a negative font size is supplied

setListItems

public FormWidgetInfo.Builder setListItems (List<ListItem> listItems)

Sets the choice options for this widget. Only supported for comboboxes and list boxes

Parameters
listItems List: This value cannot be null.

Returns
FormWidgetInfo.Builder This value cannot be null.

Throws
IllegalArgumentException if this is not a combobox or list box
NullPointerException if choiceOptions is null

setMaxLength

public FormWidgetInfo.Builder setMaxLength (int maxLength)

Sets the maximum character length of input text supported by this widget. Only supported for text fields

Parameters
maxLength int: Value is 0 or greater

Returns
FormWidgetInfo.Builder This value cannot be null.

Throws
IllegalArgumentException if this is not a text field, or if a negative max length is supplied

setMultiLineText

public FormWidgetInfo.Builder setMultiLineText (boolean multiLineText)

Sets whether this widget supports multi-line text input. Only supported for text fields

Parameters
multiLineText boolean

Returns
FormWidgetInfo.Builder This value cannot be null.

Throws
IllegalArgumentException if this is not a text field

setMultiSelect

public FormWidgetInfo.Builder setMultiSelect (boolean multiSelect)

Sets whether this widget supports multiple choice selections. Only supported for list boxes

Parameters
multiSelect boolean

Returns
FormWidgetInfo.Builder This value cannot be null.

Throws
IllegalArgumentException if this is not a list box

setReadOnly

public FormWidgetInfo.Builder setReadOnly (boolean readOnly)

Sets whether this widget is read-only

Parameters
readOnly boolean

Returns
FormWidgetInfo.Builder This value cannot be null.