com.miginfocom.calendar.activity
Class ActivityLink

java.lang.Object
  extended by com.miginfocom.calendar.activity.ActivityLink
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public class ActivityLink
extends java.lang.Object
implements java.beans.PropertyChangeListener, java.io.Serializable

Links to one or many Activitys. Not that the link is to the Activity objects and not to the IDs. So the link have to be recreated if the activity is recreated with the same ID.

See Also:
Serialized Form

Constructor Summary
ActivityLink(Activity[] sources, Activity[] targets, ActivityConstraint constr)
          Constructor.
ActivityLink(Activity[] sources, Activity target, ActivityConstraint constr)
          Constructor.
ActivityLink(Activity source, Activity[] targets, ActivityConstraint constr)
          Constructor.
ActivityLink(Activity source, Activity target, ActivityConstraint constr)
          Constructor.
 
Method Summary
 ActivityLink enforce()
          Manually triggers the line to run the ActivityConstraint's enforce method.
 ActivityConstraint getConstraint()
          Returns the backing constraint.
 boolean getEnabled()
          Returns if the link is enabled or not.
 Activity[] getSources()
          Returns the sources.
 Activity[] getTargets()
          Returns the targets.
 boolean isValid()
          If the current link is vaild and thus don't need to be enforced.
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void setEnabled(boolean b)
          Activates or deactivates the constraints on the linked objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityLink

public ActivityLink(Activity source,
                    Activity target,
                    ActivityConstraint constr)
Constructor.

Parameters:
source - The source activitity. Not null.
target - The target activitity. Not null.
constr - The constraint to enforce from source to target. Not null.

ActivityLink

public ActivityLink(Activity source,
                    Activity[] targets,
                    ActivityConstraint constr)
Constructor.

Parameters:
source - The source activitity. Not null.
targets - The target activities. Not null.
constr - The constraint to enforce from source to target. Not null.

ActivityLink

public ActivityLink(Activity[] sources,
                    Activity target,
                    ActivityConstraint constr)
Constructor.

Parameters:
sources - The source activities. Not null.
target - The target activitity. Not null.
constr - The constraint to enforce from source to target. Not null.

ActivityLink

public ActivityLink(Activity[] sources,
                    Activity[] targets,
                    ActivityConstraint constr)
Constructor.

Parameters:
sources - The source activities. Not null. A property change listener will be installed on the source, as a weak reference.
targets - The target activities. Not null.
constr - The constraint to enforce from source to target.
Method Detail

getSources

public Activity[] getSources()
Returns the sources. Not null and lingth >= 1.

Returns:
The sources. Not null and lingth >= 1. Must not be changed!

getTargets

public Activity[] getTargets()
Returns the targets. Not null and lingth >= 1.

Returns:
The targets. Not null and lingth >= 1. Must not be changed!

getConstraint

public ActivityConstraint getConstraint()
Returns the backing constraint.

Returns:
The backing constraint. Never null.

enforce

public ActivityLink enforce()
Manually triggers the line to run the ActivityConstraint's enforce method. This is done even if the link is not enabled.

Returns:
this for chaining.
See Also:
setEnabled(boolean)

isValid

public boolean isValid()
If the current link is vaild and thus don't need to be enforced. Note that a call to enforce() does not have to put the link in a valid mode since the enforcement could be vetoed due to a number of reasons.

Returns:
If the current link is vaild and thus don't need to be enforced.

setEnabled

public void setEnabled(boolean b)
Activates or deactivates the constraints on the linked objects.

Enabled is default.

Parameters:
b - If enabled.
Since:
6.1.1

getEnabled

public boolean getEnabled()
Returns if the link is enabled or not.

Returns:
If the link is enabled or not.
Since:
6.1.1

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.