public static class ChoiceGroup.Choice extends Object
#htmlBeforeField
.Constructor and Description |
---|
Choice(String label,
boolean selected)
Constructs a new unselected choice with the specified label (and no
separate value attribute)
|
Choice(String label,
String value)
Constructs a new unselected choice with the specified value
and HTML text.
|
Choice(String label,
String value,
boolean selected)
Creates a new choice object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getBooleanValue(FormData fd)
Convenience method that returns the value of this choice as a boolean.
|
int |
getIntValue()
Convenience method that returns the value of this
choice as a Integer.
|
String |
getLabel()
Returns the label for this choice.
|
short |
getShortValue(FormData fd)
Convenience method that returns the value of this choice as a Short.
|
String |
getValue()
Returns the value of this choice.
|
boolean |
isOrigSelected() |
void |
labelBeforeField()
By default, the HTML label (if any) is written after the input element
tag but calling this method reverses this order.
|
void |
render(FormData fd,
Writer writer,
boolean disabled)
Renders this choice maintaining it's selected state by using the
specified form data.
|
void |
render(Writer writer,
boolean selected,
boolean disabled)
Renders this choice with the select state specified by the
selected parameter.
|
void |
setLabelSeperator(String sep)
Sets the seperator between labels and the choice.
|
String |
toString() |
void |
writeLabel(boolean val)
Specify true to write the label for this choice,
false to skip the label.
|
public Choice(String label, String value, boolean selected)
value
- the value of this choice itemlabel
- the label (any html text) for this choice.selected
- true is this choice is
originally selectedpublic Choice(String label, String value)
value
- the value of this choice itemlabel
- the label (any html text) for this choicepublic void labelBeforeField()
public void writeLabel(boolean val)
public void render(FormData fd, Writer writer, boolean disabled) throws IOException
Each choice can be rendered separately which helps in arbitrary
html layout. Choices can also be rendered together via the parent
ChoiceGroup#render(FormData, Writer
method.
IOException
public void render(Writer writer, boolean selected, boolean disabled) throws IOException
Each choice can be rendered separately which helps in arbitrary
html layout. Choices can also be rendered together via the parent
ChoiceGroup#render(FormData, Writer
method.
IOException
public String getValue()
public int getIntValue()
NumberFormatException
- if the value could not be
returned as an integer.public short getShortValue(FormData fd)
NumberFormatException
- if the value could not be
returned as a short.public boolean getBooleanValue(FormData fd)
Boolean.valueOf(String)
method.public void setLabelSeperator(String sep)
public boolean isOrigSelected()