Class BMoneyStringTranslator
java.lang.Object
org.tentackle.fx.translate.AbstractValueTranslator<BMoney,String>
org.tentackle.fx.translate.ValueStringTranslator<BMoney>
org.tentackle.fx.translate.NumberStringTranslator<BMoney>
org.tentackle.fx.translate.FractionNumberStringTranslator<BMoney>
org.tentackle.fx.translate.BMoneyStringTranslator
- All Implemented Interfaces:
ValueTranslator<BMoney,String>
@ValueTranslatorService(modelClass=BMoney.class,
viewClass=String.class)
public class BMoneyStringTranslator
extends FractionNumberStringTranslator<BMoney>
BMoney translator.
Applies to
Applies to
DMoney as well.- Author:
- harald
-
Field Summary
Fields inherited from class NumberStringTranslator
format, pattern, signedValidChars, unsignedValidChars -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the default pattern according to the type.protected BMoneyParses a string to a number.
On failure, the error and error offset are set in the component.Function to translate a view value to a model value.Function to translate a model value to a view value.Methods inherited from class FractionNumberStringTranslator
initializeValidChars, needsToModelTwiceMethods inherited from class NumberStringTranslator
getFormat, getValidCharsMethods inherited from class ValueStringTranslator
getComponent, toModelMethods inherited from class AbstractValueTranslator
isLenient, isMappingIncomplete, isModelModified, saveModelValue, setLenientMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ValueTranslator
bindingPropertiesUpdated, toView
-
Constructor Details
-
BMoneyStringTranslator
Creates a translator.- Parameters:
component- the text component
-
-
Method Details
-
toViewFunction
Description copied from interface:ValueTranslatorFunction to translate a model value to a view value.- Returns:
- the function
-
toModelFunction
Description copied from interface:ValueTranslatorFunction to translate a view value to a model value.- Returns:
- the function
-
getDefaultPattern
Description copied from class:NumberStringTranslatorGets the default pattern according to the type.- Specified by:
getDefaultPatternin classNumberStringTranslator<BMoney>- Returns:
- the pattern
-
parse
Parses a string to a number.
On failure, the error and error offset are set in the component.If the decimal separator is missing and
FxUtilities.isLenientMoneyInput(FxTextComponent)is enabled, it is inserted according to the component's scale. Unlike the other number translators, parsing errors are only set in the component and null is returned.- Overrides:
parsein classNumberStringTranslator<BMoney>- Parameters:
str- the string- Returns:
- the money value, null if the string is null or parsing failed
-