net.sf.tacos.form.translator
Class AbstractTranslator<T>

java.lang.Object
  extended by org.apache.tapestry.form.AbstractFormComponentContributor
      extended by net.sf.tacos.form.translator.AbstractTranslator<T>
All Implemented Interfaces:
org.apache.tapestry.form.FormComponentContributor, org.apache.tapestry.form.translator.Translator

public abstract class AbstractTranslator<T>
extends org.apache.tapestry.form.AbstractFormComponentContributor
implements org.apache.tapestry.form.translator.Translator

The generics version of Tapestry's AbstractTranslator.


Constructor Summary
AbstractTranslator()
           
AbstractTranslator(String initializer)
           
 
Method Summary
protected  String buildMessage(org.apache.tapestry.form.ValidationMessages messages, org.apache.tapestry.form.IFormComponent field, String key)
           
 String format(org.apache.tapestry.form.IFormComponent field, Locale locale, Object object)
           
protected abstract  String formatObject(org.apache.tapestry.form.IFormComponent field, Locale locale, T object)
           
 String getMessage()
           
protected  Object[] getMessageParameters(Locale locale, String label)
           
protected  Object getValueForEmptyInput()
          The value to be used when the value supplied in the request is blank (null or empty).
 boolean isTrim()
           
 Object parse(org.apache.tapestry.form.IFormComponent field, org.apache.tapestry.form.ValidationMessages messages, String text)
           
protected abstract  T parseText(org.apache.tapestry.form.IFormComponent field, org.apache.tapestry.form.ValidationMessages messages, String text)
           
 void renderContribution(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.form.FormComponentContributorContext context, org.apache.tapestry.form.IFormComponent field)
           
 void setMessage(String message)
           
 void setTrim(boolean trim)
           
 
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

AbstractTranslator

public AbstractTranslator()

AbstractTranslator

public AbstractTranslator(String initializer)
Method Detail

format

public String format(org.apache.tapestry.form.IFormComponent field,
                     Locale locale,
                     Object object)
Specified by:
format in interface org.apache.tapestry.form.translator.Translator
See Also:
Translator.format(org.apache.tapestry.form.IFormComponent, Locale, java.lang.Object)

parse

public Object parse(org.apache.tapestry.form.IFormComponent field,
                    org.apache.tapestry.form.ValidationMessages messages,
                    String text)
             throws org.apache.tapestry.valid.ValidatorException
Specified by:
parse in interface org.apache.tapestry.form.translator.Translator
Throws:
org.apache.tapestry.valid.ValidatorException
See Also:
Translator.parse(org.apache.tapestry.form.IFormComponent, ValidationMessages, java.lang.String)

formatObject

protected abstract String formatObject(org.apache.tapestry.form.IFormComponent field,
                                       Locale locale,
                                       T object)

parseText

protected abstract T parseText(org.apache.tapestry.form.IFormComponent field,
                               org.apache.tapestry.form.ValidationMessages messages,
                               String text)
                        throws org.apache.tapestry.valid.ValidatorException
Throws:
org.apache.tapestry.valid.ValidatorException

getValueForEmptyInput

protected Object getValueForEmptyInput()
The value to be used when the value supplied in the request is blank (null or empty). The default value is null, but some subclasses may override.

Returns:
null, subclasses may override
See Also:
parse(IFormComponent, ValidationMessages, String)

buildMessage

protected String buildMessage(org.apache.tapestry.form.ValidationMessages messages,
                              org.apache.tapestry.form.IFormComponent field,
                              String key)

getMessageParameters

protected Object[] getMessageParameters(Locale locale,
                                        String label)

renderContribution

public void renderContribution(org.apache.tapestry.IMarkupWriter writer,
                               org.apache.tapestry.IRequestCycle cycle,
                               org.apache.tapestry.form.FormComponentContributorContext context,
                               org.apache.tapestry.form.IFormComponent field)
Specified by:
renderContribution in interface org.apache.tapestry.form.FormComponentContributor
Overrides:
renderContribution in class org.apache.tapestry.form.AbstractFormComponentContributor
See Also:
FormComponentContributor.renderContribution(org.apache.tapestry.IMarkupWriter , org.apache.tapestry.IRequestCycle , org.apache.tapestry.form.FormComponentContributorContext , IFormComponent)

isTrim

public boolean isTrim()

setTrim

public void setTrim(boolean trim)

getMessage

public String getMessage()

setMessage

public void setMessage(String message)


Copyright © 2005-2008 SourceForge.net. All Rights Reserved.