Class com.symantec.itools.swing.JDateMaskedField
All Packages Class Hierarchy This Package Previous Next Index
Class com.symantec.itools.swing.JDateMaskedField
Object
|
+----Component
|
+----Container
|
+----JComponent
|
+----JTextComponent
|
+----JTextField
|
+----JMaskedTextField
|
+----com.symantec.itools.swing.JDateMaskedField
- public class JDateMaskedField
- extends JMaskedTextField
- implements Serializable, DateMaskedFieldConstants
JDateMaskedField 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.
Warning: serialized objects of this class will not be compatible with
future swing releases. The current serialization support is appropriate
for short term storage or RMI between Swing1.0 applications. It will
not be possible to load serialized Swing1.0 objects with future releases
of Swing. The JDK1.2 release of Swing will be the compatibility
baseline for the serialized form of Swing objects.
- Version:
- 1.0
- Author:
- Vasudev J. Rao
- See Also:
- JMaskedTextField
-
formattingStyle
-
-
includeLiterals
-
-
type
-
-
xlator
-
-
com.symantec.itools.swing.JDateMaskedField()
- Default contsructor.
-
com.symantec.itools.swing.JDateMaskedField(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()
- Returns current text with mask characters removed.
-
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
JDateMaskedField
public JDateMaskedField()
- Default contsructor. Constructs a date masked field of LONG style.
JDateMaskedField
public JDateMaskedField(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 JMaskedTextField
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()
- Returns current text with mask characters removed.
- Overrides:
- getUnmaskedText in class JMaskedTextField
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
JMaskedTextField.
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 JMaskedTextField
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