|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.primix.tapestry.AbstractComponent | +--com.primix.tapestry.form.AbstractFormComponent | +--com.primix.tapestry.form.AbstractTextField | +--com.primix.tapestry.valid.AbstractValidatingTextField
Base class for several classes that validate their input from the user.
All subclasses share the following features:
delegate
Foreach
component
Fields inherited from class com.primix.tapestry.AbstractComponent |
id, page, specification, wrapped, wrappedCount |
Constructor Summary | |
AbstractValidatingTextField()
|
Method Summary | |
protected void |
beforeCloseTag(IResponseWriter writer,
IRequestCycle cycle)
Invokes IValidationDelegate.writeAttributes(IValidatingTextField,IResponseWriter,IRequestCycle) . |
protected void |
finishLoad()
Registers this component as a PageDetachListener . |
IValidationDelegate |
getDelegate()
Returns the component's delegate, or throws RequiredParameterException . |
IBinding |
getDelegateBinding()
|
java.lang.String |
getDisplayName()
Returns the display name for the component, suitable for display to a user. |
IBinding |
getDisplayNameBinding()
|
boolean |
getError()
Returns true if there was a validation error. |
IBinding |
getRequiredBinding()
|
protected java.lang.String |
getString(java.lang.String key,
java.lang.Object argument)
|
protected java.lang.String |
getString(java.lang.String key,
java.lang.Object[] arguments)
Gets and formats a localized string from the com.primix.tapestry.valid.ValidationStrings
property bundle. |
protected java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
|
boolean |
isRequired()
Returns the value of the required parameter, or false if the parameter is not bound. |
protected void |
notifyDelegate(ValidationConstraint constraint,
java.lang.String defaultErrorMessage)
Invoked (from update(String) , usually} to indicate an error
converting from the submitted text value to the appropriate
data value. |
void |
pageDetached(PageEvent event)
Clear the error, text and delegate properties at the end of request cycle. |
protected abstract java.lang.String |
read()
Invoked by readValue() to read the underlying data value
(in a way specific to the subclass implementation) and convert it to
a String. |
protected java.lang.String |
readValue()
Invoked by render(IResponseWriter writer, IRequestCycle cycle)
when rendering a response. |
void |
refresh()
Forces the component to re-read through its text binding. |
void |
render(IResponseWriter writer,
IRequestCycle cycle)
Renders the component, which involves the delegate . |
void |
setDelegateBinding(IBinding value)
|
void |
setDisplayNameBinding(IBinding value)
|
void |
setError(boolean value)
Allows the error state to be set externally. |
void |
setRequiredBinding(IBinding value)
|
protected abstract void |
update(java.lang.String value)
Invoked from updateValue(String) to validate that the new value
(submitted in the form by the user) conforms to the rules for
this component. |
protected void |
updateValue(java.lang.String value)
Invoked by render(IResponseWriter writer, IRequestCycle cycle)
when a value is obtained from the
HttpServletRequest . |
Methods inherited from class com.primix.tapestry.form.AbstractTextField |
getDisabledBinding, getDisplayWidthBinding, getHiddenBinding, getMaximumLengthBinding, getName, setDisabledBinding, setDisplayWidthBinding, setHiddenBinding, setMaximumLengthBinding |
Methods inherited from class com.primix.tapestry.form.AbstractFormComponent |
getForm, getForm |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.primix.tapestry.valid.IValidatingTextField |
getName |
Methods inherited from interface com.primix.tapestry.IComponent |
addAsset, addComponent, addWrapped, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getPage, getSpecification, renderWrapped, setBinding, setContainer, setId, setPage, setSpecification |
Methods inherited from interface com.primix.tapestry.form.IFormComponent |
getForm, getName |
Constructor Detail |
public AbstractValidatingTextField()
Method Detail |
protected void finishLoad()
PageDetachListener
.finishLoad
in class AbstractComponent
protected java.lang.String getString(java.lang.String key, java.lang.Object[] arguments)
com.primix.tapestry.valid.ValidationStrings
property bundle.protected java.lang.String getString(java.lang.String key, java.lang.Object argument)
protected java.lang.String getString(java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)
public IBinding getDisplayNameBinding()
public void setDisplayNameBinding(IBinding value)
public java.lang.String getDisplayName()
IValidatingTextField
getDisplayName
in interface IValidatingTextField
public IBinding getDelegateBinding()
public void setDelegateBinding(IBinding value)
public IValidationDelegate getDelegate()
RequiredParameterException
.protected java.lang.String readValue()
AbstractTextField
AbstractTextField.render(IResponseWriter writer, IRequestCycle cycle)
when rendering a response.readValue
in class AbstractTextField
protected abstract java.lang.String read()
readValue()
to read the underlying data value
(in a way specific to the subclass implementation) and convert it to
a String.protected void updateValue(java.lang.String value)
AbstractTextField
AbstractTextField.render(IResponseWriter writer, IRequestCycle cycle)
when a value is obtained from the
HttpServletRequest
.updateValue
in class AbstractTextField
protected abstract void update(java.lang.String value)
updateValue(String)
to validate that the new value
(submitted in the form by the user) conforms to the rules for
this component. If not, it should invoke
notifyDelegate(ValidationConstraint, String)
.
If the value is acceptible, then the component should update through its parameter (this is very component specific).
protected void notifyDelegate(ValidationConstraint constraint, java.lang.String defaultErrorMessage)
update(String)
, usually} to indicate an error
converting from the submitted text value to the appropriate
data value.
Sets the error flag to true, then invokes
IValidationDelegate.invalidField(IValidatingTextField, ValidationConstraint, String)
to tell the listener that there was an error.
public boolean getError()
getError
in interface IValidatingTextField
public void setError(boolean value)
DateField
s that specify a range).setError
in interface IValidatingTextField
public void pageDetached(PageEvent event)
pageDetached
in interface PageDetachListener
public void refresh()
refresh
in interface IValidatingTextField
public void render(IResponseWriter writer, IRequestCycle cycle) throws RequestCycleException
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).
render
in interface IRender
render
in class AbstractTextField
protected void beforeCloseTag(IResponseWriter writer, IRequestCycle cycle) throws RequestCycleException
IValidationDelegate.writeAttributes(IValidatingTextField,IResponseWriter,IRequestCycle)
.beforeCloseTag
in class AbstractTextField
public IBinding getRequiredBinding()
public void setRequiredBinding(IBinding value)
public boolean isRequired()
isRequired
in interface IValidatingTextField
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |