Class MaskTextFormatter.MaskTextFilter

java.lang.Object
atlantafx.base.util.MaskTextFormatter.MaskTextFilter
All Implemented Interfaces:
Function<javafx.scene.control.TextFormatter.Change,javafx.scene.control.TextFormatter.Change>, UnaryOperator<javafx.scene.control.TextFormatter.Change>
Enclosing class:
MaskTextFormatter

protected static class MaskTextFormatter.MaskTextFilter extends Object implements UnaryOperator<javafx.scene.control.TextFormatter.Change>
  • Field Details

    • mask

      protected final List<MaskChar> mask
    • ignoreFilter

      protected boolean ignoreFilter
  • Constructor Details

    • MaskTextFilter

      public MaskTextFilter(List<MaskChar> mask)
  • Method Details

    • isInternalChange

      public boolean isInternalChange()
    • doInternalChange

      public void doInternalChange(Runnable r)
    • apply

      public javafx.scene.control.TextFormatter.Change apply(javafx.scene.control.TextFormatter.Change change)
      Specified by:
      apply in interface Function<javafx.scene.control.TextFormatter.Change,javafx.scene.control.TextFormatter.Change>
    • correctContentChange

      @Nullable protected @Nullable javafx.scene.control.TextFormatter.Change correctContentChange(javafx.scene.control.TextFormatter.Change change)
      Corrects and returns the content change if it matches the mask. Otherwise, returns null to drop the change.
    • correctReplacedText

      @Nullable protected @Nullable String correctReplacedText(javafx.scene.control.TextFormatter.Change change)
      Corrects the replaced text. For any replaced character it checks whether it matches the mask character at the same position and applies MaskChar.transform(char). if true. If not, returns null, thus signifying that added text is not valid.
    • correctAddedText

      @Nullable protected @Nullable String correctAddedText(javafx.scene.control.TextFormatter.Change change)
      Corrects added text. For any input character it checks whether it matches the mask character at the same position and applies MaskChar.transform(char). if true. If not, returns null, thus signifying that added text is not valid.
    • correctDeletedText

      protected String correctDeletedText(javafx.scene.control.TextFormatter.Change change)
      Corrects the deleted text. Basically, replaces all deleted characters with placeholders and returns the resulting text which is always not null.
    • adjustCaretPosition

      protected void adjustCaretPosition(javafx.scene.control.TextFormatter.Change change)