Package adams.core.management
Class TimeZoneHelper
- java.lang.Object
-
- adams.core.management.TimeZoneHelper
-
public class TimeZoneHelper extends Object
Helper class for timezone setup.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_TIMEZONE
the constant for the system's default timezone.static String
FILENAME
the props file.protected boolean
m_Modified
whether the settings got modified.protected Properties
m_Properties
the properties.protected static TimeZoneHelper
m_Singleton
the singleton.static String
TIMEZONE
the timezone to use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String[]
getIDs()
Returns all the timezone IDs, includingDEFAULT_TIMEZONE
.static TimeZoneHelper
getSingleton()
Returns the singleton.String
getTimezone()
Returns the timezone.void
initializeTimezone()
Initializes the timezone with the current settings.boolean
isModified()
Whether the settings got modified.void
reload()
Reloads the properties file.boolean
save()
Saves the settings in the user's home directory.void
setTimezone(String value)
Updates the timezone.static String
toString(TimeZone tz)
Returns the timezone as string.static TimeZone
valueOf(String str)
Returns a timezone generated from the string.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the props file.- See Also:
- Constant Field Values
-
TIMEZONE
public static final String TIMEZONE
the timezone to use.- See Also:
- Constant Field Values
-
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, includingDEFAULT_TIMEZONE
.- Returns:
- the IDs
-
-