com.miginfocom.calendar.activity
Class AbstractActivity

java.lang.Object
  extended by com.miginfocom.calendar.activity.AbstractActivity
All Implemented Interfaces:
Activity, Categorizable, AdjustingPropertyConsumer, TimeSpan, PropertyConsumer, PropertyObservable, PropertyProvider, StateObservable, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Comparable, java.util.EventListener
Direct Known Subclasses:
DefaultActivity

public abstract class AbstractActivity
extends java.lang.Object
implements Activity, java.io.Serializable

Implements a common base line for an Activity.

See Also:
Serialized Form

Field Summary
static PropertyKey BASE_DATE_RANGE
          The base date range for the activity.
static PropertyKey PROP_AFFECTED_DATE_RANGE
          The whole date range that may be affected by this activity.
static PropertyKey PROP_CATEGORY_IDS
          Linked to the value part of the Category's ID.
static PropertyKey PROP_CLIENT_CREATED_MILLIS
          When the client created this.
static PropertyKey PROP_DESCRIPTION
          The description.
static PropertyKey PROP_ENABLED
          If the activity is enabled.
static PropertyKey PROP_ID_OBJECT
          An object that should be used to identify this range, not used internally in this class.
static PropertyKey PROP_LAST_MODIFIED_MILLIS
          When this was last modified.
static PropertyKey PROP_LAYER_INDEX
          The layer in which to layout and paint this activity.
static PropertyKey PROP_LAYOUT_CONTEXT
          An object that is interpreted by the object that will layout this activity or the object that will decide what layout object to use.
static PropertyKey PROP_LOCATION
          The location.
static PropertyKey PROP_PAINT_CONTEXT
          An object that is interpreted by the object that will paint this activity.
static PropertyKey PROP_RECURRENCE
          The recurrence rule for this activity.
static PropertyKey PROP_STORAGE_CREATED_MILLIS
          When the storage (server) actually created this.
static PropertyKey PROP_SUMMARY
          A summary, usually one liner.
 
Fields inherited from interface com.miginfocom.util.states.StateObservable
GROUP_TOGGLE, SPRING, TOGGLE
 
Constructor Summary
protected AbstractActivity(ImmutableDateRange baseRange)
          The base date range to start with.
protected AbstractActivity(java.util.Map props)
          Constructor that will take the PropertyKey->Value map and set it.
 
Method Summary
 void addCategoryID(java.lang.Object catID, int index)
          Adds a category to the category list.
 void addProperties(java.util.Map properties, java.lang.Boolean fireChangeEvent)
          Adds all properties to this activity relplacing any key/value that is already there.
 void addPropertiesSilent(java.util.Map properties, java.lang.Boolean fireChangeEvent)
          Transfer to Activity.setProperties(java.util.Map, Boolean) but should catch the PropertyVetoException.
 void addPropertyListener(java.beans.PropertyChangeListener l)
          Adds a listener that should be notified of all changes that to the property values of this com.miginfocom.theme.
This is usually just implemented as addPropertyListener(l, false)
 void addPropertyListener(java.beans.PropertyChangeListener l, boolean asWeakRef)
          Adds a listener that should be notified of all changes that to the property values of this com.miginfocom.theme
static void addStaticPropertyChangeListener(java.beans.PropertyChangeListener l, boolean asWeakRef)
          Adds a listener that listens on ALL acitivities of the type AbstractActivity and all subclasses.
 void clearLayoutNeededFlag()
          Clears flag.
 int compareTo(java.lang.Object o)
          First compares level index and if not equal then one with the lower index is "less" than the other and this is returned.
Otherwise, if they overlaps the longest is first then they are sorted according to the start time
 boolean containsProperty(PropertyKey property)
          Returns if a property exists.
 java.lang.Object endAdjusting(PropertyKey key)
          Ends the adjusting mode for the key and removed any reference to the old value.
 boolean equals(java.lang.Object o)
          Overridden to compare ID.
protected  void firePropertyChangeEvent(java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)
          Notifies listeners of property changes.
static void fireStaticPropertyChangeEvent(java.beans.PropertyChangeEvent e)
          Notifies listeners of property changes.
 ImmutableDateRange getBaseDateRange()
          Returns the date range that this activity spans, disregarding possible recurrence.
 java.lang.Object[] getCategoryIDs()
          Returns the categories that this object is linked to.
 java.lang.Long getCreatedByStorageDate()
          Returns the creation date (when actually created by the server or storage) in milliseconds (UTC)
 java.lang.Long getCreatedDateByClientDate()
          Returns the creation date (when created by the client) in milliseconds (UTC)
 MutableDateRange getDateRangeClone()
          Returns the date range that the object spans as a clone which is safe to change without chaning the original time span.
 DateRangeI getDateRangeForReading()
          Returns same as Activity.getBaseDateRange()
 java.lang.String getDescription()
          Returns the description of this Activity
 java.lang.Object getID()
          Returns the ID Object that should identify this Activity.
 long getLastModified()
          Returns the last modified date in milliseconds (UTC).
 int getLayerIndex()
          Returns the layer in which to layout and paint this activity.
 java.lang.String getLayoutContext()
          Returns the an optional context interpretable by the object that is to layout this activity.
 java.lang.String getLocation()
          Returns the location of this Activity
 java.lang.String getPaintContext()
          Returns the an optional context interpretable by the object that is to paint this activity.
 java.util.Map getProperties()
          Returns a shallow copy of all properties for this activity.
 java.lang.Object getProperty(PropertyKey property)
          Returns a property for this Activity
static PropertyValidator getPropertyValidator()
          Return the property key validator.
 Recurrence getRecurrence()
          Returns the recurrecy object assiciated with this Activity.
 java.lang.String getSummary()
          Returns a breief summary (on line normally) of this Activity
 MutableDateRange getWritableDateRange()
          Returns the contained date range for editing.
 int hashCode()
          Overridden to return the hashcode for the ID or 0 if no ID.
 boolean isAdjusting(PropertyKey key)
          Returns if the key is currently in "adjustment mode".
 boolean isCategory(java.lang.Object id)
          Returns if id is one of the id:s that this categorizable has.
 boolean isEnabled()
          Retunrns if the Activity is enabled
 boolean isIgnorePropertyEvents()
          Transfer to ListenerSet.isIgnoreEvents()
 boolean isLayoutNeeded()
          Returns whether this activity needs to be layout, normally after changing date range
 boolean isRecurrent()
          Returns if this Activity is happening more than once
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void removeCategoryID(java.lang.Object catID)
          Removes a category from the category list.
 java.lang.Object removeProperty(PropertyKey property)
          Removes a property for this Activity.
 java.lang.Object removeProperty(PropertyKey property, java.lang.Boolean fireChangeEvent)
          Removes the property.
 void removePropertyListener(java.beans.PropertyChangeListener l)
          Removes a listener if it is in the list.
 java.lang.Object removePropertySilent(PropertyKey property, java.lang.Boolean fireChangeEvent)
          Convenience method for PropertyConsumer.removeProperty(com.miginfocom.util.PropertyKey, Boolean) that catches the PropertyVetoException.
static void removeStaticPropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes static the listener.
 java.lang.Object rollbackAdjusting(PropertyKey key)
          Rollbacks the value of the key to the value it has when the AdjustingPropertyConsumer.startAdjusting(com.miginfocom.util.PropertyKey) was called.
 void setBaseDateRange(ImmutableDateRange range)
          Sets the base range.
 void setCategoryIDs(java.lang.Object[] catIDs)
          Sets the IDs of the categories that this activity should belong to or an empty array if none.
protected  void setCreatedByStorageDate(java.lang.Long millis)
          Sets the creation date (when actually created by the server or storage) in milliseconds (UTC).
protected  void setCreatedDateByClientDate(java.lang.Long millis)
          Sets the creation date (when created by the client) in milliseconds (UTC).
 void setDescription(java.lang.String descr)
          Sets the description for this Activity.
 boolean setEnabled(boolean b)
          Sets if the Activity should be enabled.
 void setID(java.lang.Object idObject)
          Set the ID Object that should be tied to this Activity.
 boolean setIgnorePropertyEvents(boolean b)
          Transfer to ListenerSet.setIgnoreEvents(boolean)
 void setLastModified(long millis)
          Sets the last modified to a specific value.
protected  void setLastUpdateMillis()
          Updates the last changed millis to the current millis.
 void setLayerIndex(int ix)
          Sets the layer in which to layout and paint this activity.
 void setLayoutContext(java.lang.String context)
          Sets an optional paint context interpretable by the object that is to layout this activity.
 void setLocation(java.lang.String location)
          Sets the location for this Activity.
 void setPaintContext(java.lang.String context)
          Sets an optional paint context used when painting this activity
 void setProperties(java.util.Map props)
          Sets the properties for this activity bu calling Activity.setPropertiesSilent(java.util.Map, java.lang.Boolean).
 void setProperties(java.util.Map properties, java.lang.Boolean fireChangeEvent)
          Replaces all properties in this activity with properties.
 void setPropertiesSilent(java.util.Map properties, java.lang.Boolean fireChangeEvent)
          Transfer to Activity.setProperties(java.util.Map, Boolean) but should catch the PropertyVetoException.
 java.lang.Object setProperty(PropertyKey property, java.lang.Object value, java.lang.Boolean fireChangeEvent)
          Sets a property for this Activity.
 java.lang.Object setPropertySilent(PropertyKey property, java.lang.Object value, java.lang.Boolean fireChangeEvent)
          Transfer to Activity.setProperty(PropertyKey, Object, Boolean) but should catch the PropertyVetoException.
static void setPropertyValidator(PropertyValidator validator)
          Adds a property key validator that can be used to validate any set and remove of any property in any Activity.
 void setRecurrence(Recurrence rec)
          Sets the recurrecy object assiciated with this Activity.
 void setSummary(java.lang.String summary)
          Sets the summary for this Activity.
 boolean startAdjusting(PropertyKey key)
          Starts a transaction for the key.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.miginfocom.calendar.activity.Activity
getBaseView, getViews, invalidateViews
 
Methods inherited from interface com.miginfocom.util.states.StateObservable
getGroupToggleContext, getHandledStates, getSettableStates, getStates, getStateType, isHandlingStates, isMultiState, setGroupToggleContext
 

Field Detail

PROP_CLIENT_CREATED_MILLIS

public static final PropertyKey PROP_CLIENT_CREATED_MILLIS
When the client created this. Type is Long.


PROP_STORAGE_CREATED_MILLIS

public static final PropertyKey PROP_STORAGE_CREATED_MILLIS
When the storage (server) actually created this. Type is Long.


PROP_LAST_MODIFIED_MILLIS

public static final PropertyKey PROP_LAST_MODIFIED_MILLIS
When this was last modified. Not updated automatically. Type is Long.


PROP_DESCRIPTION

public static final PropertyKey PROP_DESCRIPTION
The description. Type is String.


PROP_LOCATION

public static final PropertyKey PROP_LOCATION
The location. Type is String.


PROP_SUMMARY

public static final PropertyKey PROP_SUMMARY
A summary, usually one liner. Type is String.


PROP_ID_OBJECT

public static final PropertyKey PROP_ID_OBJECT
An object that should be used to identify this range, not used internally in this class.


PROP_ENABLED

public static final PropertyKey PROP_ENABLED
If the activity is enabled. Type is Boolean.


BASE_DATE_RANGE

public static final PropertyKey BASE_DATE_RANGE
The base date range for the activity. Type is ImmutableDateRange.


PROP_AFFECTED_DATE_RANGE

public static final PropertyKey PROP_AFFECTED_DATE_RANGE
The whole date range that may be affected by this activity. If no recurrence it will be the same as BASE_DATE_RANGE, otherwise it will include the whole recurrence range as well. If the recurrence has no stop value, or it can not be calculated in a consistant manner, the end date millis will be Long.MAX_VALUE.

The value will be recaclulated every time BASE_DATE_RANGE or PROP_RECURRENCE is changed but may also be set manually (though it will still be recalculated if the before mentioned properties are changed again).

You should however not listen for changes on only this property since it is silently updated normally. The reason for this is so that not always two events are sent whenever the base range are changed. Base date and recurrrence changes instead.


PROP_PAINT_CONTEXT

public static final PropertyKey PROP_PAINT_CONTEXT
An object that is interpreted by the object that will paint this activity. For instance ImageRenderer checks if there is an URL here and in that case uses this URL to load an Image. Check with the different implementations of ActivityViewRenderer for more detail.

The class type when returned from getProperty(com.miginfocom.util.PropertyKey) should be null or String.

See Also:
ActivityViewRenderer

PROP_LAYOUT_CONTEXT

public static final PropertyKey PROP_LAYOUT_CONTEXT
An object that is interpreted by the object that will layout this activity or the object that will decide what layout object to use.

The class type when returned from getProperty(com.miginfocom.util.PropertyKey) should be null or String.

See Also:
ActivityLayout

PROP_LAYER_INDEX

public static final PropertyKey PROP_LAYER_INDEX
The layer in which to layout and paint this activity. Normally 0-1000. Lower layer indexes will be painted first.

The class type when returned from getProperty(com.miginfocom.util.PropertyKey) should be null or Integer.


PROP_RECURRENCE

public static final PropertyKey PROP_RECURRENCE
The recurrence rule for this activity.


PROP_CATEGORY_IDS

public static final PropertyKey PROP_CATEGORY_IDS
Linked to the value part of the Category's ID.

Constructor Detail

AbstractActivity

protected AbstractActivity(java.util.Map props)
Constructor that will take the PropertyKey->Value map and set it. It must at least contain an ImmutableDateRange for the BASE_DATE_RANGE key.

Parameters:
props - The properties. Not null and must specify the base date range. Will be copied and not stored locally.

AbstractActivity

protected AbstractActivity(ImmutableDateRange baseRange)
The base date range to start with.

Parameters:
baseRange - The date range to span. Not null and must be sorted.
See Also:
DateRangeI.isSorted().
Method Detail

startAdjusting

public boolean startAdjusting(PropertyKey key)
Description copied from interface: AdjustingPropertyConsumer
Starts a transaction for the key. The current value is saved and can be reset by a call to AdjustingPropertyConsumer.rollbackAdjusting(com.miginfocom.util.PropertyKey). The adjusting status end when calling either AdjustingPropertyConsumer.endAdjusting(PropertyKey) or AdjustingPropertyConsumer.rollbackAdjusting(com.miginfocom.util.PropertyKey). If the property is already in "adjustment" mode nothing is done since there is no support for hierarchical transactions.

Specified by:
startAdjusting in interface AdjustingPropertyConsumer
Parameters:
key - The key that should be considered "adjusting". Not null.
Returns:
If the adjustment mode for this key got changed. false if it already was adjusting.

isAdjusting

public boolean isAdjusting(PropertyKey key)
Description copied from interface: AdjustingPropertyConsumer
Returns if the key is currently in "adjustment mode".

Specified by:
isAdjusting in interface AdjustingPropertyConsumer
Parameters:
key - The key to check. Not null.
Returns:
If the key is currently in "adjustment mode".

rollbackAdjusting

public java.lang.Object rollbackAdjusting(PropertyKey key)
Description copied from interface: AdjustingPropertyConsumer
Rollbacks the value of the key to the value it has when the AdjustingPropertyConsumer.startAdjusting(com.miginfocom.util.PropertyKey) was called. If the key is not in "adjustment mode" nothing is done.

Specified by:
rollbackAdjusting in interface AdjustingPropertyConsumer
Parameters:
key - The key to rollback. Not null.
Returns:
The old value that was rolled back to. May be null.

endAdjusting

public java.lang.Object endAdjusting(PropertyKey key)
Description copied from interface: AdjustingPropertyConsumer
Ends the adjusting mode for the key and removed any reference to the old value.

Specified by:
endAdjusting in interface AdjustingPropertyConsumer
Parameters:
key - The key to end adjustment for.
Returns:
The old value.

getBaseDateRange

public ImmutableDateRange getBaseDateRange()
Description copied from interface: Activity
Returns the date range that this activity spans, disregarding possible recurrence. The startDate of this date range is also known as "dtstart" in RFC 2445. Returns the actual contained object.

Specified by:
getBaseDateRange in interface Activity
Returns:
The date range (not cloned) that this activity spans, disregarding possible recurrence. Never null.

setBaseDateRange

public void setBaseDateRange(ImmutableDateRange range)
                      throws java.beans.PropertyVetoException
Sets the base range. For subclasses to change the base date range in a controlled way.

Specified by:
setBaseDateRange in interface Activity
Parameters:
range - The base range, not null.
Throws:
java.beans.PropertyVetoException - If the new date range couldn't be set on this for some reason.

getDateRangeClone

public MutableDateRange getDateRangeClone()
Description copied from interface: TimeSpan
Returns the date range that the object spans as a clone which is safe to change without chaning the original time span. If the range is only to be read from use TimeSpan.getDateRangeForReading() instead to avoid unnecessary object cloning.

Specified by:
getDateRangeClone in interface TimeSpan
Returns:
Returns the date range that the object spans.

getWritableDateRange

public MutableDateRange getWritableDateRange()
Description copied from interface: TimeSpan
Returns the contained date range for editing. If the local date range isn't allowed to be edited an UnsupportedOperationException should be thrown.

Specified by:
getWritableDateRange in interface TimeSpan
Returns:
The contained date range for editing.

getDateRangeForReading

public DateRangeI getDateRangeForReading()
Description copied from interface: Activity
Returns same as Activity.getBaseDateRange()

Specified by:
getDateRangeForReading in interface Activity
Specified by:
getDateRangeForReading in interface TimeSpan
Returns:
Same as Activity.getBaseDateRange()

getCreatedByStorageDate

public java.lang.Long getCreatedByStorageDate()
Description copied from interface: Activity
Returns the creation date (when actually created by the server or storage) in milliseconds (UTC)

Specified by:
getCreatedByStorageDate in interface Activity
Returns:
The creation date (when actually created by the server or storage) in milliseconds (UTC). May be null.

getCategoryIDs

public java.lang.Object[] getCategoryIDs()
Description copied from interface: Categorizable
Returns the categories that this object is linked to.

Specified by:
getCategoryIDs in interface Categorizable
Returns:
The categories that this object is linked to. May be null and with length 0.

setCategoryIDs

public void setCategoryIDs(java.lang.Object[] catIDs)
Description copied from interface: Categorizable
Sets the IDs of the categories that this activity should belong to or an empty array if none. Never null.

Specified by:
setCategoryIDs in interface Categorizable
Parameters:
catIDs - The IDs of the categories that this activity should belong to or an empty array if none. May be null and with length 0.

isCategory

public boolean isCategory(java.lang.Object id)
Description copied from interface: Categorizable
Returns if id is one of the id:s that this categorizable has.

Specified by:
isCategory in interface Categorizable
Parameters:
id - The id to check.
Returns:
If id is one of the id:s that this categorizable has.

addCategoryID

public void addCategoryID(java.lang.Object catID,
                          int index)
Description copied from interface: Categorizable
Adds a category to the category list. If catID already exists for this object, nothing is changed.
Will remake an array every time. I.e. optimized for retrieval of the categories, not insertion.

Specified by:
addCategoryID in interface Categorizable
Parameters:
catID - The ID of the categories that this activity should also belong to. Not null.
index - The index at which to add the category id. It might be important since category IDs earlier in the array will sometimes hide latter ones, such as for category overrides.

index is lenient in the upper range. It is legal to set a very high value (e.g. MigUtil.BIG_INT to be sure it will be added last. 0 will add it first. It should not be negative though.


removeCategoryID

public void removeCategoryID(java.lang.Object catID)
Description copied from interface: Categorizable
Removes a category from the category list. If catID don't exist for this object, nothing is changed.

Will normally remake a new array every time. I.e. optimized for retrieval of the categories, not removal.

Specified by:
removeCategoryID in interface Categorizable
Parameters:
catID - The ID of the categories that this activity should no longer belong to. Not null.

setCreatedByStorageDate

protected void setCreatedByStorageDate(java.lang.Long millis)
                                throws java.beans.PropertyVetoException
Sets the creation date (when actually created by the server or storage) in milliseconds (UTC). Doesn't fire an changed event.

Parameters:
millis - The creation date (when actually created by the server or storage) in milliseconds (UTC). May be null.
Throws:
java.beans.PropertyVetoException

getCreatedDateByClientDate

public java.lang.Long getCreatedDateByClientDate()
Description copied from interface: Activity
Returns the creation date (when created by the client) in milliseconds (UTC)

Specified by:
getCreatedDateByClientDate in interface Activity
Returns:
The creation date (when created by the client) in milliseconds (UTC). May be null.

setCreatedDateByClientDate

protected void setCreatedDateByClientDate(java.lang.Long millis)
                                   throws java.beans.PropertyVetoException
Sets the creation date (when created by the client) in milliseconds (UTC). Doesn't fire an changed event.

Parameters:
millis - The creation date (when created by the client) in milliseconds (UTC). May be null.
Throws:
java.beans.PropertyVetoException

getDescription

public java.lang.String getDescription()
Description copied from interface: Activity
Returns the description of this Activity

Specified by:
getDescription in interface Activity
Returns:
The description of this Activity. May be null.

setDescription

public void setDescription(java.lang.String descr)
Description copied from interface: Activity
Sets the description for this Activity.

This is a convenience for:

setProperty(PROP_DESCRIPTION, descr, null);

And thus will not throw an exception if vetoed.

Specified by:
setDescription in interface Activity
Parameters:
descr - The description for this Activity.

getLocation

public java.lang.String getLocation()
Description copied from interface: Activity
Returns the location of this Activity

Specified by:
getLocation in interface Activity
Returns:
The location of this Activity. May be null.

setLocation

public void setLocation(java.lang.String location)
Description copied from interface: Activity
Sets the location for this Activity.

This is a convenience for:

setProperty(PROP_LOCATION, location, null);

And thus will not throw an exception if vetoed.

Specified by:
setLocation in interface Activity
Parameters:
location - The location for this Activity.

getID

public java.lang.Object getID()
Description copied from interface: Activity
Returns the ID Object that should identify this Activity.

Specified by:
getID in interface Activity
Returns:
The ID object, can be null.

setID

public void setID(java.lang.Object idObject)
Description copied from interface: Activity
Set the ID Object that should be tied to this Activity. Can be used freely but should be used to identyfy this range among others. Must be Serializable for serialization of this whole activity to be possible.

This is a convenience for:

setProperty(PROP_ID_OBJECT, idObject, null);

And thus will not throw an exception if vetoed.

Specified by:
setID in interface Activity
Parameters:
idObject - The ID object, can be null.

getLastModified

public long getLastModified()
Description copied from interface: Activity
Returns the last modified date in milliseconds (UTC). Updated automatically when a property changes.

Specified by:
getLastModified in interface Activity
Returns:
The last modified date in milliseconds (UTC). not null.

setLastModified

public void setLastModified(long millis)
Description copied from interface: Activity
Sets the last modified to a specific value. This should only be made during the setup process of the activity and is handled automatically whenever a property is changed later on.

Specified by:
setLastModified in interface Activity
Parameters:
millis - The millis as standard.

setSummary

public void setSummary(java.lang.String summary)
Description copied from interface: Activity
Sets the summary for this Activity.

This is a convenience for:

setProperty(PROP_SUMMARY, summary, null);

And thus will not throw an exception if vetoed.

Specified by:
setSummary in interface Activity
Parameters:
summary - The summary for this Activity.

getSummary

public java.lang.String getSummary()
Description copied from interface: Activity
Returns a breief summary (on line normally) of this Activity

Specified by:
getSummary in interface Activity
Returns:
A breief summary (on line normally) of this Activity. May be null.

isEnabled

public boolean isEnabled()
Description copied from interface: Activity
Retunrns if the Activity is enabled

Specified by:
isEnabled in interface Activity
Returns:
If the Activity is enabled

setEnabled

public boolean setEnabled(boolean b)
Description copied from interface: Activity
Sets if the Activity should be enabled.

This is a convenience for:

setProperty(PROP_ENABLED, Boolean.FALSE, null);

And thus will not throw an exception if vetoed.

Specified by:
setEnabled in interface Activity
Parameters:
b - true if enabled
Returns:
true if the value was changed

setPropertySilent

public java.lang.Object setPropertySilent(PropertyKey property,
                                          java.lang.Object value,
                                          java.lang.Boolean fireChangeEvent)
Description copied from interface: Activity
Transfer to Activity.setProperty(PropertyKey, Object, Boolean) but should catch the PropertyVetoException. It should not set the property if an exception is thrown and return null.

Specified by:
setPropertySilent in interface Activity
Specified by:
setPropertySilent in interface PropertyConsumer
Parameters:
property - The property key that denotes the property. Not null.
value - The property to set for this object.
fireChangeEvent - If Boolean.TRUE fires a change event. If Boolean.FALSE don't fire and if null the old and new object is checked for equality (with .equals()) and fires a change if they differ.
Returns:
The old object, may be null.

setProperty

public java.lang.Object setProperty(PropertyKey property,
                                    java.lang.Object value,
                                    java.lang.Boolean fireChangeEvent)
                             throws java.beans.PropertyVetoException
Description copied from interface: Activity
Sets a property for this Activity. All other properties in this class is actually stored as propertied, but they have convenience getters/setters and static property names. With this method you can store arbitrary objects in the activity.

Note that if the PropertyKey defines a value class type it should be checked in this setter and an ClassCastException is thrown if prop is of wrong class type. See PropertyKey.getValueClass().

Specified by:
setProperty in interface Activity
Specified by:
setProperty in interface PropertyConsumer
Parameters:
property - The property key that denotes the property. Not null.
value - The property for this Activity.
fireChangeEvent - If Boolean.TRUE fires a change event. If Boolean.FALSE don't fire and if null the old and new object is checked for equality (with .equals()) and fires a change if they differ.
Returns:
The old object, may be null.
Throws:
java.beans.PropertyVetoException - If the property couldn't be set on this for some reason.

setPropertiesSilent

public void setPropertiesSilent(java.util.Map properties,
                                java.lang.Boolean fireChangeEvent)
Description copied from interface: Activity
Transfer to Activity.setProperties(java.util.Map, Boolean) but should catch the PropertyVetoException. It should not set the property if an exception is thrown.

Specified by:
setPropertiesSilent in interface Activity

setProperties

public void setProperties(java.util.Map properties,
                          java.lang.Boolean fireChangeEvent)
                   throws java.beans.PropertyVetoException
Description copied from interface: Activity
Replaces all properties in this activity with properties. properties must at least contain enough information to make the activity valid.

Note that if the PropertyKeys defines a value class type it should be checked in this method and an ClassCastException is thrown if a value is of the wrong class type. See PropertyKey.getValueClass().

The Property change event will contain a null property name and null for both old and new values.

Specified by:
setProperties in interface Activity
Parameters:
properties - The properties to set. Not null. Keys must be PropertyKeys.
fireChangeEvent - If Boolean.TRUE fires a change event. If Boolean.FALSE don't fire and if null the old and new object is checked for equality (with .equals()) and fires a change if they differ.
Throws:
java.beans.PropertyVetoException

addPropertiesSilent

public void addPropertiesSilent(java.util.Map properties,
                                java.lang.Boolean fireChangeEvent)
Description copied from interface: Activity
Transfer to Activity.setProperties(java.util.Map, Boolean) but should catch the PropertyVetoException. It should not set the property if an exception is thrown.

Specified by:
addPropertiesSilent in interface Activity

addProperties

public void addProperties(java.util.Map properties,
                          java.lang.Boolean fireChangeEvent)
                   throws java.beans.PropertyVetoException
Description copied from interface: Activity
Adds all properties to this activity relplacing any key/value that is already there.

Note that if the PropertyKeys defines a value class type it should be checked in this method and an ClassCastException is thrown if a value is of the wrong class type. See PropertyKey.getValueClass().

The Property change event will contain a null property name and null for both old and new values.

Specified by:
addProperties in interface Activity
Parameters:
properties - The properties to add. Not null. Keys must be PropertyKeys.
fireChangeEvent - If Boolean.TRUE fires a change event. If Boolean.FALSE don't fire and if null the old and new object is checked for equality (with .equals()) and fires a change if they differ.
Throws:
java.beans.PropertyVetoException

getProperty

public java.lang.Object getProperty(PropertyKey property)
Description copied from interface: Activity
Returns a property for this Activity

Specified by:
getProperty in interface Activity
Specified by:
getProperty in interface PropertyProvider
Parameters:
property - The property key to return the property for.
Returns:
The property. Can be null.

getProperties

public java.util.Map getProperties()
Description copied from interface: Activity
Returns a shallow copy of all properties for this activity.

Specified by:
getProperties in interface Activity
Returns:
A shallow copy of all properties for this activity.

setProperties

public void setProperties(java.util.Map props)
Description copied from interface: Activity
Sets the properties for this activity bu calling Activity.setPropertiesSilent(java.util.Map, java.lang.Boolean). This extra methis of for making this class a bean.

Specified by:
setProperties in interface Activity
Parameters:
props - Must contain a map from PropertyKey to the properties.

removeProperty

public java.lang.Object removeProperty(PropertyKey property)
Description copied from interface: Activity
Removes a property for this Activity. If property isn't set, the method returnes null.

Fires a change event if the key currently exists.

Specified by:
removeProperty in interface Activity
Parameters:
property - The property key that denotes the property.
Returns:
The removed property. Can be null.

removeProperty

public java.lang.Object removeProperty(PropertyKey property,
                                       java.lang.Boolean fireChangeEvent)
                                throws java.beans.PropertyVetoException
Description copied from interface: PropertyConsumer
Removes the property.

Specified by:
removeProperty in interface PropertyConsumer
Parameters:
property - The property key that denotes the property. Not null.
fireChangeEvent - If Boolean.TRUE fires a change event. If Boolean.FALSE don't fire and if null fires a change if the key existed before this call.
Returns:
The Old object. null both is null was stored or if the key did not exist in the provider.
Throws:
java.beans.PropertyVetoException - If the property couldn't be set on this for some reason.

removePropertySilent

public java.lang.Object removePropertySilent(PropertyKey property,
                                             java.lang.Boolean fireChangeEvent)
Description copied from interface: PropertyConsumer
Convenience method for PropertyConsumer.removeProperty(com.miginfocom.util.PropertyKey, Boolean) that catches the PropertyVetoException.

It is required that this method is implemented in the PropertyConsumer.setProperty(com.miginfocom.util.PropertyKey, Object, Boolean).

Specified by:
removePropertySilent in interface PropertyConsumer
Parameters:
property - The property key that denotes the property. Not null.
fireChangeEvent - If Boolean.TRUE fires a change event. If Boolean.FALSE don't fire and if null fires a change if the key existed before this call.
Returns:
The Old object. null both is null was stored or if the key did not exist in the provider.

containsProperty

public boolean containsProperty(PropertyKey property)
Description copied from interface: Activity
Returns if a property exists.

Specified by:
containsProperty in interface Activity
Specified by:
containsProperty in interface PropertyProvider
Parameters:
property - The property key that denotes the property.
Returns:
If the property exits

setLastUpdateMillis

protected void setLastUpdateMillis()
Updates the last changed millis to the current millis.


compareTo

public int compareTo(java.lang.Object o)
First compares level index and if not equal then one with the lower index is "less" than the other and this is returned.
Otherwise, if they overlaps the longest is first then they are sorted according to the start time

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The other Activity to compare to. Not null.
Returns:
<   0 if less, > 0 if more or 0 if same.

isLayoutNeeded

public boolean isLayoutNeeded()
Description copied from interface: Activity
Returns whether this activity needs to be layout, normally after changing date range

Specified by:
isLayoutNeeded in interface Activity
Returns:
true if so.

clearLayoutNeededFlag

public void clearLayoutNeededFlag()
Description copied from interface: Activity
Clears flag. Normally when layout of this activity is done.

Specified by:
clearLayoutNeededFlag in interface Activity

setRecurrence

public void setRecurrence(Recurrence rec)
Description copied from interface: Activity
Sets the recurrecy object assiciated with this Activity.

Specified by:
setRecurrence in interface Activity
Parameters:
rec - The recurrecy object or null if this Activity should have not recurrence.

getRecurrence

public Recurrence getRecurrence()
Description copied from interface: Activity
Returns the recurrecy object assiciated with this Activity.

Specified by:
getRecurrence in interface Activity
Returns:
The recurrecy object or null if this Activity has not recurrence.

isRecurrent

public boolean isRecurrent()
Description copied from interface: Activity
Returns if this Activity is happening more than once

Specified by:
isRecurrent in interface Activity
Returns:
if this Activity is happening more than once

getPaintContext

public java.lang.String getPaintContext()
Description copied from interface: Activity
Returns the an optional context interpretable by the object that is to paint this activity.

Specified by:
getPaintContext in interface Activity
Returns:
An optional context for the object that is to paint this activity.. null by default
See Also:
ActivityViewRenderer

setPaintContext

public void setPaintContext(java.lang.String context)
Description copied from interface: Activity
Sets an optional paint context used when painting this activity

Specified by:
setPaintContext in interface Activity
Parameters:
context - The optional paint context used when painting this activity. Can be null for default behaviour.

getLayoutContext

public java.lang.String getLayoutContext()
Description copied from interface: Activity
Returns the an optional context interpretable by the object that is to layout this activity.

Specified by:
getLayoutContext in interface Activity
Returns:
An optional context for the object that is to paint this activity.. null by default
See Also:
ActivityViewRenderer

setLayoutContext

public void setLayoutContext(java.lang.String context)
Description copied from interface: Activity
Sets an optional paint context interpretable by the object that is to layout this activity.

Specified by:
setLayoutContext in interface Activity
Parameters:
context - The optional paint context interpretable by the object that is to layout this activity. Can be null for default behaviour.

getLayerIndex

public int getLayerIndex()
Description copied from interface: Activity
Returns the layer in which to layout and paint this activity. Normally 0-1000. Lower layer indexes will be painted first.

Specified by:
getLayerIndex in interface Activity
Returns:
The layer in which to layout and paint this activity.

setLayerIndex

public void setLayerIndex(int ix)
Description copied from interface: Activity
Sets the layer in which to layout and paint this activity. Normally 0-1000. Lower layer indexes will be painted first.

Specified by:
setLayerIndex in interface Activity
Parameters:
ix - The layer in which to layout and paint this activity.

hashCode

public int hashCode()
Overridden to return the hashcode for the ID or 0 if no ID. ID should always be uniqe in a collection.

Overrides: