|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfc.web.forms.Field
fc.web.forms.Choice
public abstract class Choice
Abstracts an HTML choice type such as choicebox or radio.
Does not abstract a HTML select element for which the
Select
class should be used. Concrete subclasses
represent a particular choice element such as Checkbox
and Radio
Nested Class Summary |
---|
Nested classes/interfaces inherited from class fc.web.forms.Field |
---|
Field.Type |
Method Summary | |
---|---|
boolean |
getBooleanValue(FormData fd)
Convenience method that returns the value of this field as a boolean. |
int |
getIntValue(FormData fd)
Convenience method that returns the value of this field as a Integer. |
short |
getShortValue(FormData fd)
Convenience method that returns the value of this field as a Short. |
abstract Field.Type |
getType()
Subclasses should return an appropriate Field.Type . |
java.lang.String |
getValue(FormData fd)
Returns the current value of this field. |
boolean |
isFilled(FormData fd)
Returns true if this field was isFilled out or selected by the user, false otherwise. |
void |
renderImpl(FormData fd,
java.io.Writer writer)
|
void |
setSelected(boolean select)
Sets the initial selection status for this field. |
void |
setValue(FormData fd,
boolean selected)
Convenience method that sets this choice to be selected/non-selected. |
void |
setValue(FormData fd,
java.lang.String value)
Sets the selected or non-selected state for this choice in the specified form data. |
void |
setValue(java.lang.String value,
boolean selected)
Sets the value for this choice. |
void |
setValueFromSubmit(FormData fd,
javax.servlet.http.HttpServletRequest req)
This method sets the value of this field from the parameters obtained from the specified request. |
java.lang.String |
toString()
|
Methods inherited from class fc.web.forms.Field |
---|
add, addError, addLabel, addString, disable, disable, enable, enable, getLabel, getName, getValidateErrors, isEnabled, render, render, render, renderError, renderError, renderStyleTag, setStyleTag, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public abstract Field.Type getType()
Field
Field.Type
. This type
is rendered as part of <input type= ...
getType
in class Field
public java.lang.String getValue(FormData fd)
- null: if no value is currently set which can happen if this field was not selected when the parent form was submitted. Browsers send nothing at all if choice type fields are not selected in an HTML form.
- the value attribute of this field (if this choice field was created/displayed with a value attribute) or the string "on" (which is sent by browsers if there is no specific value attribute for this choice field). Note, the default value should be treated as case insensitive, since browsers can send on, ON etc.
public void setValue(FormData fd, java.lang.String value)
fd
- a non-null form data objectvalue
- any non-null valuepublic void setValue(FormData fd, boolean selected)
fd
- a non-null form data objectselected
- true to select this choice, false otherwisepublic void setValue(java.lang.String value, boolean selected)
public int getIntValue(FormData fd)
java.lang.NumberFormatException
- if the value could not be
returned as in integer.public short getShortValue(FormData fd)
java.lang.NumberFormatException
- if the value could not be
returned as a short.public boolean getBooleanValue(FormData fd)
public void setValueFromSubmit(FormData fd, javax.servlet.http.HttpServletRequest req) throws SubmitHackedException
Field
setValueFromSubmit
in class Field
fd
- the form data object to store the value in
SubmitHackedException
public void renderImpl(FormData fd, java.io.Writer writer) throws java.io.IOException
renderImpl
in class Field
java.io.IOException
public boolean isFilled(FormData fd)
Field
Note: Some fields like selects will never be empty since non-multiple select fields always send their default selected value. [although select/with/multiple can be empty since the browser sends (much like radio buttoms) nothing at all when no option is selected].
isFilled
in class Field
public void setSelected(boolean select)
select
- true if this field should be selected
false otherwise.public java.lang.String toString()
toString
in class Field
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |