org.springframework.binding.format.support
Class AbstractFormatterFactory

java.lang.Object
  extended by org.springframework.binding.format.support.AbstractFormatterFactory
All Implemented Interfaces:
FormatterFactory
Direct Known Subclasses:
SimpleFormatterFactory

public abstract class AbstractFormatterFactory
extends java.lang.Object
implements FormatterFactory

Base class for formatter factories. Manages the locale used by the produced formatters using Spring's LocaleContext system.

Author:
Keith Donald

Constructor Summary
AbstractFormatterFactory()
           
 
Method Summary
 Formatter getDateFormatter()
          Returns the default date format for the current locale.
 Formatter getDateTimeFormatter()
          Returns the default date/time format for the current locale.
protected  Style getDefaultDateStyle()
          Returns the default date style.
 Style getDefaultTimeStyle()
          Returns the default time style.
protected  java.util.Locale getLocale()
          Returns the locale in use.
 Formatter getTimeFormatter()
          Returns the default time format for the current locale.
 void setDefaultDateStyle(Style defaultDateStyle)
          Set the default date style.
 void setDefaultTimeStyle(Style defaultTimeStyle)
          Set the default time style.
 void setLocaleContext(org.springframework.context.i18n.LocaleContext localeContext)
          Sets the locale context used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.binding.format.FormatterFactory
getCurrencyFormatter, getDateFormatter, getDateFormatter, getDateTimeFormatter, getNumberFormatter, getPercentFormatter, getTimeFormatter
 

Constructor Detail

AbstractFormatterFactory

public AbstractFormatterFactory()
Method Detail

setLocaleContext

public void setLocaleContext(org.springframework.context.i18n.LocaleContext localeContext)
Sets the locale context used. Defaults to a SimpleLocaleContext holding the system default locale.


getLocale

protected java.util.Locale getLocale()
Returns the locale in use.


getDefaultDateStyle

protected Style getDefaultDateStyle()
Returns the default date style. Defaults to Style.MEDIUM.


setDefaultDateStyle

public void setDefaultDateStyle(Style defaultDateStyle)
Set the default date style.


getDefaultTimeStyle

public Style getDefaultTimeStyle()
Returns the default time style. Defaults to Style.MEDIUM.


setDefaultTimeStyle

public void setDefaultTimeStyle(Style defaultTimeStyle)
Set the default time style.


getDateFormatter

public Formatter getDateFormatter()
Description copied from interface: FormatterFactory
Returns the default date format for the current locale.

Specified by:
getDateFormatter in interface FormatterFactory
Returns:
the date formatter

getDateTimeFormatter

public Formatter getDateTimeFormatter()
Description copied from interface: FormatterFactory
Returns the default date/time format for the current locale.

Specified by:
getDateTimeFormatter in interface FormatterFactory
Returns:
the date/time formatter

getTimeFormatter

public Formatter getTimeFormatter()
Description copied from interface: FormatterFactory
Returns the default time format for the current locale.

Specified by:
getTimeFormatter in interface FormatterFactory
Returns:
the time formatter


Copyright � 2004-2007. All Rights Reserved.