com.isti.quakewatch.alert
Class AlertMsgDateFormatter

java.lang.Object
  extended by com.isti.quakewatch.alert.AlertMsgDateFormatter
All Implemented Interfaces:
AlertMsgDateFormatterInterface

public class AlertMsgDateFormatter
extends java.lang.Object
implements AlertMsgDateFormatterInterface

Class AlertMsgDateFormatter defines an alert message date formatter.


Field Summary
protected  java.text.DateFormat gmtLongDateFormatter
          Date formatter for long messages using GMT.
protected  java.text.DateFormat localLongDateFormatter
          Date formatter for long messages using local time zone.
static java.lang.String LONG_DATE_FMTSTR
          Date format string for long messages.
static java.lang.String SHORT_DATE_FMTSTR
          Date format string for short messages.
protected  java.text.DateFormat shortDateFormatter
          Date formatter for short messages.
 
Constructor Summary
AlertMsgDateFormatter()
           
 
Method Summary
 java.lang.String formatLongMsgDate(java.util.Date dateObj, boolean gmtFlag)
          Formats a date into a string for a long-format message.
 java.lang.String formatShortMsgDate(java.util.Date dateObj)
          Formats a date into a string for a short-format message.
 void updateLocalTimeZone(boolean useGMTShortFlag, java.lang.String localTimeZone, boolean updateShortFlag)
          Updates the date formatters that use the local-time-zone configuration property.
 void updateShortDateFmtZone(boolean useGMTShortFlag, java.lang.String localTimeZone)
          Updates the time zone for the date formatter used for short messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LONG_DATE_FMTSTR

public static final java.lang.String LONG_DATE_FMTSTR
Date format string for long messages.

See Also:
Constant Field Values

SHORT_DATE_FMTSTR

public static final java.lang.String SHORT_DATE_FMTSTR
Date format string for short messages.

See Also:
Constant Field Values

gmtLongDateFormatter

protected final java.text.DateFormat gmtLongDateFormatter
Date formatter for long messages using GMT.


localLongDateFormatter

protected final java.text.DateFormat localLongDateFormatter
Date formatter for long messages using local time zone.


shortDateFormatter

protected final java.text.DateFormat shortDateFormatter
Date formatter for short messages.

Constructor Detail

AlertMsgDateFormatter

public AlertMsgDateFormatter()
Method Detail

updateLocalTimeZone

public void updateLocalTimeZone(boolean useGMTShortFlag,
                                java.lang.String localTimeZone,
                                boolean updateShortFlag)
Updates the date formatters that use the local-time-zone configuration property.

Specified by:
updateLocalTimeZone in interface AlertMsgDateFormatterInterface
Parameters:
useGMTShortFlag - true to use GMT for date/times in short messages.
localTimeZone - the local time zone.
updateShortFlag - true to always update the the date formatter used for short messages.

updateShortDateFmtZone

public void updateShortDateFmtZone(boolean useGMTShortFlag,
                                   java.lang.String localTimeZone)
Updates the time zone for the date formatter used for short messages.

Specified by:
updateShortDateFmtZone in interface AlertMsgDateFormatterInterface
Parameters:
useGMTShortFlag - true to use GMT for date/times in short messages.
localTimeZone - the local time zone.

formatLongMsgDate

public java.lang.String formatLongMsgDate(java.util.Date dateObj,
                                          boolean gmtFlag)
Formats a date into a string for a long-format message.

Specified by:
formatLongMsgDate in interface AlertMsgDateFormatterInterface
Parameters:
dateObj - the date object to format.
gmtFlag - true for GMT time zone; false for local time zone.
Returns:
The formatted date string.

formatShortMsgDate

public java.lang.String formatShortMsgDate(java.util.Date dateObj)
Formats a date into a string for a short-format message.

Specified by:
formatShortMsgDate in interface AlertMsgDateFormatterInterface
Parameters:
dateObj - the date object to format.
Returns:
The formatted date string.