superwaba.ext.palm.io.builtin
Class Datebook

java.lang.Object
  |
  +--superwaba.ext.palm.io.builtin.Datebook

public class Datebook
extends Object
implements Storable

Provides a link to the standard Palm Datebook database.


Field Summary
static int ALARM_DAYS
           
static int ALARM_HOURS
           
static int ALARM_MINUTES
           
 int alarmAdvance
          The number of alarmUnits before startDate that the alarm should go off, or -1 for no alarm.
 int alarmUnits
          The units of time that the alarm should go off before the start date.
 String description
          A description for this appointment
 Time endTime
          The time this datebook item is to end - date info is ignored.
 Time[] exceptions
          An array of dates in chronological order that the appointment shouldn't repeat on.
protected static int noDateOrTime
          Palm notation for no date or time
 String note
          A note giving extra information
static int REPEAT_DAILY
           
static int REPEAT_MONTHLY_BY_DATE
           
static int REPEAT_MONTHLY_BY_DAY
           
static int REPEAT_NONE
           
static int REPEAT_WEEKLY
           
static int REPEAT_YEARLY
           
 Time repeatEndDate
          The end date for repeating (or null for forever)
 int repeatFrequency
          The interval (in repeatTypes) between repetitions
 int repeatMonthlyCount
          Indicates the number of repeatMonthlyDays into each month this appointment should repeat.
 int repeatMonthlyDay
          Indicates the day of week to repeat.
 int repeatType
          The type of repeat (one of the REPEAT_XXX constants)
 boolean[] repeatWeekdays
          Indicates which days of the week to repeat on.
 boolean repeatWeekStartsOnMonday
          Indicated whether the week display should start with Sunday (false) or Monday (true).
 Time startDate
          The time and date this datebook item is to start
 
Constructor Summary
Datebook()
          Constructs a new empty datebook
 
Method Summary
static boolean addDate(Datebook datebook)
          Adds a new Datebook to the database
static int datebookCount()
          Gets the number of Datebook's in the database
static boolean delDate(int i)
          Deletes a Datebook entry in the database
static int findDatePosition(Datebook d)
          Finds the suitable position for a new datebook entry
static Datebook getDate(int i)
          Gets a Datebook from the database
static boolean getDate(int i, Datebook datebook)
          Gets a Datebook from the database and places it into the given Datebook.
 byte getID()
          Gets a unique ID for this class.
 Storable getInstance()
          Returns an object of the same class as this object.
static int getRepeatRange()
          Gets the first date which is not a repeatable date
static boolean insertDate(Datebook datebook)
          Inserts a new Datebook to the database at the proper position in the dates sort order.
 void loadState(DataStream ds)
          Load state information from the given DataStream into this object If any Storable objects need to be loaded as part of the state, their loadState() method can be called too.
protected  void readDate(int packedDate, Time date)
          Reads date information from a short read from a stream in DateType format
protected  void readTime(int packedTime, Time time)
          Reads time information from a short read from a stream in TimeType format
 void saveState(DataStream ds)
          Send the state information of this object to the given object catalog using the given DataStream.
protected  void writeDate(DataStream ds, Time date)
          Writes the date information to the stream as a Palm DateType
protected  void writeTime(DataStream ds, Time time)
          Writes the time information to the stream as a Palm TimeType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

ALARM_MINUTES

public static final int ALARM_MINUTES

ALARM_HOURS

public static final int ALARM_HOURS

ALARM_DAYS

public static final int ALARM_DAYS

REPEAT_NONE

public static final int REPEAT_NONE

REPEAT_DAILY

public static final int REPEAT_DAILY

REPEAT_WEEKLY

public static final int REPEAT_WEEKLY

REPEAT_MONTHLY_BY_DAY

public static final int REPEAT_MONTHLY_BY_DAY

REPEAT_MONTHLY_BY_DATE

public static final int REPEAT_MONTHLY_BY_DATE

REPEAT_YEARLY

public static final int REPEAT_YEARLY

startDate

public Time startDate
The time and date this datebook item is to start

endTime

public Time endTime
The time this datebook item is to end - date info is ignored. If this value is null, this appointment has no time, regardless of any time information in startDate.

alarmUnits

public int alarmUnits
The units of time that the alarm should go off before the start date. Should be one of ALARM_XXX constants.

alarmAdvance

public int alarmAdvance
The number of alarmUnits before startDate that the alarm should go off, or -1 for no alarm.

repeatType

public int repeatType
The type of repeat (one of the REPEAT_XXX constants)

repeatEndDate

public Time repeatEndDate
The end date for repeating (or null for forever)

repeatFrequency

public int repeatFrequency
The interval (in repeatTypes) between repetitions

repeatMonthlyDay

public int repeatMonthlyDay
Indicates the day of week to repeat. Only applicable when repeatType is REPEAT_MONTHLY_BY_DAY. Should be in the range 0 (Sunday) to 6 (Saturday). This field is used in conjunction with repeatMonthlyCount to represent things like the 3rd Sunday every month by setting repeatMonthlyDay to 0 and repeatMonthlyCount to 3.

repeatMonthlyCount

public int repeatMonthlyCount
Indicates the number of repeatMonthlyDays into each month this appointment should repeat. Only applicable when repeatType is REPEAT_MONTHLY_BY_DAY.

repeatWeekdays

public boolean[] repeatWeekdays
Indicates which days of the week to repeat on. Only applicable when repeatType is REPEAT_WEEKLY. The array holds 7 elements with Sunday at position 0 through to Saturday at position 6. If the value is true, this appointment should appear on that day.

repeatWeekStartsOnMonday

public boolean repeatWeekStartsOnMonday
Indicated whether the week display should start with Sunday (false) or Monday (true). Only applicable with repeatType is REPEAT_WEEKLY and I'm not entirely sure why it's here. It's probably best not to mess with it.

note

public String note
A note giving extra information

exceptions

public Time[] exceptions
An array of dates in chronological order that the appointment shouldn't repeat on. Time information is ignored.

description

public String description
A description for this appointment

noDateOrTime

protected static int noDateOrTime
Palm notation for no date or time
Constructor Detail

Datebook

public Datebook()
Constructs a new empty datebook
Method Detail

datebookCount

public static int datebookCount()
Gets the number of Datebook's in the database
Returns:
the number of datebooks

getDate

public static Datebook getDate(int i)
Gets a Datebook from the database
Parameters:
i - the index to get
Returns:
the retrieved datebook

getDate

public static boolean getDate(int i,
                              Datebook datebook)
Gets a Datebook from the database and places it into the given Datebook. Any previous data in the datebook is erased.
Parameters:
i - the index to get
datebook - the datebook object to place the datebook into.

addDate

public static boolean addDate(Datebook datebook)
Adds a new Datebook to the database
Parameters:
datebook - the datebook to add
Returns:
true if successful, false otherwise

insertDate

public static boolean insertDate(Datebook datebook)
Inserts a new Datebook to the database at the proper position in the dates sort order. (Uses findDatePosition)
Parameters:
datebook - the datebook to add
Returns:
true if successful, false otherwise

getRepeatRange

public static int getRepeatRange()
Gets the first date which is not a repeatable date
Returns:
the index of the last repeating date

findDatePosition

public static int findDatePosition(Datebook d)
Finds the suitable position for a new datebook entry
Parameters:
datebook - the Datebook object
Returns:
the index where to insert as int

delDate

public static boolean delDate(int i)
Deletes a Datebook entry in the database
Parameters:
i - the index to delete
Returns:
true if successful, false otherwise

saveState

public void saveState(DataStream ds)
Send the state information of this object to the given object catalog using the given DataStream. If any Storable objects need to be saved as part of the state, their saveState() method can be called too.
Specified by:
saveState in interface Storable

loadState

public void loadState(DataStream ds)
Load state information from the given DataStream into this object If any Storable objects need to be loaded as part of the state, their loadState() method can be called too.
Specified by:
loadState in interface Storable

getID

public byte getID()
Gets a unique ID for this class. It is up to the user to ensure that the ID of each class of Storable contained in a single ObjectCatalog is unique and the ID of each instance in a class is the same.
Specified by:
getID in interface Storable

getInstance

public Storable getInstance()
Returns an object of the same class as this object.
Specified by:
getInstance in interface Storable
Returns:
a class. Any data is irrelevent.

writeTime

protected void writeTime(DataStream ds,
                         Time time)
Writes the time information to the stream as a Palm TimeType
Parameters:
ds - the stream to write to
time - the time to write (only hour and minutes used)

writeDate

protected void writeDate(DataStream ds,
                         Time date)
Writes the date information to the stream as a Palm DateType
Parameters:
ds - the stream to write to
date - the date to write (only day, month, year used)

readTime

protected void readTime(int packedTime,
                        Time time)
Reads time information from a short read from a stream in TimeType format
Parameters:
packedTime - the packed representation
time - the object to load the information into. (h,m,s,millis set)

readDate

protected void readDate(int packedDate,
                        Time date)
Reads date information from a short read from a stream in DateType format
Parameters:
packedDate - the packed representation
date - the object to load the information into (day,month,year set)