|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wheel.components.Component wheel.components.RenderableComponent wheel.components.FormElement
public abstract class FormElement
All components that want to handle form input should extend from this class.
Defines a set of operations like validation and binding.
Binding fields to FormElements:
Binding is done with MVEL-expressions.
The only rule is that the target of the binding must be available in the complex component using javabean get/set-methods.
Example:
public class MyComponent extends StandaloneComponent { private Calendar cal; public Calendar getCal() { return cal; } public void setCal(Calendar cal) { this.cal = cal; } }In the above example, the containing complex component has a field declaration like this:
private ListNote that when using Lists and Maps, they need to be initialized, ie. they can't be empty. Limitations:numbers;
Field Summary | |
---|---|
protected java.lang.String |
genericFieldErrorMessage
|
protected java.lang.String[] |
value
|
Constructor Summary | |
---|---|
protected |
FormElement(Component parent,
java.lang.String formElementName)
|
Method Summary | |
---|---|
void |
_clear()
Inteded for internal use. |
java.lang.String |
_getSubmitValue()
Returns the value recieved in form submit. |
java.lang.String[] |
_getSubmitValues()
Returns the value recieved in form submit. |
void |
_render(org.xmlpull.v1.XmlSerializer serializer)
Default implementation. |
void |
_setSubmitValue(java.lang.String[] value)
Sets the value retrieved from a form submit for this element. |
FormElement |
addValidationError(java.lang.String message)
|
protected java.lang.String |
defaultDomEvent()
|
FormElement |
fieldBinding(java.lang.String binding)
|
java.lang.CharSequence |
getBinding()
Returns the binding for this form element. |
java.util.List<ValidationError> |
getErrors()
Returns all validation errors for this form element. |
java.lang.String |
getFormElementName()
|
FormElement |
initialFieldValue(java.lang.String value)
|
FormElement |
initialFieldValue(java.lang.String value,
java.lang.Object emptyValue)
|
boolean |
isEmpty()
Returns true if no value has been set due to a form submit to this element yet. |
FormElement |
isInt()
A shorthand method to mark this form element as an integer. |
boolean |
isValid()
Returns true if this form element is valid. |
FormElement |
label(java.lang.String label)
Adds a label to this form element. |
FormElement |
required()
A shorthand method to mark this form element as required. |
FormElement |
setBinding(java.lang.CharSequence binding)
|
FormElement |
setFormElementName(java.lang.String name)
|
void |
validate()
Causes this element to validate itself against given input value. |
FormElement |
validationRule(java.lang.String elExpression)
|
FormElement |
validationRule(java.lang.String elExpression,
java.lang.String message)
Adds a validation rule to this form element. |
FormElement |
value(java.lang.String value)
|
Methods inherited from class wheel.components.RenderableComponent |
---|
_classReferenceFromHints, _getRenderAfterMe, _getRenderBeforeMe, _renderActions, _renderClassReferenceFromHints, _renderTagStart, _renderXhtmlAttributes, addRenderAfter, addRenderBefore, config, defaultTagName, getTagName, renderComponent, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String[] value
protected java.lang.String genericFieldErrorMessage
Constructor Detail |
---|
protected FormElement(Component parent, java.lang.String formElementName)
Method Detail |
---|
public FormElement validationRule(java.lang.String elExpression, java.lang.String message)
elExpression
- A valid MVEL-expressionmessage
- The message to put in the ValidationError object if the validation fails. Can be an el-expression or a localized message.
Validations for currently avaiable validation methods.
public FormElement validationRule(java.lang.String elExpression)
public java.lang.CharSequence getBinding()
public FormElement setBinding(java.lang.CharSequence binding)
public boolean isEmpty()
public void validate()
public void _setSubmitValue(java.lang.String[] value)
value
- public FormElement label(java.lang.String label)
label
- The text to render inside the label-tag.
public java.util.List<ValidationError> getErrors()
public boolean isValid()
public java.lang.String[] _getSubmitValues()
public java.lang.String _getSubmitValue()
public void _clear()
Component
_clear
in class RenderableComponent
public FormElement required()
public FormElement isInt()
protected java.lang.String defaultDomEvent()
defaultDomEvent
in class RenderableComponent
public FormElement setFormElementName(java.lang.String name)
public java.lang.String getFormElementName()
public void _render(org.xmlpull.v1.XmlSerializer serializer) throws java.io.IOException
RenderableComponent
_render
in class RenderableComponent
java.io.IOException
public FormElement fieldBinding(java.lang.String binding)
public FormElement value(java.lang.String value)
public FormElement initialFieldValue(java.lang.String value)
public FormElement initialFieldValue(java.lang.String value, java.lang.Object emptyValue)
public FormElement addValidationError(java.lang.String message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |