com.endeca.portal.format
Class DateTimeFormatter

java.lang.Object
  extended by com.endeca.portal.format.Formatter
      extended by com.endeca.portal.format.DateTimeFormatter
All Implemented Interfaces:
DateTimeFormatSettings, FormatSettings, java.io.Serializable

public class DateTimeFormatter
extends Formatter
implements DateTimeFormatSettings

Formatter for formatting DateTime type based on locale and format settings. If the value of a format setting is DEFAULT, the value of the format setting of its parent will be used if it is not DEFAULT. Otherwise, system default value of that format setting will be used.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.endeca.portal.format.Formatter
Formatter.FormatParseException
 
Nested classes/interfaces inherited from interface com.endeca.portal.format.DateTimeFormatSettings
DateTimeFormatSettings.DateDisplayFormat, DateTimeFormatSettings.TimeDisplayFormat
 
Nested classes/interfaces inherited from interface com.endeca.portal.format.FormatSettings
FormatSettings.Type
 
Field Summary
static DateTimeFormatSettings.DateDisplayFormat DEFAULT_DATE_DISPLAY_FORMAT
           
static DateTimeFormatSettings.TimeDisplayFormat DEFAULT_TIME_DISPLAY_FORMAT
           
 
Fields inherited from class com.endeca.portal.format.Formatter
parentFormatSettings, type
 
Constructor Summary
DateTimeFormatter()
           
 
Method Summary
protected  void clearCachedJavaFormat()
           
protected  void createJavaFormat()
           
 java.lang.String format(java.util.Date rawDate)
           
 java.lang.String format(java.lang.String rawString)
           
protected  java.text.DateFormat getCachedJavaFormat()
           
 DateTimeFormatSettings.DateDisplayFormat getDateDisplayFormat()
           
 DateTimeFormatSettings.DateDisplayFormat getMergedDateDisplayFormat()
           
 DateTimeFormatSettings.TimeDisplayFormat getMergedTimeDisplayFormat()
           
 DateTimeFormatSettings.TimeDisplayFormat getTimeDisplayFormat()
           
protected  void localeChanged()
          Subclasses can override this method to clear/reset some cached data that is dependent on locale, for example cached Java format.
protected  void parentFormatSettingsChanged()
          Subclasses can override this method to clear/reset some cached data that is dependent on parent format settings, for example cached Java format.
 void setDateDisplayFormat(DateTimeFormatSettings.DateDisplayFormat dateDisplayFormat)
           
 void setTimeDisplayFormat(DateTimeFormatSettings.TimeDisplayFormat timeDisplayFormat)
           
 java.lang.String toPattern()
           
 
Methods inherited from class com.endeca.portal.format.Formatter
getLocale, getParentFormatSettings, getType, loadResources, setLocale, setLocale, setParentFormatSettings, setType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.endeca.portal.format.FormatSettings
getType, toString
 

Field Detail

DEFAULT_DATE_DISPLAY_FORMAT

public static final DateTimeFormatSettings.DateDisplayFormat DEFAULT_DATE_DISPLAY_FORMAT

DEFAULT_TIME_DISPLAY_FORMAT

public static final DateTimeFormatSettings.TimeDisplayFormat DEFAULT_TIME_DISPLAY_FORMAT
Constructor Detail

DateTimeFormatter

public DateTimeFormatter()
Method Detail

getDateDisplayFormat

public DateTimeFormatSettings.DateDisplayFormat getDateDisplayFormat()
Specified by:
getDateDisplayFormat in interface DateTimeFormatSettings

setDateDisplayFormat

public void setDateDisplayFormat(DateTimeFormatSettings.DateDisplayFormat dateDisplayFormat)

getMergedDateDisplayFormat

public DateTimeFormatSettings.DateDisplayFormat getMergedDateDisplayFormat()
Specified by:
getMergedDateDisplayFormat in interface DateTimeFormatSettings

getTimeDisplayFormat

public DateTimeFormatSettings.TimeDisplayFormat getTimeDisplayFormat()
Specified by:
getTimeDisplayFormat in interface DateTimeFormatSettings

setTimeDisplayFormat

public void setTimeDisplayFormat(DateTimeFormatSettings.TimeDisplayFormat timeDisplayFormat)

getMergedTimeDisplayFormat

public DateTimeFormatSettings.TimeDisplayFormat getMergedTimeDisplayFormat()
Specified by:
getMergedTimeDisplayFormat in interface DateTimeFormatSettings

getCachedJavaFormat

protected java.text.DateFormat getCachedJavaFormat()

localeChanged

protected void localeChanged()
Description copied from class: Formatter
Subclasses can override this method to clear/reset some cached data that is dependent on locale, for example cached Java format.

Overrides:
localeChanged in class Formatter

parentFormatSettingsChanged

protected void parentFormatSettingsChanged()
Description copied from class: Formatter
Subclasses can override this method to clear/reset some cached data that is dependent on parent format settings, for example cached Java format.

Overrides:
parentFormatSettingsChanged in class Formatter

clearCachedJavaFormat

protected void clearCachedJavaFormat()

createJavaFormat

protected void createJavaFormat()

format

public java.lang.String format(java.lang.String rawString)
                        throws Formatter.FormatParseException
Specified by:
format in class Formatter
Throws:
Formatter.FormatParseException

format

public java.lang.String format(java.util.Date rawDate)

toPattern

public java.lang.String toPattern()