com.primix.tapestry.valid
Class DateField

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.DateField
All Implemented Interfaces:
java.util.EventListener, IComponent, IFormComponent, IRender, IValidatingTextField, PageDetachListener

public class DateField
extends AbstractValidatingTextField

Implements a special text field used for enterring dates.
Parameter Type Read / Write Required Default Description
date java.util.Date R / W yes   The date property to edit.
required boolean R no no If true, then a value must be entered.
minimum java.util.Date R no   If provided, the date entered must be equal to or later than the provided minimum date.
maximum java.util.Date R no   If provided, the date entered must be less than or equal to the provided maximum date.
displayName String R yes   A textual name for the field that is used when formulating error messages.
format DateFormat R no Default format MM/dd/yyyy The format used to display and parse dates.
delegate IValidationDelegate R yes   Object used to assist in error reporting.

Informal parameters are allowed, but are applied to the underlying TextField. A body is not allowed.

As of release 0.2.10, it is possible to set the format used for displaying and enterring dates. However, you still can't enter a date prior to year 1000 or use a non-gregorian calendar. Still, this is sufficient for most purposes.

Version:
$Id: DateField.java,v 1.8 2001/08/28 20:33:42 hship Exp $
Author:
Howard Ship

Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Constructor Summary
DateField()
           
 
Method Summary
 IBinding getDateBinding()
           
 java.text.DateFormat getFormat()
          Returns the DateFormat used to render and parse dates.
 IBinding getFormatBinding()
           
 IBinding getMaximumBinding()
           
 IBinding getMinimumBinding()
           
 void pageDetached(PageEvent event)
          Clears the format property, then invokes the super implementation.
protected  java.lang.String read()
          Invoked by AbstractValidatingTextField.readValue() to read the underlying data value (in a way specific to the subclass implementation) and convert it to a String.
 void setDateBinding(IBinding value)
           
 void setFormatBinding(IBinding value)
           
 void setMaximumBinding(IBinding value)
           
 void setMinimumBinding(IBinding value)
           
protected  void update(java.lang.String value)
          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.
 
Methods inherited from class com.primix.tapestry.valid.AbstractValidatingTextField
beforeCloseTag, finishLoad, getDelegate, getDelegateBinding, getDisplayName, getDisplayNameBinding, getError, getRequiredBinding, getString, getString, getString, isRequired, notifyDelegate, readValue, refresh, render, setDelegateBinding, setDisplayNameBinding, setError, setRequiredBinding, updateValue
 
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 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.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

DateField

public DateField()
Method Detail

getDateBinding

public IBinding getDateBinding()

setDateBinding

public void setDateBinding(IBinding value)

getMinimumBinding

public IBinding getMinimumBinding()

setMinimumBinding

public void setMinimumBinding(IBinding value)

getMaximumBinding

public IBinding getMaximumBinding()

setMaximumBinding

public void setMaximumBinding(IBinding value)

setFormatBinding

public void setFormatBinding(IBinding value)

getFormatBinding

public IBinding getFormatBinding()

read

protected java.lang.String read()
Description copied from class: AbstractValidatingTextField
Invoked by AbstractValidatingTextField.readValue() to read the underlying data value (in a way specific to the subclass implementation) and convert it to a String.
Overrides:
read in class AbstractValidatingTextField

getFormat

public java.text.DateFormat getFormat()
Returns the DateFormat used to render and parse dates. The format parameter, if non null, is read. If the format parameter is not bound (or returns null), then a default format MM/dd/yyyy (with lenient set to false) is returned.

Once determined, the format is cached for the remainder of the request cycle (until pageDetached(PageEvent) is invoked).


pageDetached

public void pageDetached(PageEvent event)
Clears the format property, then invokes the super implementation.
Overrides:
pageDetached in class AbstractValidatingTextField
Since:
1.0.5

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