org.equanda.tapestry5.translators
Class DoubleTranslator
java.lang.Object
org.equanda.tapestry5.translators.DoubleTranslator
- All Implemented Interfaces:
- org.apache.tapestry5.FieldTranslator<Double>, org.apache.tapestry5.Translator<Double>
public class DoubleTranslator
- extends Object
- implements org.apache.tapestry5.Translator<Double>, org.apache.tapestry5.FieldTranslator<Double>
Tapestry translator for double values, assures both point or comma can be used as decimal separator.
- Author:
- Joachim Van der Auwera
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DoubleTranslator
public DoubleTranslator()
parseClient
public Double parseClient(org.apache.tapestry5.Field field,
String clientValue,
String message)
throws org.apache.tapestry5.ValidationException
- Parses blank values to null, otherwise parses the client value to a double
- Specified by:
parseClient
in interface org.apache.tapestry5.Translator<Double>
- Throws:
org.apache.tapestry5.ValidationException
- if the clientValue can not be parsed
toClient
public String toClient(Double value)
- Converts null to the blank string, non-null to a string representation.
- Specified by:
toClient
in interface org.apache.tapestry5.FieldTranslator<Double>
- Specified by:
toClient
in interface org.apache.tapestry5.Translator<Double>
getType
public Class<Double> getType()
- Specified by:
getType
in interface org.apache.tapestry5.FieldTranslator<Double>
- Specified by:
getType
in interface org.apache.tapestry5.Translator<Double>
getName
public String getName()
- Specified by:
getName
in interface org.apache.tapestry5.Translator<Double>
getMessageKey
public String getMessageKey()
- Specified by:
getMessageKey
in interface org.apache.tapestry5.Translator<Double>
render
public void render(org.apache.tapestry5.Field field,
String message,
org.apache.tapestry5.MarkupWriter markupWriter,
org.apache.tapestry5.services.FormSupport formSupport)
- Specified by:
render
in interface org.apache.tapestry5.Translator<Double>
parse
public Double parse(String clientValue)
throws org.apache.tapestry5.ValidationException
- Specified by:
parse
in interface org.apache.tapestry5.FieldTranslator<Double>
- Throws:
org.apache.tapestry5.ValidationException
render
public void render(org.apache.tapestry5.MarkupWriter markupWriter)
- Specified by:
render
in interface org.apache.tapestry5.FieldTranslator<Double>
Copyright © 2007-2009. All Rights Reserved.