com.miginfocom.util.dates
Class TimeSpanListEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.miginfocom.util.dates.TimeSpanListEvent
All Implemented Interfaces:
java.io.Serializable

public class TimeSpanListEvent
extends java.util.EventObject

An event that has information abount changes of date ranges.

See Also:
Serialized Form

Field Summary
static int ADDED
          One or more time spans was added but usually not as a result of a direct creation.
static int ADDED_CREATED
          One or more time spans was added as a result of creation.
static int EXCHANGED
          A time span was exchanged for another one.
static int REMOVED
          One or more time spans was removed but usually not as a result of a direct deletion.
static int REMOVED_DELETED
          One or more time spans was removed as a result of deletion.
static int SILENT
          No event notifications should be sent.
static int STRUCTURE_CHANGE
          The structure was changed in an undefined way.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TimeSpanListEvent(TimeSpanList list, int type, TimeSpan[] timeSpans)
          Constructor.
TimeSpanListEvent(TimeSpanList list, int type, TimeSpan[] timeSpans, DateRangeI affectedDateRange)
          Constructor for when the date range affected is alread known or should be something other that the unioned date range of the affected time spans.
 
Method Summary
 java.lang.Object getSource()
          Returns the source at which the event happened.
 DateRangeI getSpannedDateRange()
          Returns a shared date range of the unioned range of the affected time spans.
 TimeSpanList getTimeSpanList()
          Returns The list that was affected.
 TimeSpan[] getTimeSpans()
          Returns a shared list of affected time spans.
 int getType()
          Returns the type, E.g.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SILENT

public static final int SILENT
No event notifications should be sent.

See Also:
Constant Field Values

ADDED

public static final int ADDED
One or more time spans was added but usually not as a result of a direct creation. It might be added from another source where it was created (for instance).

See Also:
Constant Field Values

REMOVED

public static final int REMOVED
One or more time spans was removed but usually not as a result of a direct deletion. If might be removed because it no longer was needed in memory (for instance).

See Also:
Constant Field Values

EXCHANGED

public static final int EXCHANGED
A time span was exchanged for another one.

See Also:
Constant Field Values

ADDED_CREATED

public static final int ADDED_CREATED
One or more time spans was added as a result of creation. The creation part might for instance hint synchronizing tools that they should add this to their database (for instance).

See Also:
Constant Field Values

REMOVED_DELETED

public static final int REMOVED_DELETED
One or more time spans was removed as a result of deletion. The deletion part might for instance hint synchronizing tools that they should remove this from their database.

See Also:
Constant Field Values

STRUCTURE_CHANGE

public static final int STRUCTURE_CHANGE
The structure was changed in an undefined way. This can for instance mean that a node has changed to another parent.

See Also:
Constant Field Values
Constructor Detail

TimeSpanListEvent

public TimeSpanListEvent(TimeSpanList list,
                         int type,
                         TimeSpan[] timeSpans)
Constructor.

Parameters:
list - The list that was affected.
type - The type, E.g. REMOVED.
timeSpans - The time spans that was affected.
See Also:
DateRange.getImmutable()

TimeSpanListEvent

public TimeSpanListEvent(TimeSpanList list,
                         int type,
                         TimeSpan[] timeSpans,
                         DateRangeI affectedDateRange)
Constructor for when the date range affected is alread known or should be something other that the unioned date range of the affected time spans.

Parameters:
list - The list that was affected.
type - The type, E.g. REMOVED.
timeSpans - The time spans that was affected.
See Also:
DateRange.getImmutable()
Method Detail

getSource

public final java.lang.Object getSource()
Returns the source at which the event happened.

Overrides:
getSource in class java.util.EventObject
Returns:
The source at which the event happened.

getTimeSpanList

public final TimeSpanList getTimeSpanList()
Returns The list that was affected.

Returns:
The list that was affected.

getType

public final int getType()
Returns the type, E.g. ADDED. As a contract between the producer and reciever of the event and can assume any value.

Returns:
The type, E.g. REMOVED. As a contract between the producer and reciever of the event and can assume any value.

getTimeSpans

public TimeSpan[] getTimeSpans()
Returns a shared list of affected time spans. Note that they are the actual time spans and can for intance be of individual types of for instance Activity.

Returns:
A shared list of affected time spans. Never null.

getSpannedDateRange

public DateRangeI getSpannedDateRange()
Returns a shared date range of the unioned range of the affected time spans. Only calclated once, when this method is first called. Cached after that.

The date range might be the date range of the sole time span in the range. This is since cloning date ranges (since thay contains Calendar objects) is expensive.<

Do not change the returned DateRangeI.

Not that if the added time span is a recurring Activity only the base date range is considered. The recurrencey instances will NOT be included. The added/remover of such an activity must send a manual change event for this.

Returns:
The total range spanned by the affected time spans. If there was no time spans affected will be null.
See Also:
ActivityDepository.fireDepositoryChanged(com.miginfocom.calendar.activity.Activity, Object, int)

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.