com.miginfocom.calendar.activity
Class ActivityDateRangeConstraint

java.lang.Object
  extended by com.miginfocom.calendar.activity.ActivityDateRangeConstraint
All Implemented Interfaces:
ActivityConstraint, java.io.Serializable

public class ActivityDateRangeConstraint
extends java.lang.Object
implements ActivityConstraint, java.io.Serializable

Constrains the target activity's start or end date/time to the source's start or end date/time.

See Also:
Serialized Form

Constructor Summary
ActivityDateRangeConstraint(boolean sourceStart, boolean targetStart)
          Constructor.
 
Method Summary
 void enforce(Activity[] sources, Activity[] targets)
          Do something to the target with the source as a reference.
 boolean getSourceStart()
          Returns true if the source's start date/time is linked.
 boolean getTargetStart()
          Returns true the target's start date/time is linked.
 boolean isValid(Activity[] sources, Activity[] targets)
          If the current constraint is vaild and thus don't need to be enforced.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityDateRangeConstraint

public ActivityDateRangeConstraint(boolean sourceStart,
                                   boolean targetStart)
Constructor.

Parameters:
sourceStart - If true the source's start date/time is linked. If many sources the ealiest one will be used if start and latest for end.
targetStart - If true the target's start date/time is linked.
Method Detail

enforce

public void enforce(Activity[] sources,
                    Activity[] targets)
             throws java.beans.PropertyVetoException
Description copied from interface: ActivityConstraint
Do something to the target with the source as a reference.

Specified by:
enforce in interface ActivityConstraint
Parameters:
sources - The sources. NOTE! Might be null to accomodate for contraints that doesn't need a source.
targets - The target. Never null.
Throws:
java.beans.PropertyVetoException - If the property couldn't be set on target for some reason.

isValid

public boolean isValid(Activity[] sources,
                       Activity[] targets)
Description copied from interface: ActivityConstraint
If the current constraint is vaild and thus don't need to be enforced. Note that a call to ActivityConstraint.enforce(Activity[], Activity[]) does not have to put the constraint in a valid mode since the enforcement could be vetoed due to a number of reasons.

Specified by:
isValid in interface ActivityConstraint
Parameters:
sources - The sources. NOTE! Might be null to accomodate for contraints that doesn't need a source.
targets - The target. Never null.
Returns:
If the current constraint is vaild and thus don't need to be enforced, or rather an enforce would not change the state of anything.

getSourceStart

public boolean getSourceStart()
Returns true if the source's start date/time is linked. If many sources the ealiest one will be used if start and latest for end.

Returns:
true if the source's start date/time is linked.

getTargetStart

public boolean getTargetStart()
Returns true the target's start date/time is linked.

Returns:
true the target's start date/time is linked.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.