com.sdm.quasar.client.core.ui.text
Class MultiDateFormat

java.lang.Object
  extended byjava.text.Format
      extended byjava.text.DateFormat
          extended bycom.sdm.quasar.client.core.ui.text.MultiDateFormat
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class MultiDateFormat
extends java.text.DateFormat

This DateFormat uses several DateFormats for parsing a date (one will do hopefully) and one for formatting.

Author:
Martin Haft
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.text.DateFormat
java.text.DateFormat.Field
 
Field Summary
static java.text.DateFormat[] DE_PARSER
          Supported patterns for parsing german date formats
static java.text.DateFormat[] EN_PARSER
          Supported patterns for parsing english date formats
 
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
 
Constructor Summary
MultiDateFormat()
          Default Cnstructor uses the default locale see Locale.getDefault() for Constructor MultiDateFormat(Locale).
MultiDateFormat(java.text.DateFormat wrappedFormatter, java.text.DateFormat[] wrappedParsers)
          Support your own DateFormats for formatting (one) and parsing (multible).
MultiDateFormat(java.util.Locale locale)
          Defult Constructor supports locales "de" and "en".
MultiDateFormat(java.lang.String formatPattern, java.lang.String[] parsePatterns)
          Support your own patterns for formatting (one) and parsing (multible).
MultiDateFormat(java.lang.String formatPattern, java.lang.String[] parsePatterns, java.util.Locale locale)
          Support your own patterns for formatting (one) and parsing (multible).
 
Method Summary
 java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer toAppendTo, java.text.FieldPosition fieldPosition)
           
 java.text.DateFormat getWrappedFormatter()
           
 java.text.DateFormat[] getWrappedParsers()
           
 java.util.Date parse(java.lang.String source, java.text.ParsePosition pos)
           
 void setWrappedFormatter(java.text.DateFormat wrappedFormatter)
           
 void setWrappedParsers(java.text.DateFormat[] wrappedParsers)
           
 
Methods inherited from class java.text.DateFormat
clone, equals, format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, hashCode, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone
 
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DE_PARSER

public static java.text.DateFormat[] DE_PARSER
Supported patterns for parsing german date formats


EN_PARSER

public static java.text.DateFormat[] EN_PARSER
Supported patterns for parsing english date formats

Constructor Detail

MultiDateFormat

public MultiDateFormat(java.lang.String formatPattern,
                       java.lang.String[] parsePatterns,
                       java.util.Locale locale)
Support your own patterns for formatting (one) and parsing (multible).

Parameters:
formatPattern - pattern for formatting
parsePatterns - several pattern for parsing
locale - the Locale

MultiDateFormat

public MultiDateFormat(java.lang.String formatPattern,
                       java.lang.String[] parsePatterns)
Support your own patterns for formatting (one) and parsing (multible).

Parameters:
formatPattern - pattern for formatting
parsePatterns - several pattern for parsing

MultiDateFormat

public MultiDateFormat(java.text.DateFormat wrappedFormatter,
                       java.text.DateFormat[] wrappedParsers)
Support your own DateFormats for formatting (one) and parsing (multible).


MultiDateFormat

public MultiDateFormat(java.util.Locale locale)
Defult Constructor supports locales "de" and "en". Uses DE_PARSER or {@value} for pasring and DE_PARSER[0] or {@value}[0] resp. for formatting

Parameters:
locale - the Locale to use

MultiDateFormat

public MultiDateFormat()
Default Cnstructor uses the default locale see Locale.getDefault() for Constructor MultiDateFormat(Locale).

Method Detail

getWrappedFormatter

public java.text.DateFormat getWrappedFormatter()

setWrappedFormatter

public void setWrappedFormatter(java.text.DateFormat wrappedFormatter)

getWrappedParsers

public java.text.DateFormat[] getWrappedParsers()

setWrappedParsers

public void setWrappedParsers(java.text.DateFormat[] wrappedParsers)

format

public java.lang.StringBuffer format(java.util.Date date,
                                     java.lang.StringBuffer toAppendTo,
                                     java.text.FieldPosition fieldPosition)

parse

public java.util.Date parse(java.lang.String source,
                            java.text.ParsePosition pos)