org.apache.tapestry.form.translator
Class DateTranslator

java.lang.Object
  extended by org.apache.tapestry.form.AbstractFormComponentContributor
      extended by org.apache.tapestry.form.translator.AbstractTranslator
          extended by org.apache.tapestry.form.translator.FormatTranslator
              extended by org.apache.tapestry.form.translator.DateTranslator
All Implemented Interfaces:
FormComponentContributor, Translator

public class DateTranslator
extends FormatTranslator

A SimpleDateFormat-based Translator implementation.

Since:
4.0
Author:
Paul Ferraro

Field Summary
protected  SimpleDateFormat _rfc339Format
           
 
Constructor Summary
DateTranslator()
           
DateTranslator(String initializer)
           
 
Method Summary
protected  String defaultPattern()
           
 String formatRfc3339(Object input)
          Get the RFC339 equivalent for the given object.
protected  ValidationConstraint getConstraint()
           
 SimpleDateFormat getDateFormat(Locale locale)
           
protected  Format getFormat(Locale locale)
           
protected  String getMessageKey()
           
protected  Object[] getMessageParameters(Locale locale, String label)
           
 boolean isLenient()
           
 void renderContribution(IMarkupWriter writer, IRequestCycle cycle, FormComponentContributorContext context, IFormComponent field)
          Invoked by a form component after it finishes rendering its tag (but before the tag is closed) to allow this object to contribute to the component's rendering process.
 void setLenient(boolean value)
           
 
Methods inherited from class org.apache.tapestry.form.translator.FormatTranslator
formatObject, getPattern, getPattern, parseText, setPattern
 
Methods inherited from class org.apache.tapestry.form.translator.AbstractTranslator
buildMessage, format, getMessage, getValueForEmptyInput, isTrim, parse, setMessage, setTrim
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponentContributor
accumulateProfileProperty, accumulateProperty, defaultScript, getScript, setScript
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rfc339Format

protected SimpleDateFormat _rfc339Format
Constructor Detail

DateTranslator

public DateTranslator()

DateTranslator

public DateTranslator(String initializer)
Method Detail

defaultPattern

protected String defaultPattern()
Specified by:
defaultPattern in class FormatTranslator
See Also:
FormatTranslator.defaultPattern()

getFormat

protected Format getFormat(Locale locale)
Specified by:
getFormat in class FormatTranslator
See Also:
FormatTranslator.getFormat(java.util.Locale)

formatRfc3339

public String formatRfc3339(Object input)
Get the RFC339 equivalent for the given object.

Parameters:
input - The object to be formatted.
Returns:
A string value compliant with rfc339 internet time.

getDateFormat

public SimpleDateFormat getDateFormat(Locale locale)

getMessageKey

protected String getMessageKey()
Specified by:
getMessageKey in class FormatTranslator
See Also:
FormatTranslator.getMessageKey()

getMessageParameters

protected Object[] getMessageParameters(Locale locale,
                                        String label)
Overrides:
getMessageParameters in class AbstractTranslator
See Also:
AbstractTranslator.getMessageParameters(java.util.Locale, java.lang.String)

renderContribution

public void renderContribution(IMarkupWriter writer,
                               IRequestCycle cycle,
                               FormComponentContributorContext context,
                               IFormComponent field)
Invoked by a form component after it finishes rendering its tag (but before the tag is closed) to allow this object to contribute to the component's rendering process. Typically used by Validators and Translators to add javascript methods to the form's submit event handler.

Specified by:
renderContribution in interface FormComponentContributor
Overrides:
renderContribution in class AbstractTranslator
Parameters:
writer - allows contributor to write additional attributes into the component's tag
cycle - for accessing request information
context - utilities for genering messages and client-side validation
field - the field for which contributions are being rendered
See Also:
FormComponentContributor.renderContribution(IMarkupWriter, IRequestCycle, FormComponentContributorContext, IFormComponent)

getConstraint

protected ValidationConstraint getConstraint()
Specified by:
getConstraint in class FormatTranslator
See Also:
FormatTranslator.getConstraint()

setLenient

public void setLenient(boolean value)

isLenient

public boolean isLenient()


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.