org.zaval.lw.mask
Class DateMaskValidator

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

public class DateMaskValidator
extends java.lang.Object
implements MaskValidator

This is an implementation of MaskValidator interface and it implements date mask type.

The mask can contains following letters:

The table bellow shows different masks that can be combined using the validator:
Mask Shown Result (by LwMaskedTextField) Sample value
"dd-mm-yyyy" "__-__-____" "22-12-1998"
"dd/MMM/yyyy" "__/___/____" "18/Feb/2003"


Field Summary
static int DATE_TYPE
          This date mask element type definition.
 
Constructor Summary
DateMaskValidator()
          Constructs the date mask validator.
 
Method Summary
 java.lang.String completeValue(MaskElement e, java.lang.String value)
          Completes the new value for the specified mask element.
 char getBlankChar(char tagName)
          Gets the blank character for the specified mask tag.
 int getTypeByTag(char tag)
          Gets the type for the specified mask tag.
 boolean isHandledTag(char tagName)
          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.
 void setShortMonths(java.lang.String[] months)
          Sets the months abbreviations that is used for 'M' mask tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_TYPE

public static final int DATE_TYPE
This date mask element type definition.
Constructor Detail

DateMaskValidator

public DateMaskValidator()
Constructs the date mask validator.
Method Detail

setShortMonths

public void setShortMonths(java.lang.String[] months)
Sets the months abbreviations that is used for 'M' mask tag.
Parameters:
months - the specified months abbreviations.

getBlankChar

public char getBlankChar(char tagName)
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 type 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.

isHandledTag

public boolean isHandledTag(char tagName)
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.

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 value)
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.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org