Class FractionNumberStringTranslator<M extends Number>

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 Details

    • FractionNumberStringTranslator

      public FractionNumberStringTranslator(FxTextComponent component)
      Creates a fraction number translator.
      Parameters:
      component - the text component
  • Method Details

    • needsToModelTwice

      public boolean needsToModelTwice()
      Description copied from interface: ValueTranslator
      Returns 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

      public String getValidChars()
      Description copied from class: ValueStringTranslator
      Gets the valid input characters.
      Overrides:
      getValidChars in class NumberStringTranslator<M extends Number>
      Returns:
      the valid input chars, null if unlimited