public class NumberTranslator extends FormatTranslator
DecimalFormat-based Translator implementation.| Constructor and Description |
|---|
NumberTranslator() |
NumberTranslator(java.lang.String initializer) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
defaultPattern() |
protected java.lang.String |
defaultScript()
Defines the default JavaScript file used by this contributor.
|
protected java.lang.String |
formatObject(IFormComponent field,
java.util.Locale locale,
java.lang.Object object) |
protected ValidationConstraint |
getConstraint() |
java.text.DecimalFormat |
getDecimalFormat(java.util.Locale locale) |
protected java.text.Format |
getFormat(java.util.Locale locale) |
protected java.lang.String |
getMessageKey() |
protected java.lang.Object[] |
getMessageParameters(java.util.Locale locale,
java.lang.String label) |
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 |
setOmitZero(boolean omitZero)
If true (which is the default for the property), then values that are 0 are rendered to an
empty string, not "0" or "0.00".
|
getPattern, parseText, setPatternbuildMessage, format, getMessage, getValueForEmptyInput, isTrim, parse, setMessage, setTrimgetScript, setScriptpublic NumberTranslator()
public NumberTranslator(java.lang.String initializer)
protected java.lang.String formatObject(IFormComponent field, java.util.Locale locale, java.lang.Object object)
protected java.lang.String defaultScript()
AbstractFormComponentContributordefaultScript in class AbstractFormComponentContributorAbstractFormComponentContributor.defaultScript()protected java.lang.String defaultPattern()
defaultPattern in class FormatTranslatorFormatTranslator.defaultPattern()protected java.text.Format getFormat(java.util.Locale locale)
getFormat in class FormatTranslatorFormatTranslator.getFormat(java.util.Locale)public java.text.DecimalFormat getDecimalFormat(java.util.Locale locale)
protected java.lang.String getMessageKey()
getMessageKey in class FormatTranslatorFormatTranslator.getMessageKey()protected java.lang.Object[] getMessageParameters(java.util.Locale locale, java.lang.String label)
getMessageParameters in class AbstractTranslatorAbstractTranslator.getMessageParameters(java.util.Locale,
java.lang.String)public void renderContribution(IMarkupWriter writer, IRequestCycle cycle, FormComponentContributorContext context, IFormComponent field)
FormComponentContributorrenderContribution in interface FormComponentContributorrenderContribution in class AbstractTranslatorwriter - allows contributor to write additional attributes into the component's tagcycle - for accessing request informationcontext - utilities for genering messages and client-side validationfield - the field for which contributions are being renderedFormComponentContributor.renderContribution(org.apache.tapestry.IMarkupWriter,
org.apache.tapestry.IRequestCycle, FormComponentContributorContext,
org.apache.tapestry.form.IFormComponent)protected ValidationConstraint getConstraint()
getConstraint in class FormatTranslatorFormatTranslator.getConstraint()public void setOmitZero(boolean omitZero)