com.jgoodies.common.format
Class AbstractWrappedDateFormat
java.lang.Object
java.text.Format
java.text.DateFormat
com.jgoodies.common.format.AbstractWrappedDateFormat
- All Implemented Interfaces:
- Serializable, Cloneable
- Direct Known Subclasses:
- EmptyDateFormat
public abstract class AbstractWrappedDateFormat
- extends DateFormat
Reduces the effort required to write custom DateFormat implementation
that retain the ability to iterate through Dates with the arrow key
in formatted text fields (using an appropriate DateFormatter)
This class wraps a given DateFormat and delegates mos
of its behavior to the delegate, except for the abstract method
format(Date, StringBuffer, FieldPosition) an
parse(String, ParsePosition) that can be overridden b
a subclass. For example the subclass EmptyDateFormat wraps a DateForma
but it parses the empty String and returns null where th
predefined Java DateFormats throw an exception.
- Version:
- $Revision: 1.5 $
- Author:
- Karsten Lentzsch
- See Also:
- Serialized Form
|
Field Summary |
protected DateFormat |
delegate
Refers to the wrapped Format that is used to forwar
#format and #parseObject. |
| Fields inherited from class java.text.DateFormat |
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD |
| Methods inherited from class java.text.DateFormat |
clone, equals, format, format, getAvailableLocales, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getTimeInstance, getTimeInstance, getTimeInstance, hashCode, parse, parseObject |
delegate
protected final DateFormat delegate
- Refers to the wrapped Format that is used to forwar
#format and #parseObject.
AbstractWrappedDateFormat
public AbstractWrappedDateFormat(DateFormat delegate)
- Constructs an AbstractWrappedDateFormat that wraps the given mandator
format.
- Parameters:
delegate - the format that handles the standard cases
- Throws:
NullPointerException - if delegate is null
format
public abstract StringBuffer format(Date date,
StringBuffer toAppendTo,
FieldPosition pos)
- Specified by:
format in class DateFormat
parse
public abstract Date parse(String source,
ParsePosition pos)
- Specified by:
parse in class DateFormat
getCalendar
public Calendar getCalendar()
- Overrides:
getCalendar in class DateFormat
setCalendar
public void setCalendar(Calendar newCalendar)
- Overrides:
setCalendar in class DateFormat
getNumberFormat
public NumberFormat getNumberFormat()
- Overrides:
getNumberFormat in class DateFormat
setNumberFormat
public void setNumberFormat(NumberFormat newNumberFormat)
- Overrides:
setNumberFormat in class DateFormat
getTimeZone
public TimeZone getTimeZone()
- Overrides:
getTimeZone in class DateFormat
setTimeZone
public void setTimeZone(TimeZone zone)
- Overrides:
setTimeZone in class DateFormat
isLenient
public boolean isLenient()
- Overrides:
isLenient in class DateFormat
setLenient
public void setLenient(boolean lenient)
- Overrides:
setLenient in class DateFormat
formatToCharacterIterator
public AttributedCharacterIterator formatToCharacterIterator(Object obj)
- Overrides:
formatToCharacterIterator in class Format
Copyright © 2009-2013 JGoodies Software GmbH. All Rights Reserved.