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
-
PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC
-
-
PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC
-
-
escapeSyntaxPolicy
-
-
maskAlphaCharacter
-
-
maskEscapeCharacter
-
-
maskNumericCharacter
-
-
maskTokens
-
-
com.symantec.itools.swing.DatePatternToMaskXLator()
- Default constructor.
-
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.
-
getAmPmStringLength()
-
-
getDateFormatSymbols()
-
-
getEraStringLength()
-
-
getEscapeSyntaxPolicy()
- Returns the currentescape syntax policy.
-
getMaskAlphaCharacter()
- Returns the character used for mask alpha filter.
-
getMaskEscapeCharacter()
- Returns the character used for mask escape character.
-
getMaskForDatePattern(String)
- Get the mask representation for a DateFormats pattern.
-
getMaskForDateSubPattern(String)
- Get the mask representation for a DateFormats sub-pattern.
-
getMaskLiteralString(String)
-
-
getMaskNumericCharacter()
- Returns the character used for mask numeric filter.
-
getMaskStringForPatternChars(char, int)
- Get the equivalent mask string for a DateFormatSymbol character.
-
getMaskTokens()
- Returns an array of characters recognized as reserved mask tokens.
-
getMonthStringLength()
-
-
getShortMonthStringLength()
-
-
getShortWeekDaysStringLength()
-
-
getShortZoneStringLength()
-
-
getWeekDaysStringLength()
-
-
getZoneStringLength()
-
-
isCharacterMaskToken(char)
-
-
setEscapeSyntaxPolicy(int)
- Sets the escape syntax policy.
-
setMaskAlphaCharacter(char)
- Sets a character to be used for mask alpha character.By default
it is 'C'.
-
setMaskEscapeCharacter(char)
- Sets a character to be used for mask escape character.By default
it is '\\'.
-
setMaskNumericCharacter(char)
- Sets a character to be used for mask numeric character.
-
setMaskTokens(char[])
- Sets an array of characters as reserved mask tokens.
PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC
public static final int PRECEDE_ALLCHARS_IN_LITERAL_WITH_ESC
PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC
public static final int PRECEDE_MASKTOKENS_IN_LITERAL_WITH_ESC
escapeSyntaxPolicy
protected int escapeSyntaxPolicy
maskAlphaCharacter
protected char maskAlphaCharacter
maskEscapeCharacter
protected char maskEscapeCharacter
maskNumericCharacter
protected char maskNumericCharacter
maskTokens
protected char[] maskTokens
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.
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.
getAmPmStringLength
protected int getAmPmStringLength()
getDateFormatSymbols
protected java.text.DateFormatSymbols getDateFormatSymbols()
getEraStringLength
protected int getEraStringLength()
getEscapeSyntaxPolicy
public int getEscapeSyntaxPolicy()
- Returns the currentescape syntax policy.
getMaskAlphaCharacter
public char getMaskAlphaCharacter()
- Returns the character used for mask alpha filter.
getMaskEscapeCharacter
public char getMaskEscapeCharacter()
- Returns the character used for mask escape character.
getMaskForDatePattern
public java.lang.String getMaskForDatePattern(String pattern)
- Get the mask representation for a DateFormats pattern.
getMaskForDateSubPattern
protected java.lang.String getMaskForDateSubPattern(String pattern)
- Get the mask representation for a DateFormats sub-pattern.
getMaskLiteralString
protected java.lang.String getMaskLiteralString(String input)
getMaskNumericCharacter
public char getMaskNumericCharacter()
- Returns the character used for mask numeric filter.
getMaskStringForPatternChars
protected java.lang.String getMaskStringForPatternChars(char c,
int count)
- Get the equivalent mask string for a DateFormatSymbol character.
getMaskTokens
public char[] getMaskTokens()
- Returns an array of characters recognized as reserved mask tokens.
getMonthStringLength
protected int getMonthStringLength()
getShortMonthStringLength
protected int getShortMonthStringLength()
getShortWeekDaysStringLength
protected int getShortWeekDaysStringLength()
getShortZoneStringLength
protected int getShortZoneStringLength()
getWeekDaysStringLength
protected int getWeekDaysStringLength()
getZoneStringLength
protected int getZoneStringLength()
isCharacterMaskToken
protected boolean isCharacterMaskToken(char c)
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.
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).
setMaskEscapeCharacter
public void setMaskEscapeCharacter(char c)
- Sets a character to be used for mask escape character.By default
it is '\\'.
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).
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