java.lang.Object
atlantafx.base.util.SimpleMaskChar
- All Implemented Interfaces:
MaskChar
The default
MaskChar implementation that should be suitable
for anything except heavily custom logic.-
Field Summary
Fields inherited from interface atlantafx.base.util.MaskChar
INPUT_MASK_ANY_NON_SPACE, INPUT_MASK_DIGIT, INPUT_MASK_DIGIT_0_TO_1, INPUT_MASK_DIGIT_0_TO_2, INPUT_MASK_DIGIT_0_TO_3, INPUT_MASK_DIGIT_0_TO_4, INPUT_MASK_DIGIT_0_TO_5, INPUT_MASK_DIGIT_0_TO_6, INPUT_MASK_DIGIT_0_TO_7, INPUT_MASK_DIGIT_0_TO_8, INPUT_MASK_DIGIT_NON_ZERO, INPUT_MASK_DIGIT_OR_LETTER, INPUT_MASK_DIGIT_ZERO, INPUT_MASK_HEX, INPUT_MASK_LETTER, UNDERSCORE -
Constructor Summary
ConstructorsConstructorDescriptionSimpleMaskChar(Predicate<Character> matchExpr) Creates a SimpleMaskChar.SimpleMaskChar(Predicate<Character> matchExpr, UnaryOperator<Character> transform) Creates a SimpleMaskChar.SimpleMaskChar(Predicate<Character> matchExpr, UnaryOperator<Character> transform, char placeholder) Creates a SimpleMaskChar.SimpleMaskChar(Predicate<Character> matchExpr, UnaryOperator<Character> transform, char placeholder, boolean fixed) Creates a SimpleMaskChar. -
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleMaskCharfixed(char ch) A utility method for creating a fixed character - that is, the character used to represent the fixed part (a prefix or a suffix) of the input mask.charReturns the placeholder for the mask character.booleanisAllowed(char ch) Returns "true" if the character is allowed, "false" otherwise.booleanisFixed()Returns whether character is fixed (prefix, suffix or separator).chartransform(char ch) Transforms user input character before setting.
-
Constructor Details
-
SimpleMaskChar
Creates a SimpleMaskChar.- Parameters:
matchExpr- The matching predicate that determines which characters are masked.- See Also:
-
SimpleMaskChar
Creates a SimpleMaskChar.- Parameters:
matchExpr- The matching predicate that determines which characters are masked.transform- The transformation function that is applied to input characters.- See Also:
-
SimpleMaskChar
public SimpleMaskChar(Predicate<Character> matchExpr, UnaryOperator<Character> transform, char placeholder) Creates a SimpleMaskChar.- Parameters:
matchExpr- The matching predicate that determines which characters are masked.transform- The transformation function that is applied to input characters.placeholder- The placeholder character to use for masking.- See Also:
-
SimpleMaskChar
public SimpleMaskChar(Predicate<Character> matchExpr, UnaryOperator<Character> transform, char placeholder, boolean fixed) Creates a SimpleMaskChar.- Parameters:
matchExpr- The matching predicate that determines which characters are masked.transform- The transformation function that is applied to input characters. No transformation is applied by default.placeholder- The placeholder character to use for masking. The default replacement is underscore character.fixed- Boolean value indicating if the character is fixed or not. Default is false.
-
-
Method Details
-
isAllowed
public boolean isAllowed(char ch) Returns "true" if the character is allowed, "false" otherwise. -
transform
public char transform(char ch) Transforms user input character before setting. -
getPlaceholder
public char getPlaceholder()Returns the placeholder for the mask character.- Specified by:
getPlaceholderin interfaceMaskChar
-
isFixed
public boolean isFixed()Returns whether character is fixed (prefix, suffix or separator). -
fixed
A utility method for creating a fixed character - that is, the character used to represent the fixed part (a prefix or a suffix) of the input mask.
-