Class com.symantec.itools.swing.DatePatternToMaskXLator
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.swing.DatePatternToMaskXLator

Object
   |
   +----com.symantec.itools.swing.DatePatternToMaskXLator

public class DatePatternToMaskXLator
extends Object
implements Serializable
DatePatternToMaskXLator is a translator that can be used to translate date patterns such as "yyyy.MM.dd G 'at' hh:mm:ss z" to an appropriate mask. The pattern should not be a localized pattern.

The mask could then be used in masked fields and formatted text fields. The patterns are interpreted using the format syntax specified in java.text.SimpleDateFormat. The translator also allows some customization to suit specific needs.

Version:
1.0
Author:
Vasudev J. Rao
See Also:
SimpleDateFormat, JDateMaskedField, JMaskedTextField

Variable Index

 o PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC
 o PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC
 o escapeSyntaxPolicy
 o maskAlphaCharacter
 o maskEscapeCharacter
 o maskNumericCharacter
 o maskTokens

Constructor Index

 o com.symantec.itools.swing.DatePatternToMaskXLator()
Default constructor.
 o com.symantec.itools.swing.DatePatternToMaskXLator(char, char, char)
Constructor to construct a translator using the specified characters for numeric and alpha mask and mask escape characters.

Method Index

 o getAmPmStringLength()
 o getDateFormatSymbols()
 o getEraStringLength()
 o getEscapeSyntaxPolicy()
Returns the currentescape syntax policy.
 o getMaskAlphaCharacter()
Returns the character used for mask alpha filter.
 o getMaskEscapeCharacter()
Returns the character used for mask escape character.
 o getMaskForDatePattern(String)
Get the mask representation for a DateFormats pattern.
 o getMaskForDateSubPattern(String)
Get the mask representation for a DateFormats sub-pattern.
 o getMaskLiteralString(String)
 o getMaskNumericCharacter()
Returns the character used for mask numeric filter.
 o getMaskStringForPatternChars(char, int)
Get the equivalent mask string for a DateFormatSymbol character.
 o getMaskTokens()
Returns an array of characters recognized as reserved mask tokens.
 o getMonthStringLength()
 o getShortMonthStringLength()
 o getShortWeekDaysStringLength()
 o getShortZoneStringLength()
 o getWeekDaysStringLength()
 o getZoneStringLength()
 o isCharacterMaskToken(char)
 o setEscapeSyntaxPolicy(int)
Sets the escape syntax policy.
 o setMaskAlphaCharacter(char)
Sets a character to be used for mask alpha character.By default it is 'C'.
 o setMaskEscapeCharacter(char)
Sets a character to be used for mask escape character.By default it is '\\'.
 o setMaskNumericCharacter(char)
Sets a character to be used for mask numeric character.
 o setMaskTokens(char[])
Sets an array of characters as reserved mask tokens.

Variables

 o PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC
public static final int PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC
 o PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC
public static final int PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC
 o escapeSyntaxPolicy
protected int escapeSyntaxPolicy
 o maskAlphaCharacter
protected char maskAlphaCharacter
 o maskEscapeCharacter
protected char maskEscapeCharacter
 o maskNumericCharacter
protected char maskNumericCharacter
 o maskTokens
protected char[] maskTokens

Constructors

 o DatePatternToMaskXLator
public DatePatternToMaskXLator()
Default constructor. Constructs a date pattern to mask translator using '9' for mask numeric character, 'C' for mask alpha character and '\\' for mask escape character.

 o DatePatternToMaskXLator
public DatePatternToMaskXLator(char numericMask,
                               char alphaMask,
                               char esc)
Constructor to construct a translator using the specified characters for numeric and alpha mask and mask escape characters.

Methods

 o getAmPmStringLength
protected int getAmPmStringLength()
 o getDateFormatSymbols
protected java.text.DateFormatSymbols getDateFormatSymbols()
 o getEraStringLength
protected int getEraStringLength()
 o getEscapeSyntaxPolicy
public int getEscapeSyntaxPolicy()
Returns the currentescape syntax policy.

 o getMaskAlphaCharacter
public char getMaskAlphaCharacter()
Returns the character used for mask alpha filter.

 o getMaskEscapeCharacter
public char getMaskEscapeCharacter()
Returns the character used for mask escape character.

 o getMaskForDatePattern
public java.lang.String getMaskForDatePattern(String pattern)
Get the mask representation for a DateFormats pattern.

 o getMaskForDateSubPattern
protected java.lang.String getMaskForDateSubPattern(String pattern)
Get the mask representation for a DateFormats sub-pattern.

 o getMaskLiteralString
protected java.lang.String getMaskLiteralString(String input)
 o getMaskNumericCharacter
public char getMaskNumericCharacter()
Returns the character used for mask numeric filter.

 o getMaskStringForPatternChars
protected java.lang.String getMaskStringForPatternChars(char c,
                                                        int count)
Get the equivalent mask string for a DateFormatSymbol character.

 o getMaskTokens
public char[] getMaskTokens()
Returns an array of characters recognized as reserved mask tokens.

 o getMonthStringLength
protected int getMonthStringLength()
 o getShortMonthStringLength
protected int getShortMonthStringLength()
 o getShortWeekDaysStringLength
protected int getShortWeekDaysStringLength()
 o getShortZoneStringLength
protected int getShortZoneStringLength()
 o getWeekDaysStringLength
protected int getWeekDaysStringLength()
 o getZoneStringLength
protected int getZoneStringLength()
 o isCharacterMaskToken
protected boolean isCharacterMaskToken(char c)
 o setEscapeSyntaxPolicy
public void setEscapeSyntaxPolicy(int policy)
Sets the escape syntax policy. Can be one of PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC or PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC

If the escape syntax policy is PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC, if a reserved mask token occurs within a literal, it is preceded with the mask escape character.

If the escape syntax policy is PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC, all character within a literal are preceded with mask escape character.

Throws: IllegalArgumentException
if the policy is invalid.
 o setMaskAlphaCharacter
public void setMaskAlphaCharacter(char c)
Sets a character to be used for mask alpha character.By default it is 'C'. It may be set to any other character ( for eg., 'A', 'a', etc).

 o setMaskEscapeCharacter
public void setMaskEscapeCharacter(char c)
Sets a character to be used for mask escape character.By default it is '\\'.

 o setMaskNumericCharacter
public void setMaskNumericCharacter(char c)
Sets a character to be used for mask numeric character. By default it is '9'. It may be set to any other character ( for eg., '0', '#', etc).

 o setMaskTokens
public void setMaskTokens(char maskTokens)
Sets an array of characters as reserved mask tokens. If the escape syntax policy is PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC, this list is checked to determine whether or not to precede a character with the escape character.


All Packages  Class Hierarchy  This Package  Previous  Next  Index