com.primix.tapestry.valid
Class IntegerField
java.lang.Object
|
+--com.primix.tapestry.AbstractComponent
|
+--com.primix.tapestry.form.AbstractFormComponent
|
+--com.primix.tapestry.form.AbstractTextField
|
+--com.primix.tapestry.valid.AbstractValidatingTextField
|
+--com.primix.tapestry.valid.IntegerField
- All Implemented Interfaces:
- java.util.EventListener, IComponent, IFormComponent, IRender, IValidatingTextField, PageDetachListener
- public class IntegerField
- extends AbstractValidatingTextField
A Form
component that can be used to
create a text field that validates that the user
has entered an integer value (if required) and that the
value is within a particular range.
When the form is submitted, the result is filtered: If it fails
validation, then no update (through the value binding) is performed. Instead,
an error flag is set. Also, the invalid text is kept so that it can
be the default value for the form element when the page is rendered.
Doesn't work inside a Foreach
... it maintains a little bit
of state (invalid text, error flag)
that will get confused if the component is re-used on the page.
For inputting non-integer types (especially double), use
NumericField
.
Parameter |
Type |
Read / Write |
Required |
Default |
Description |
value |
int |
R / W |
yes |
|
The integer value to be updated. This value will only be
read once per request cycle (don't use an IntegerField inside
a Foreach ).
When the form is submitted, this parameter is only updated if the value
is valid. |
minimum |
int |
R |
no |
|
The minimum value accepted for the field. |
maximum |
int |
R |
no |
|
The maximum value accepted for the field. |
required |
boolean |
R |
no |
false |
If true, then a non-null value must be provided. If the field is not
required, and a null (all whitespace) value is supplied in the field, then the
value parameter is not updated. |
displayName |
String |
R |
yes |
|
A textual name for the field that is used when formulating error messages.
|
delegate |
IValidationDelegate |
R |
yes |
|
Object used to assist in error reporting. |
May not contain a body. May have informal parameters.
- Version:
- $Id: IntegerField.java,v 1.7 2001/09/10 18:25:14 hship Exp $
- Author:
- Howard Ship
Methods inherited from class com.primix.tapestry.valid.AbstractValidatingTextField |
beforeCloseTag, finishLoad, getDelegate, getDelegateBinding, getDisplayName, getDisplayNameBinding, getError, getRequiredBinding, getString, getString, getString, isRequired, notifyDelegate, pageDetached, readValue, refresh, render, setDelegateBinding, setDisplayNameBinding, setError, setRequiredBinding, updateValue |
Methods inherited from class com.primix.tapestry.AbstractComponent |
addAsset, addComponent, addWrapped, cleanupAfterRender, cleanupComponent, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getPage, getSpecification, prepareForRender, renderWrapped, reset, setBinding, setContainer, setId, setPage, setSpecification, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 |
IntegerField
public IntegerField()
getValueBinding
public IBinding getValueBinding()
setValueBinding
public void setValueBinding(IBinding value)
getMinimumBinding
public IBinding getMinimumBinding()
setMinimumBinding
public void setMinimumBinding(IBinding value)
getMaximumBinding
public IBinding getMaximumBinding()
setMaximumBinding
public void setMaximumBinding(IBinding value)
read
protected java.lang.String read()
- Reads the current value of the text parameter.
- Overrides:
read
in class AbstractValidatingTextField
update
protected void update(java.lang.String value)
- Description copied from class:
AbstractValidatingTextField
- Invoked from
AbstractValidatingTextField.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
AbstractValidatingTextField.notifyDelegate(ValidationConstraint, String)
.
If the value is acceptible, then the component should update
through its parameter (this is very component specific).
- Overrides:
update
in class AbstractValidatingTextField