Module org.tentackle.fx
Package org.tentackle.fx.translate
Class FractionNumberStringTranslator<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>
org.tentackle.fx.translate.FractionNumberStringTranslator<M>
- Type Parameters:
M- the model's number type
- All Implemented Interfaces:
ValueTranslator<M,String>
- Direct Known Subclasses:
BMoneyStringTranslator,DoubleStringTranslator,FloatStringTranslator
public abstract class FractionNumberStringTranslator<M extends Number>
extends NumberStringTranslator<M>
Abstract base class for fraction number translators.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionFractionNumberStringTranslator(FxTextComponent component) Creates a fraction number translator. -
Method Summary
Modifier and TypeMethodDescriptionGets the valid input characters.booleanReturns whether toModel must be invoked twice.
An example is a DoubleStringTranslator:
let fraction number input be 1.211111 and formatting scale 2.Methods inherited from class org.tentackle.fx.translate.NumberStringTranslator
getDefaultPattern, getFormat, parseMethods 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, toModelFunction, toView, toViewFunction
-
Constructor Details
-
FractionNumberStringTranslator
Creates a fraction number translator.- Parameters:
component- the text component
-
-
Method Details
-
needsToModelTwice
public boolean needsToModelTwice()Description copied from interface:ValueTranslatorReturns whether toModel must be invoked twice.
An example is a DoubleStringTranslator:
let fraction number input be 1.211111 and formatting scale 2.- after first updateModel the model contains 1.211111
- after formatting and updateView, the view contains 1.21 but the model still contains 1.211111
- after second updateModel the model contains the correct value 1.21
- Returns:
- true to force a second translation roundtrip
-
getValidChars
Description copied from class:ValueStringTranslatorGets the valid input characters.- Overrides:
getValidCharsin classNumberStringTranslator<M extends Number>- Returns:
- the valid input chars, null if unlimited
-