|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectwicket.Component
wicket.MarkupContainer
wicket.markup.html.WebMarkupContainer
wicket.markup.html.form.FormComponent
An html form component knows how to validate itself. Validators that implement IValidator can be added to the component. They will be evaluated in the order they were added and the first Validator that returns an error message determines the error message returned by the component.
FormComponents are not versioned by default. If you need versioning for your FormComponents, you will need to call Form.setVersioned(true), which will set versioning on for the form and all form component children.
| Nested Class Summary | |
static interface |
FormComponent.IVisitor
Typesafe interface to code that is called when visiting a form component |
| Nested classes inherited from class wicket.Component |
Component.ComponentModelChange, Component.VisibilityChange |
| Field Summary | |
protected static short |
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL
Make empty strings null values boolean |
protected static java.lang.String |
NO_INVALID_INPUT
Special flag value to indicate when there is no invalid input, since null is a valid value! |
| Fields inherited from class wicket.Component |
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4 |
| Constructor Summary | |
FormComponent(java.lang.String id)
|
|
FormComponent(java.lang.String id,
IModel model)
|
|
| Method Summary | |
FormComponent |
add(IValidator validator)
Adds a validator to this form component. |
Form |
getForm()
|
java.lang.String |
getInput()
Gets the request parameter for this component as a string. |
protected java.lang.String |
getModelValue()
|
java.lang.Class |
getValidationType()
Gets the type for any TypeValidator assigned to this component. |
java.util.List |
getValidators()
Gets the registered validators as a list. |
java.lang.String |
getValue()
Gets current value for a form component. |
protected int |
inputAsInt()
Gets the request parameter for this component as an int. |
protected int |
inputAsInt(int defaultValue)
Gets the request parameter for this component as an int, using the given default in case no corresponding request parameter was found. |
protected int[] |
inputAsIntArray()
Gets the request parameters for this component as ints. |
protected java.lang.String[] |
inputAsStringArray()
Gets the request parameters for this component as strings. |
void |
invalid()
Called to indicate that |
boolean |
isPersistent()
|
boolean |
isValid()
Gets whether this component is 'valid'. |
boolean |
isValidated()
Gets whether this component is to be validated. |
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag. |
protected void |
onInvalid()
Handle invalidation by storing the user input for form repopulation |
protected void |
onModelChanged()
Called anytime a model is changed after the change has occurred |
protected void |
onValid()
Handle validation |
void |
setModelValue(java.lang.String value)
Sets the value for a form component. |
void |
setPersistent(boolean persistent)
Sets whether this component is to be persisted. |
protected boolean |
supportsPersistence()
|
protected abstract void |
updateModel()
Implemented by form component subclass to update the form component's model. |
void |
valid()
Called to indicate that |
protected void |
validate()
Validates this component using the component's validator. |
| Methods inherited from class wicket.markup.html.WebMarkupContainer |
getMarkupType, onRender |
| Methods inherited from class wicket.MarkupContainer |
add, autoAdd, contains, findMarkupStream, get, getMarkupStream, internalAdd, internalBeginRequest, internalEndRequest, iterator, onComponentTagBody, remove, removeAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final java.lang.String NO_INVALID_INPUT
protected static final short FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL
| Constructor Detail |
public FormComponent(java.lang.String id)
Component.Component(String)
public FormComponent(java.lang.String id,
IModel model)
Component.Component(String, IModel)| Method Detail |
public final FormComponent add(IValidator validator)
validator - The validator
public final Form getForm()
public final java.lang.String getInput()
public final java.lang.Class getValidationType()
public final java.util.List getValidators()
public final java.lang.String getValue()
public final void invalid()
public final boolean isPersistent()
public final boolean isValid()
public final boolean isValidated()
public void setModelValue(java.lang.String value)
value - The valuepublic final void setPersistent(boolean persistent)
persistent - True if this component is to be persisted.public final void valid()
protected java.lang.String getModelValue()
protected final int inputAsInt()
protected final int inputAsInt(int defaultValue)
defaultValue - Default value to return if request does not have an integer
for this component
protected final int[] inputAsIntArray()
protected final java.lang.String[] inputAsStringArray()
protected void onComponentTag(ComponentTag tag)
onComponentTag in class Componenttag - Tag to modifyComponent.onComponentTag(ComponentTag)protected void onInvalid()
protected void onModelChanged()
Component
onModelChanged in class ComponentComponent.onModelChanged()protected void onValid()
protected boolean supportsPersistence()
protected abstract void updateModel()
protected final void validate()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||