Module org.tentackle.fx
Package org.tentackle.fx.translate
Class FractionNumberStringTranslator<M extends java.lang.Number>
- java.lang.Object
-
- org.tentackle.fx.translate.AbstractValueTranslator<M,java.lang.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,java.lang.String>
- Direct Known Subclasses:
BMoneyStringTranslator,DoubleStringTranslator,FloatStringTranslator
public abstract class FractionNumberStringTranslator<M extends java.lang.Number> extends NumberStringTranslator<M>
Abstract base class for fraction number translators.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description FractionNumberStringTranslator(FxTextComponent component)Creates a fraction number translator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetValidChars()Gets the valid input characters.booleanneedsToModelTwice()Returns 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, parse
-
Methods inherited from class org.tentackle.fx.translate.ValueStringTranslator
getComponent, toModel
-
Methods inherited from class org.tentackle.fx.translate.AbstractValueTranslator
isLenient, setLenient
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tentackle.fx.ValueTranslator
bindingPropertiesUpdated, toModelFunction, toView, toViewFunction
-
-
-
-
Constructor Detail
-
FractionNumberStringTranslator
public FractionNumberStringTranslator(FxTextComponent component)
Creates a fraction number translator.- Parameters:
component- the text component
-
-
Method Detail
-
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 if needs a second translation roundtrip
-
getValidChars
public java.lang.String getValidChars()
Description copied from class:ValueStringTranslatorGets the valid input characters.- Overrides:
getValidCharsin classNumberStringTranslator<M extends java.lang.Number>- Returns:
- the valid input chars, null if unlimited
-
-