ChoiceField

Inheritance: java.lang.Object, com.aspose.pdf.BaseParagraph, com.aspose.pdf.Annotation, com.aspose.pdf.WidgetAnnotation, com.aspose.pdf.Field

public abstract class ChoiceField extends Field

Represents base class for choice fields.

Constructors

ConstructorDescription
ChoiceField(Page page, Rectangle rect)Constructor for ChoiceField.
ChoiceField(IDocument doc)Creates choice field (for Generator)
ChoiceField(IDocument doc, Rectangle rect)Constructor for ChoiceField.

Methods

MethodDescription
getCommitImmediately()Gets commit on selection change flag.
setCommitImmediately(boolean value)Sets commit on selection change flag.
getMultiSelect()Gets multiselection flag.
setMultiSelect(boolean value)Sets multiselection flag.
getSelected()Gets index of selected option.
setSelected(int value)Sets index of selected option.
getSelectedItems()Sets array of selected items.
setSelectedItems(int[] value)Sets array of selected items.
getOptions()Gets collection of choice options.
setOptions(List options)Replaces the available options with those whose names are given in the options parameter.
addOption(String optionName)Adds new option with specified name.
addOption(String export, String name)Adds new option with specified export value and name.
deleteOption(String optionName)Deletes option by its name.
getValue()Gets value of the field.
setValue(String value)Sets value of the field.

ChoiceField(Page page, Rectangle rect)

public ChoiceField(Page page, Rectangle rect)

Constructor for ChoiceField.

Parameters:

ParameterTypeDescription
pagePagePage where field is situated.
rectRectangleRectangle of the field.

ChoiceField(IDocument doc)

public ChoiceField(IDocument doc)

Creates choice field (for Generator)

Parameters:

ParameterTypeDescription
docIDocumentDocument where choice field will be created.

ChoiceField(IDocument doc, Rectangle rect)

public ChoiceField(IDocument doc, Rectangle rect)

Constructor for ChoiceField.

Parameters:

ParameterTypeDescription
docIDocumentDocument where field will be created.
rectRectangleRectangle of the field.

getCommitImmediately()

public boolean getCommitImmediately()

Gets commit on selection change flag.

Returns: boolean - boolean value

setCommitImmediately(boolean value)

public void setCommitImmediately(boolean value)

Sets commit on selection change flag.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getMultiSelect()

public boolean getMultiSelect()

Gets multiselection flag.

Returns: boolean - boolean value

setMultiSelect(boolean value)

public void setMultiSelect(boolean value)

Sets multiselection flag.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getSelected()

public int getSelected()

Gets index of selected option. This property allows to change selection.

Returns: int - int value

setSelected(int value)

public void setSelected(int value)

Sets index of selected option. This property allows to change selection.

Parameters:

ParameterTypeDescription
valueintint value

getSelectedItems()

public int[] getSelectedItems()

Sets array of selected items. For multiselect list array contains more then one item. For single selection list it contains single item.

Returns: int[] - array of int values

setSelectedItems(int[] value)

public void setSelectedItems(int[] value)

Sets array of selected items. For multiselect list array contains more then one item. For single selection list it contains single item.

Parameters:

ParameterTypeDescription
valueint[]array of int values

getOptions()

public OptionCollection getOptions()

Gets collection of choice options.

Returns: OptionCollection - OptionCollection object

setOptions(List options)

public final void setOptions(List<String> options)

Replaces the available options with those whose names are given in the options parameter.

Parameters:

ParameterTypeDescription
optionsjava.util.List<java.lang.String>List of names for new options.

addOption(String optionName)

public void addOption(String optionName)

Adds new option with specified name.

Parameters:

ParameterTypeDescription
optionNamejava.lang.StringName of the new option.

addOption(String export, String name)

public void addOption(String export, String name)

Adds new option with specified export value and name.

Parameters:

ParameterTypeDescription
exportjava.lang.StringExport value.
namejava.lang.StringName of the new option.

deleteOption(String optionName)

public void deleteOption(String optionName)

Deletes option by its name.

Parameters:

ParameterTypeDescription
optionNamejava.lang.StringName of the option which must be deleted.

getValue()

public String getValue()

Gets value of the field.

Returns: java.lang.String - String value

setValue(String value)

public void setValue(String value)

Sets value of the field.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value