Module com.flexganttfx.model
Package com.flexganttfx.model.activity
Class CompletableActivityBase<T>
- java.lang.Object
-
- com.flexganttfx.model.activity.ActivityBase<T>
-
- com.flexganttfx.model.activity.CompletableActivityBase<T>
-
- Type Parameters:
T
- the type of the optional user object
- All Implemented Interfaces:
Activity
,CompletableActivity
- Direct Known Subclasses:
MutableCompletableActivityBase
public class CompletableActivityBase<T> extends ActivityBase<T> implements CompletableActivity
The base implementation of a completable activity, which stores a "percentage complete" value between 0 and 100%. Renderers often fill the background of activity bars depending on this value. The higher the value the more of the background gets filled.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected double
percentageComplete
-
Fields inherited from class com.flexganttfx.model.activity.ActivityBase
DEFAULT_DURATION, endTime, id, name, startTime, userObject
-
-
Constructor Summary
Constructors Constructor Description CompletableActivityBase()
Constructs a new activity.CompletableActivityBase(String name)
Constructs a new activity with the given name.CompletableActivityBase(String name, Instant startTime, Instant endTime)
Constructs a new activity with the given name, start time, and end time.CompletableActivityBase(Instant startTime, Instant endTime)
Constructs a new activity with the start time and end time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getPercentageComplete()
Returns the "percentage complete" value of the activity.String
toString()
-
Methods inherited from class com.flexganttfx.model.activity.ActivityBase
getEndTime, getId, getName, getStartTime, getUserObject, setUserObject
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.flexganttfx.model.Activity
getEndTime, getId, getName, getStartTime
-
-
-
-
Constructor Detail
-
CompletableActivityBase
public CompletableActivityBase()
Constructs a new activity. The initial start time will be set toInstant.now()
and the end time will be equal toInstant.now()
plus the value ofActivityBase.DEFAULT_DURATION
.- Since:
- 1.0
-
CompletableActivityBase
public CompletableActivityBase(String name)
Constructs a new activity with the given name. The initial start time will be set toInstant.now()
and the end time will be equal toInstant.now()
plus the value ofActivityBase.DEFAULT_DURATION
.- Parameters:
name
- the name of the activity- Since:
- 1.0
-
CompletableActivityBase
public CompletableActivityBase(Instant startTime, Instant endTime)
Constructs a new activity with the start time and end time.- Parameters:
startTime
- the start time of the activityendTime
- the end time of the activity- Since:
- 1.0
-
CompletableActivityBase
public CompletableActivityBase(String name, Instant startTime, Instant endTime)
Constructs a new activity with the given name, start time, and end time.- Parameters:
name
- the name of the activitystartTime
- the start time of the activityendTime
- the end time of the activity- Since:
- 1.0
-
-
Method Detail
-
getPercentageComplete
public double getPercentageComplete()
Description copied from interface:CompletableActivity
Returns the "percentage complete" value of the activity. Must be a value between 0 and 100%.- Specified by:
getPercentageComplete
in interfaceCompletableActivity
- Returns:
- the percentage complete value [0, 100];
-
toString
public String toString()
- Overrides:
toString
in classActivityBase<T>
-
-