Module org.tentackle.fx
Package org.tentackle.fx.translate
Class NumberStringTranslator<M extends Number>
java.lang.Object
org.tentackle.fx.translate.AbstractValueTranslator<M,String>
org.tentackle.fx.translate.ValueStringTranslator<M>
org.tentackle.fx.translate.NumberStringTranslator<M>
- Type Parameters:
M- the model's number type
- All Implemented Interfaces:
ValueTranslator<M,String>
- Direct Known Subclasses:
ByteStringTranslator,FractionNumberStringTranslator,IntegerStringTranslator,LongStringTranslator,ShortStringTranslator
Abstract base class for number translators.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionNumberStringTranslator(FxTextComponent component) Creates a number translator. -
Method Summary
Modifier and TypeMethodDescriptionabstract StringGets the default pattern according to the type.protected DecimalFormatGets the decimal format.Gets the valid input characters.protected NumberParses a string to a number.Methods inherited from class org.tentackle.fx.translate.ValueStringTranslator
getComponent, toModelMethods inherited from class org.tentackle.fx.translate.AbstractValueTranslator
isLenient, isMappingIncomplete, isModelModified, saveModelValue, setLenientMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tentackle.fx.ValueTranslator
bindingPropertiesUpdated, needsToModelTwice, toModelFunction, toView, toViewFunction
-
Constructor Details
-
NumberStringTranslator
Creates a number translator.- Parameters:
component- the text component
-
-
Method Details
-
parse
Parses a string to a number.- Parameters:
s- the string- Returns:
- the number
-
getValidChars
Description copied from class:ValueStringTranslatorGets the valid input characters.- Overrides:
getValidCharsin classValueStringTranslator<M extends Number>- Returns:
- the valid input chars, null if unlimited
-
getDefaultPattern
Gets the default pattern according to the type.- Returns:
- the pattern
-
getFormat
Gets the decimal format.- Returns:
- the decimal format
-