java.lang.Object
com.flexganttfx.model.ActivityLink<A>
- Type Parameters:
A
- the type of the two activities being linked together
- All Implemented Interfaces:
Activity
public class ActivityLink<A extends Activity> extends Object implements Activity
An activity link can be used to model any kind of dependency between two
activities. In project planning applications a link would express a
predecessor / successor relationship between two tasks, for example
"task A must be finished before task B can begin". In other domains a link
might simply express that two or more activities need to be scheduled
together and that moving one of them requires all others to be moved, too.
- Since:
- 1.0
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ActivityLink.LinkType
An enumerator listing the available link types. -
Constructor Summary
Constructors Constructor Description ActivityLink(ActivityRef<A> sourceRef, ActivityRef<A> targetRef)
Constructs a new activity link with typeActivityLink.LinkType.END_TO_START
.ActivityLink(ActivityRef<A> sourceRef, ActivityRef<A> targetRef, ActivityLink.LinkType type)
Constructs a new activity link. -
Method Summary
Modifier and Type Method Description Instant
getEndTime()
The end time of the activity.String
getId()
The unique id of the activity.String
getName()
The name of the activity, for example "Flight 3441".ActivityRef<A>
getSourceActivityRef()
Returns the activity reference pointing to the source activity of the link.Instant
getStartTime()
The start time of the activity.ActivityRef<A>
getTargetActivityRef()
Returns the activity reference pointing to the target activity of the link.ActivityLink.LinkType
getType()
Returns the link type (S-S, S-E, E-S, E-E).Object
getUserObject()
Returns the (optional) user object of the activity link.void
setSourceActivityRef(ActivityRef<A> ref)
Sets the activity reference pointing to the source activity of the link.void
setTargetActivityRef(ActivityRef<A> ref)
Sets the activity reference pointing to the target activity of the link.void
setType(ActivityLink.LinkType type)
Sets the link type (S-S, S-E, E-S, E-E).void
setUserObject(Object userObject)
An optional user object that might be useful for creating a custom renderer.
-
Constructor Details
-
ActivityLink
public ActivityLink(ActivityRef<A> sourceRef, ActivityRef<A> targetRef, ActivityLink.LinkType type)Constructs a new activity link.- Parameters:
sourceRef
- an activity reference pointing to the link sourcetargetRef
- an activity reference pointing to the link targettype
- the type of the link (E-S, S-E, S-S, E-E)- Since:
- 1.0
-
ActivityLink
Constructs a new activity link with typeActivityLink.LinkType.END_TO_START
.- Parameters:
sourceRef
- an activity reference pointing to the link sourcetargetRef
- an activity reference pointing to the link target- Since:
- 1.0
-
-
Method Details
-
setSourceActivityRef
Sets the activity reference pointing to the source activity of the link.- Parameters:
ref
- the source activity reference- Since:
- 1.0
-
getSourceActivityRef
Returns the activity reference pointing to the source activity of the link.- Returns:
- the source activity reference
- Since:
- 1.0
-
setTargetActivityRef
Sets the activity reference pointing to the target activity of the link.- Parameters:
ref
- the target activity reference- Since:
- 1.0
-
getTargetActivityRef
Returns the activity reference pointing to the target activity of the link.- Returns:
- the target activity reference
- Since:
- 1.0
-
getType
Returns the link type (S-S, S-E, E-S, E-E).- Returns:
- the link type
- Since:
- 1.0
-
setType
Sets the link type (S-S, S-E, E-S, E-E).- Parameters:
type
- the link type- Since:
- 1.0
-
getName
Description copied from interface:Activity
The name of the activity, for example "Flight 3441". -
getId
Description copied from interface:Activity
The unique id of the activity. -
getStartTime
Description copied from interface:Activity
The start time of the activity.- Specified by:
getStartTime
in interfaceActivity
- Returns:
- the activity start time
-
getEndTime
Description copied from interface:Activity
The end time of the activity.- Specified by:
getEndTime
in interfaceActivity
- Returns:
- the activity end time
-
setUserObject
An optional user object that might be useful for creating a custom renderer.- Parameters:
userObject
- an optional user object
-
getUserObject
Returns the (optional) user object of the activity link.- Returns:
- the optional user object
-