: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw.mask
Class BasicMaskValidator

java.lang.Object
  |
  +--org.zaval.lw.mask.BasicMaskValidator
All Implemented Interfaces:
MaskValidator

public class BasicMaskValidator
extends java.lang.Object
implements MaskValidator

This is an implementation of MaskValidator interface. This basic validator is used by MaskedText as default if any other has not been set. The validator supports two mask elements types:

  • Letter type
  • Numeric type

The mask can contains the following letters:

  • 'a' - means any letter
  • 'A' - means any letter and in addition the mask validator will convert a letter to upper case
  • 'n' - means any numeric
  • 'x' - means any hexadecimal numeric
  • '#' - means any numeric sign ('+' or '-'). It is supposed that the mask letter is uses at the beginning of numeric
The first two mask letters belong to letter mask type and the rest belongs to numeric mask type.

The table below shows different masks that can be combined using the validator:
Mask Shown Result (by LwMaskedTextField) Sample value
"nnnn-nnnn.nnn" "0000-0000.000" "1230-1020.220"
"(Aaaaa nnnn)" "(_____ 0000)" "(Abcde 1211)"
"#nnnn(digit)" "+0000(digit)" "-2331(digit)"


Field Summary
static int LETTER_TYPE
          Specifies the letter mask element type.
static int NUMERIC_TYPE
          Specifies the numeric mask element type.
 
Constructor Summary
BasicMaskValidator()
           
BasicMaskValidator(int min, int max)
          Constructs the validator with the specified minimal and maximal possible values for the numeric elements.
 
Method Summary
 java.lang.String completeValue(MaskElement e, java.lang.String newValue)
          Completes the new value for the specified mask element.
 char getBlankChar(char tag)
          Gets the blank character for the specified mask tag.
 int getMaxValue()
          Gets the maximal possible value.
 int getMinValue()
          Gets the minimal possible value.
 int getTypeByTag(char tag)
          Gets the type for the specified mask tag.
 java.lang.Object getValueByElement(MaskElement e)
           
 boolean isHandledTag(char tag)
          Tests if the mask tag is handled with the validator.
 boolean isValidValue(MaskElement e, java.lang.String value)
          Tests if the specified value is valid for the mask element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LETTER_TYPE

public static final int LETTER_TYPE
Specifies the letter mask element type.

NUMERIC_TYPE

public static final int NUMERIC_TYPE
Specifies the numeric mask element type.
Constructor Detail

BasicMaskValidator

public BasicMaskValidator()

BasicMaskValidator

public BasicMaskValidator(int min,
                          int max)
Constructs the validator with the specified minimal and maximal possible values for the numeric elements.
Parameters:
min - the minimal possible value.
max - the maximal possible value.
Method Detail

getMinValue

public int getMinValue()
Gets the minimal possible value.
Returns:
a minimal possible value.

getMaxValue

public int getMaxValue()
Gets the maximal possible value.
Returns:
a maximal possible value.

isHandledTag

public boolean isHandledTag(char tag)
Description copied from interface: MaskValidator
Tests if the mask tag is handled with the validator.
Specified by:
isHandledTag in interface MaskValidator
Following copied from interface: org.zaval.lw.mask.MaskValidator
Parameters:
tag - the mask tag.
Returns:
true if the mask handles the specified mask tag; otherwise false.

getBlankChar

public char getBlankChar(char tag)
Description copied from interface: MaskValidator
Gets the blank character for the specified mask tag. The blank char is used to fill mask value for the tag.
Specified by:
getBlankChar in interface MaskValidator
Following copied from interface: org.zaval.lw.mask.MaskValidator
Parameters:
tag - the mask tag.
Returns:
a blank character.

getTypeByTag

public int getTypeByTag(char tag)
Description copied from interface: MaskValidator
Gets the type for the specified mask tag. The method should returns -1 if the tag is not bound with any type.
Specified by:
getTypeByTag in interface MaskValidator
Following copied from interface: org.zaval.lw.mask.MaskValidator
Parameters:
tag - the mask tag.
Returns:
a type.

isValidValue

public boolean isValidValue(MaskElement e,
                            java.lang.String value)
Description copied from interface: MaskValidator
Tests if the specified value is valid for the mask element.
Specified by:
isValidValue in interface MaskValidator
Following copied from interface: org.zaval.lw.mask.MaskValidator
Parameters:
e - the mask element.
newValue - the new value.
Returns:
true if the mask value is valid; otherwise false.

completeValue

public java.lang.String completeValue(MaskElement e,
                                      java.lang.String newValue)
Description copied from interface: MaskValidator
Completes the new value for the specified mask element.
Specified by:
completeValue in interface MaskValidator
Following copied from interface: org.zaval.lw.mask.MaskValidator
Parameters:
e - the mask element.
newValue - the new value.
Returns:
a new completed value.

getValueByElement

public java.lang.Object getValueByElement(MaskElement e)


: up