Class ChoiceGroup.Choice
java.lang.Object
fc.web.forms.ChoiceGroup.Choice
- Enclosing class:
ChoiceGroup
Creates a new choice for this choice group.
Also note that unlike other fields, the HTML label/text for this choice
has to be provided via the constructor (as opposed to being written at the
jsp level). See
.
invalid reference
#htmlBeforeField
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new unselected choice with the specified label (and no separate value attribute)Constructs a new unselected choice with the specified value and HTML text.Creates a new choice object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Convenience method that returns the value of this choice as a boolean.int
Convenience method that returns the value of this choice as a Integer.getLabel()
Returns the label for this choice.short
Convenience method that returns the value of this choice as a Short.getValue()
Returns the value of this choice.boolean
void
By default, the HTML label (if any) is written after the input element tag but calling this method reverses this order.void
Renders this choice maintaining it's selected state by using the specified form data.void
Renders this choice with the select state specified by the selected parameter.void
setLabelSeperator
(String sep) Sets the seperator between labels and the choice.toString()
void
writeLabel
(boolean val) Specify true to write the label for this choice, false to skip the label.
-
Constructor Details
-
Choice
-
Choice
-
Choice
-
-
Method Details
-
labelBeforeField
By default, the HTML label (if any) is written after the input element tag but calling this method reverses this order. -
writeLabel
Specify true to write the label for this choice, false to skip the label. By default, this is true. (false is useful when just the radio button need to be shown, say in a table row with the label shown in a seperate header row). -
render
Renders this choice maintaining it's selected state by using the specified form data.Each choice can be rendered separately which helps in arbitrary html layout. Choices can also be rendered together via the parent
invalid @link
{@link ChoiceGroup#render(FormData, Writer
- Throws:
IOException
-
render
Renders this choice with the select state specified by the selected parameter.Each choice can be rendered separately which helps in arbitrary html layout. Choices can also be rendered together via the parent
invalid @link
{@link ChoiceGroup#render(FormData, Writer
- Throws:
IOException
-
getValue
-
getIntValue
Convenience method that returns the value of this choice as a Integer.- Throws:
NumberFormatException
- if the value could not be returned as an integer.
-
getShortValue
Convenience method that returns the value of this choice as a Short.- Throws:
NumberFormatException
- if the value could not be returned as a short.
-
getBooleanValue
Convenience method that returns the value of this choice as a boolean. The value is converted into a boolean as per the invalid input: '{@link Boolean.valueOf(String)'} method. -
getLabel
-
setLabelSeperator
Sets the seperator between labels and the choice. Defaults to a space if not set. -
isOrigSelected
- Returns:
- true if this field was originally set to selected, false otherwise
-
toString
-