org.apache.tapestry.form.translator
Class FormatTranslator

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
All Implemented Interfaces:
FormComponentContributor, Translator
Direct Known Subclasses:
DateTranslator, NumberTranslator

public abstract class FormatTranslator
extends AbstractTranslator

Abstract Translator implementation for Format-based translators.

Since:
4.0
Author:
Paul Ferraro

Constructor Summary
FormatTranslator()
           
FormatTranslator(String initializer)
           
 
Method Summary
protected abstract  String defaultPattern()
           
protected  String formatObject(IFormComponent field, Locale locale, Object object)
           
protected abstract  ValidationConstraint getConstraint()
           
protected abstract  Format getFormat(Locale locale)
           
protected abstract  String getMessageKey()
           
 String getPattern()
           
 String getPattern(Locale locale)
          Gets the pattern encapsulated by this translator, subclasses may optionally use the passed in Locale to return patterns specific to that locale.
protected  Object parseText(IFormComponent field, ValidationMessages messages, String text)
           
 void setPattern(String pattern)
           
 
Methods inherited from class org.apache.tapestry.form.translator.AbstractTranslator
buildMessage, format, getMessage, getMessageParameters, getValueForEmptyInput, isTrim, parse, renderContribution, 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
 

Constructor Detail

FormatTranslator

public FormatTranslator()

FormatTranslator

public FormatTranslator(String initializer)
Method Detail

defaultPattern

protected abstract String defaultPattern()

formatObject

protected String formatObject(IFormComponent field,
                              Locale locale,
                              Object object)
Specified by:
formatObject in class AbstractTranslator
See Also:
AbstractTranslator.formatObject(org.apache.tapestry.form.IFormComponent, Locale, java.lang.Object)

parseText

protected Object parseText(IFormComponent field,
                           ValidationMessages messages,
                           String text)
                    throws ValidatorException
Specified by:
parseText in class AbstractTranslator
Throws:
ValidatorException
See Also:
AbstractTranslator.parseText(org.apache.tapestry.form.IFormComponent, ValidationMessages, java.lang.String)

getConstraint

protected abstract ValidationConstraint getConstraint()

getFormat

protected abstract Format getFormat(Locale locale)

getMessageKey

protected abstract String getMessageKey()

getPattern

public String getPattern()

setPattern

public void setPattern(String pattern)

getPattern

public String getPattern(Locale locale)
Gets the pattern encapsulated by this translator, subclasses may optionally use the passed in Locale to return patterns specific to that locale.

Parameters:
locale - The locale to use to format the pattern, if applicable.
Returns:
The pattern used to format/parse objects.


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