Class com.symantec.itools.awt.DateMaskedField
All Packages Class Hierarchy This Package Previous Next Index
Class com.symantec.itools.awt.DateMaskedField
Object
|
+----Component
|
+----TextComponent
|
+----TextField
|
+----MaskedTextField
|
+----com.symantec.itools.awt.DateMaskedField
- public class DateMaskedField
- extends MaskedTextField
- implements Serializable, DateMaskedFieldConstants
DateMaskedField is a masked text component that automatically assumes a mask
based on the current locale and the type and formatting style specified by
the user.
- Version:
- 1.0
- Author:
- Vasudev J. Rao
- See Also:
- MaskedTextField
-
formattingStyle
-
-
includeLiterals
-
-
type
-
-
xlator
-
-
com.symantec.itools.awt.DateMaskedField()
- Default contsructor.
-
com.symantec.itools.awt.DateMaskedField(int, int)
- Constructs a masked field with the specified date type and style.
-
getDateMask()
- Returns the current mask.
-
getFormatter(int, int)
- Get a date/time formatter for the given type and formatting style.
-
getFormatterLocalizedPattern(DateFormat)
- Get the localized date pattern string for a DateFormat.
-
getFormatterPattern(DateFormat)
- Get the date pattern string for a DateFormat.
-
getFormattingStyle()
- Returns the style of date, time or timestamp.
-
getMaskForDateFormat(DateFormat)
- Get the mask representation of a DateFormat.
-
getMatchedText(String)
-
-
getPattern()
- Get the date/time formatter pattern for the current type and formatting style.
-
getType()
- Returns the type of date.
-
getUnmaskedText()
-
-
isIncludeLiterals()
- Returns whether or not literals would be included in the masked and Unmasked
texts.
-
parseDateValue(String)
- Parse a string to a date using the current type.
-
parseDateValue(String, int)
- Parse a string to a date using the given type.
-
setFormattingStyle(int)
- Set the style of the date, time or timestamp.
-
setIncludeLiterals(boolean)
- If set to true, the method setMaskedText would expect
the dates to have separators and all other literals.
-
setMaskedText(String)
- Initialize the field
-
setType(int)
- Set the type of date.
formattingStyle
protected int formattingStyle
includeLiterals
protected boolean includeLiterals
type
protected int type
xlator
protected com.symantec.itools.swing.DatePatternToMaskXLator xlator
DateMaskedField
public DateMaskedField()
- Default contsructor. Constructs a date masked field of LONG style.
DateMaskedField
public DateMaskedField(int type,
int style)
- Constructs a masked field with the specified date type and style.
Type can be one of DATE_TYPE, TIME_TYPE or TIMESTAMP_TYPE. Style
can be one of DateFormat.DEFAULT, FULL, LONG, MEDIUM or SHORT.
getDateMask
public java.lang.String getDateMask()
- Returns the current mask.
getFormatter
protected java.text.DateFormat getFormatter(int type,
int style)
- Get a date/time formatter for the given type and formatting style.
getFormatterLocalizedPattern
protected java.lang.String getFormatterLocalizedPattern(DateFormat dateFormat)
- Get the localized date pattern string for a DateFormat.
getFormatterPattern
protected java.lang.String getFormatterPattern(DateFormat dateFormat)
- Get the date pattern string for a DateFormat.
getFormattingStyle
public int getFormattingStyle()
- Returns the style of date, time or timestamp. Would be one of DateFormat.DEFAULT,
FULL, LONG, MEDIUM or SHORT.
getMaskForDateFormat
protected java.lang.String getMaskForDateFormat(DateFormat dateFormat)
- Get the mask representation of a DateFormat.
getMatchedText
protected java.lang.String getMatchedText(String s)
- Overrides:
- getMatchedText in class MaskedTextField
getPattern
public java.lang.String getPattern()
- Get the date/time formatter pattern for the current type and formatting style.
getType
public int getType()
- Returns the type of date. Would be one of DATE_TYPE, TIME_TYPE or TIMESTAMP_TYPE.
getUnmaskedText
public synchronized java.lang.String getUnmaskedText()
- Overrides:
- getUnmaskedText in class MaskedTextField
isIncludeLiterals
public boolean isIncludeLiterals()
- Returns whether or not literals would be included in the masked and Unmasked
texts.
parseDateValue
protected java.util.Date parseDateValue(String s)
- Parse a string to a date using the current type.
parseDateValue
protected java.util.Date parseDateValue(String s,
int type)
- Parse a string to a date using the given type.
setFormattingStyle
public void setFormattingStyle(int newStyle)
- Set the style of the date, time or timestamp. Should be one of DateFormat.DEFAULT,
FULL, LONG, MEDIUM or SHORT. If the type is invalid, DEFAULT is used.
setIncludeLiterals
public void setIncludeLiterals(boolean b)
- If set to true, the method setMaskedText would expect
the dates to have separators and all other literals. Also
the method getUnmaskedText would return all the separators
and literals. If false, the behavior would default to the behavior of
MaskedTextField.
For eg., in case of SHORT date,
when set to true, setMaskedText expects dates "10-Jun-1998" and when set
to false it expects 10Jun1998. Similarly, getUnmaskedText would return
"10-Jun-1998" or "10Jun1998" based on ths setting.
setMaskedText
public void setMaskedText(String s)
- Initialize the field
- Overrides:
- setMaskedText in class MaskedTextField
setType
public void setType(int newType)
- Set the type of date. Should be one of DATE_TYPE, TIME_TYPE or TIMESTAMP_TYPE.
If the type supplied is invalid DATE_TYPE is used.
All Packages Class Hierarchy This Package Previous Next Index