org.apache.tapestry.valid
Class ValidField
java.lang.Object
|
+--org.apache.tapestry.spec.BaseLocatable
|
+--org.apache.tapestry.AbstractComponent
|
+--org.apache.tapestry.form.AbstractFormComponent
|
+--org.apache.tapestry.form.AbstractTextField
|
+--org.apache.tapestry.valid.ValidField
- All Implemented Interfaces:
- IComponent, IFormComponent, ILocatable, ILocationHolder, IRender
- Direct Known Subclasses:
- DateField, NumericField, ValidatingTextField
- public abstract class ValidField
- extends AbstractTextField
- implements IFormComponent
A Form
component that creates a text field that
allows for validation of user input and conversion between string and object
values.
[Component Reference]
A ValidatingTextField uses an IValidationDelegate
to
track errors and an IValidator
to convert between strings and objects
(as well as perform validations). The validation delegate is shared by all validating
text fields in a form, the validator may be shared my multiple elements as desired.
- Version:
- $Id: ValidField.java,v 1.11 2003/09/04 15:53:27 ehatcher Exp $
- Author:
- Howard Lewis Ship
Method Summary |
protected void |
beforeCloseTag(IMarkupWriter writer,
IRequestCycle cycle)
Invokes IValidationDelegate.writeAttributes(IMarkupWriter,IRequestCycle, IFormComponent,IValidator) . |
abstract String |
getDisplayName()
May be implemented to return a user-presentable, localized name for the component,
which is used in labels or error messages. |
abstract IValidator |
getValidator()
|
abstract Object |
getValue()
|
protected String |
readValue()
Invoked by AbstractComponent.render(IMarkupWriter writer, IRequestCycle cycle)
when rendering a response. |
protected void |
renderComponent(IMarkupWriter writer,
IRequestCycle cycle)
Renders the component, which involves the delegate . |
abstract void |
setValue(Object value)
|
protected void |
updateValue(String value)
Invoked by AbstractComponent.render(IMarkupWriter writer, IRequestCycle cycle)
when a value is obtained from the
HttpServletRequest . |
Methods inherited from class org.apache.tapestry.AbstractComponent |
addAsset, addBody, addComponent, cleanupAfterRender, finishLoad, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, format, format, format, format, formatString, formatString, formatString, formatString, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification, toString |
Methods inherited from interface org.apache.tapestry.IComponent |
addAsset, addBody, addComponent, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, renderBody, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification |
Methods inherited from interface org.apache.tapestry.IRender |
render |
ValidField
public ValidField()
getValue
public abstract Object getValue()
setValue
public abstract void setValue(Object value)
getDisplayName
public abstract String getDisplayName()
- Description copied from interface:
IFormComponent
- May be implemented to return a user-presentable, localized name for the component,
which is used in labels or error messages. Most components simply return null.
- Specified by:
getDisplayName
in interface IFormComponent
- Overrides:
getDisplayName
in class AbstractFormComponent
renderComponent
protected void renderComponent(IMarkupWriter writer,
IRequestCycle cycle)
- Renders the component, which involves the
delegate
.
During a render, the first field rendered that is either
in error, or required but null gets special treatment. JavaScript is added
to select that field (such that the cursor jumps right to the field when the
page loads).
- Overrides:
renderComponent
in class AbstractTextField
beforeCloseTag
protected void beforeCloseTag(IMarkupWriter writer,
IRequestCycle cycle)
- Invokes
IValidationDelegate.writeAttributes(IMarkupWriter,IRequestCycle, IFormComponent,IValidator)
.
- Overrides:
beforeCloseTag
in class AbstractTextField
readValue
protected String readValue()
- Description copied from class:
AbstractTextField
- Invoked by
AbstractComponent.render(IMarkupWriter writer, IRequestCycle cycle)
when rendering a response.
- Overrides:
readValue
in class AbstractTextField
- Following copied from class:
org.apache.tapestry.form.AbstractTextField
- Returns:
- the current value for the field, as a String, or null.
updateValue
protected void updateValue(String value)
- Description copied from class:
AbstractTextField
- Invoked by
AbstractComponent.render(IMarkupWriter writer, IRequestCycle cycle)
when a value is obtained from the
HttpServletRequest
.
- Overrides:
updateValue
in class AbstractTextField
getValidator
public abstract IValidator getValidator()