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, setPattern
buildMessage, format, getMessage, getValueForEmptyInput, isTrim, parse, setMessage, setTrim
getScript, setScript
public 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()
AbstractFormComponentContributor
defaultScript
in class AbstractFormComponentContributor
AbstractFormComponentContributor.defaultScript()
protected java.lang.String defaultPattern()
defaultPattern
in class FormatTranslator
FormatTranslator.defaultPattern()
protected java.text.Format getFormat(java.util.Locale locale)
getFormat
in class FormatTranslator
FormatTranslator.getFormat(java.util.Locale)
public java.text.DecimalFormat getDecimalFormat(java.util.Locale locale)
protected java.lang.String getMessageKey()
getMessageKey
in class FormatTranslator
FormatTranslator.getMessageKey()
protected java.lang.Object[] getMessageParameters(java.util.Locale locale, java.lang.String label)
getMessageParameters
in class AbstractTranslator
AbstractTranslator.getMessageParameters(java.util.Locale,
java.lang.String)
public void renderContribution(IMarkupWriter writer, IRequestCycle cycle, FormComponentContributorContext context, IFormComponent field)
FormComponentContributor
renderContribution
in interface FormComponentContributor
renderContribution
in class AbstractTranslator
writer
- 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 FormatTranslator
FormatTranslator.getConstraint()
public void setOmitZero(boolean omitZero)