GeoSoft API

no.geosoft.cc.locale
Class TimeZoneManager

Object
  |
  +--TimeZoneManager

public class TimeZoneManager
extends Object

A manager class for keeping track of a "current" time zone. Reading times from 3rd party sources:

   DateFormat format = new SimpleDateFormat (pattern);
   format.setTimeZone (TimeZone.getTimeZone ([accroding to input format]);
   Date time = format.parse (string);
 
Reading times from GUI:
   DateFormat format = new SimpleDateFormat (pattern);
   format.setTimeZone (TimeZone.getTimeZone (TimeZoneManager.getTimeZone());
   Date time = format.parse (string);
 
Displaying times:
 
   Date date;
   DateFormat format = new SimpleDateFormat (pattern);
   format.setTimeZone (TimeZoneManager.getTimeZone());
   System.out.println (format.format (date));
 

Author:
GeoSoft

Constructor Summary
TimeZoneManager()
          Create a time manager with the default current time zone (UTC).
TimeZoneManager(TimeZone timeZone)
          Create a time manager with the specified current time zone.
 
Method Summary
 void addTimeZoneListener(TimeZoneListener timeZoneListener)
          Add a time zone listener.
 TimeZone getTimeZone()
          Return the current time zone.
 void removeTimeZoneListener(TimeZoneListener timeZoneListener)
          Remove time zone listener.
 void setTimeZone(TimeZone timeZone)
          Set new current time zone and update listeners.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeZoneManager

public TimeZoneManager(TimeZone timeZone)
Create a time manager with the specified current time zone.

Parameters:
timeZone - Current time zone.

TimeZoneManager

public TimeZoneManager()
Create a time manager with the default current time zone (UTC).

Method Detail

getTimeZone

public TimeZone getTimeZone()
Return the current time zone.

Returns:
Current time zone.

setTimeZone

public void setTimeZone(TimeZone timeZone)
Set new current time zone and update listeners.

Parameters:
timeZone - New current time zone.

addTimeZoneListener

public void addTimeZoneListener(TimeZoneListener timeZoneListener)
Add a time zone listener.

Parameters:
timeZoneListener - Listener to add.

removeTimeZoneListener

public void removeTimeZoneListener(TimeZoneListener timeZoneListener)
Remove time zone listener.

Parameters:
timeZoneListener - Listener to remove.

GeoSoft API

Copyright © 2004 - Geotechnical Software Services     geosoft.no