Class TimeZoneHelper


  • public class TimeZoneHelper
    extends Object
    Helper class for timezone setup.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • DEFAULT_TIMEZONE

        public static final String DEFAULT_TIMEZONE
        the constant for the system's default timezone.
        See Also:
        Constant Field Values
      • m_Singleton

        protected static TimeZoneHelper m_Singleton
        the singleton.
      • m_Properties

        protected Properties m_Properties
        the properties.
      • m_Modified

        protected boolean m_Modified
        whether the settings got modified.
    • Method Detail

      • initializeTimezone

        public void initializeTimezone()
        Initializes the timezone with the current settings.
      • isModified

        public boolean isModified()
        Whether the settings got modified.
        Returns:
        true if modified
      • getTimezone

        public String getTimezone()
        Returns the timezone.
        Returns:
        the timezone
      • setTimezone

        public void setTimezone​(String value)
        Updates the timezone.
        Parameters:
        value - the timezone
      • reload

        public void reload()
        Reloads the properties file. Discards any unsaved settings.
      • save

        public boolean save()
        Saves the settings in the user's home directory.
        Returns:
        true if successfully saved
      • getSingleton

        public static TimeZoneHelper getSingleton()
        Returns the singleton.
        Returns:
        the singleton
      • toString

        public static String toString​(TimeZone tz)
        Returns the timezone as string.
        Parameters:
        tz - the timezone object to convert
        Returns:
        the generated string
      • valueOf

        public static TimeZone valueOf​(String str)
        Returns a timezone generated from the string.
        Parameters:
        str - the string to convert to a timezone
        Returns:
        the generated timezone
      • getIDs

        public static String[] getIDs()
        Returns all the timezone IDs, including DEFAULT_TIMEZONE.
        Returns:
        the IDs