: 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 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 that implements date mask type.

The mask can contains the following letters:

  • 'd' - means a day as a numeric
  • 'y' - means an year as a numeric
  • 'm' - means a month as a numeric
  • 'M' - means a month as a short abbreviation (Use the setShortMonths method to define the abbreviations)
The table below 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
          Specifies the date mask element type.
 
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 are 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
Specifies the date mask element type.
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 are 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 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.


: up