| com.jgoodies.validation.formatter.EmptyDateFormatter com.jgoodies.validation.formatter.RelativeDateFormatter
RelativeDateFormatter | public class RelativeDateFormatter extends EmptyDateFormatter (Code) | | Adds relative dates and output shortcuts to its superclass
EmptyDateFormatter.
If output shortcuts are enabled, Yesterday, Today and Tomorrow
are formatted using their localized human-language print strings.
If relative input is allowed, the parser accepts signed integers
that encode a date relative to today; this input would otherwise
be considered invalid.
author: Karsten Lentzsch version: $Revision: 1.9 $ See Also: com.jgoodies.validation.util.ValidationUtils See Also: javax.swing.JFormattedTextField |
Field Summary | |
final public static String | KEY_TODAY The resource bundle key used to localize 'Today'. | final public static String | KEY_TOMORROW The resource bundle key used to localize 'Tomorrow'. | final public static String | KEY_YESTERDAY The resource bundle key used to localize 'Yesterday'. |
Constructor Summary | |
public | RelativeDateFormatter() Constructs a RelativeDateFormatter using the default DateFormat
with output shortcuts and relative input enabled. | public | RelativeDateFormatter(DateFormat format) Constructs a RelativeDateFormatter using the given DateFormat
with output shortcuts and relative input enabled. | public | RelativeDateFormatter(boolean useOutputShortcuts, boolean allowRelativeInput) Constructs a RelativeDateFormatter using the default DateFormat
with output shortcuts and relative input configured as specified. | public | RelativeDateFormatter(DateFormat format, boolean useOutputShortcuts, boolean allowRelativeInput) Constructs a RelativeDateFormatter using the given DateFormat
with output shortcuts and relative input configured as specified. |
Method Summary | |
public static ResourceBundle | getDefaultResourceBundle() Returns the ResourceBundle that is used as default
unless overridden by an individual bundle. | final public ResourceBundle | getResourceBundle() Returns the ResourceBundle used to lookup localized texts
for Yesterday, Today, and Tomorrow. | public static void | setDefaultResourceBundle(ResourceBundle newDefaultBundle) Sets the ResourceBundle that is used as default for all
RelativeDateFormatters that have no individual bundle set. | final public void | setResourceBundle(ResourceBundle newBundle) Sets a ResourceBundle that will be used to lookup localized texts
for Yesterday, Today, and Tomorrow. | public Object | stringToValue(String text) Returns the Object representation of the String text .
In addition to the delegate's behavior, this methods accepts
signed integers interpreted as days relative to today. | public String | valueToString(Object value) Returns a String representation of the Object value . |
KEY_TODAY | final public static String KEY_TODAY(Code) | | The resource bundle key used to localize 'Today'.
|
KEY_TOMORROW | final public static String KEY_TOMORROW(Code) | | The resource bundle key used to localize 'Tomorrow'.
|
KEY_YESTERDAY | final public static String KEY_YESTERDAY(Code) | | The resource bundle key used to localize 'Yesterday'.
|
RelativeDateFormatter | public RelativeDateFormatter()(Code) | | Constructs a RelativeDateFormatter using the default DateFormat
with output shortcuts and relative input enabled.
|
RelativeDateFormatter | public RelativeDateFormatter(DateFormat format)(Code) | | Constructs a RelativeDateFormatter using the given DateFormat
with output shortcuts and relative input enabled.
Parameters: format - the DateFormat used to format and parse dates |
RelativeDateFormatter | public RelativeDateFormatter(boolean useOutputShortcuts, boolean allowRelativeInput)(Code) | | Constructs a RelativeDateFormatter using the default DateFormat
with output shortcuts and relative input configured as specified.
Parameters: useOutputShortcuts - true indicates that dates are formattedwith shortcuts for yesterday, today, and tomorrow, where falsealways converts using absolute numbers for day, month and year. Parameters: allowRelativeInput - true indicates that the parser acceptssigned integers that encode a date relative to today; if falsesuch input is considered invalid |
RelativeDateFormatter | public RelativeDateFormatter(DateFormat format, boolean useOutputShortcuts, boolean allowRelativeInput)(Code) | | Constructs a RelativeDateFormatter using the given DateFormat
with output shortcuts and relative input configured as specified.
Parameters: format - the DateFormat used to format and parse dates Parameters: useOutputShortcuts - true indicates that dates are formattedwith shortcuts for yesterday, today, and tomorrow, where falsealways converts using absolute numbers for day, month and year. Parameters: allowRelativeInput - true indicates that the parser acceptssigned integers that encode a date relative to today; if falsesuch input is considered invalid |
getDefaultResourceBundle | public static ResourceBundle getDefaultResourceBundle()(Code) | | Returns the ResourceBundle that is used as default
unless overridden by an individual bundle.
the ResourceBundle that is used as default |
setDefaultResourceBundle | public static void setDefaultResourceBundle(ResourceBundle newDefaultBundle)(Code) | | Sets the ResourceBundle that is used as default for all
RelativeDateFormatters that have no individual bundle set.
Parameters: newDefaultBundle - the ResourceBundle to be used as default |
stringToValue | public Object stringToValue(String text) throws ParseException(Code) | | Returns the Object representation of the String text .
In addition to the delegate's behavior, this methods accepts
signed integers interpreted as days relative to today.
Parameters: text - the String to convert the Object representation of text throws: ParseException - if there is an error in the conversion |
valueToString | public String valueToString(Object value) throws ParseException(Code) | | Returns a String representation of the Object value .
This invokes format on the current DateFormat.
In addition to the superclass behavior, this method formats the dates
for yesterday, today and tomorrow to the natural language strings.
Parameters: value - The value to convert a String representation for the value throws: ParseException - if there is an error in the conversion |
|
|