Field.Type
Modifier and Type | Method and Description |
---|---|
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 . |
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,
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,
String value)
Sets the selected or non-selected state for this choice in the
specified form data.
|
void |
setValue(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.
|
String |
toString() |
add, addError, addLabel, addString, disable, disable, enable, enable, getLabel, getName, getValidateErrors, isEnabled, render, render, render, renderError, renderError, renderStyleTag, setStyleTag, validate
public abstract Field.Type getType()
Field
Field.Type
. This type
is rendered as part of <input type= ...public 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, 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 int getIntValue(FormData fd)
NumberFormatException
- if the value could not be
returned as in integer.public short getShortValue(FormData fd)
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 inSubmitHackedException
public void renderImpl(FormData fd, Writer writer) throws IOException
renderImpl
in class Field
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].
public void setSelected(boolean select)
select
- true if this field should be selected
false otherwise.