Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class GanttTask

  1. Object
  2. GanttTask

A task in a project: a piece of work, a milestone, or a summary of the tasks under it.

A task with children is a summary, and its dates are the span of its children. A task with no children and no duration is a milestone. For any other, duration is working time in the project’s WorkCalendar, and ProjectScheduler works out start and end from the dependencies, the constraint and the leveling delay. A task that is scheduled manually keeps the dates it was given.

Add a task to a ProjectModel before using it; the model owns the tree.

Nested types

enum GanttTask.ConstraintA limit on when a task may be scheduled, on top of its dependencies.

Constructors

public GanttTask(String id, String name)
public GanttTask(String id, String name, long duration)A task of duration milliseconds of working time.

Methods

public String getId()
public String getName()
public GanttTask setName(String v)
public GanttTask getParent()
public List<GanttTask> getChildren()
public boolean isSummary()
public boolean isMilestone()
public int getLevel()How deep the task is in the tree; a top level task is at 0.
public boolean isDescendantOf(GanttTask other)Whether other is this task’s parent, or its parent’s, and so on.
public long getDuration()Working time the task takes, in milliseconds.
public GanttTask setDuration(long millis)
public long getStart()
public long getEnd()
public GanttTask setDates(long start, long end)Sets the dates directly.
public int getPercentComplete()0 to 100.
public GanttTask setPercentComplete(int v)
public GanttTask.Constraint getConstraint()
public long getConstraintDate()
public GanttTask setConstraint(GanttTask.Constraint type, long date)
public boolean isManuallyScheduled()Whether the task keeps the dates it was given instead of being moved by its dependencies.
public GanttTask setManuallyScheduled(boolean v)
public long getLevelingDelay()Working time the task is held back by after its dependencies would let it start.
public GanttTask setLevelingDelay(long millis)
public int getPriority()0 to 1000; when two tasks want the same resource the higher keeps its dates.
public GanttTask setPriority(int v)
public boolean hasBaseline()
public long getBaselineStart()
public long getBaselineEnd()
public GanttTask setBaseline(long start, long end)Records the dates the task was planned at, to compare with later.
public GanttTask clearBaseline()
public List<ResourceAssignment> getAssignments()
public GanttTask assign(String resourceId)Assigns a resource full time.
public GanttTask assign(String resourceId, float units)Assigns units of a resource: 0.5f is half of somebody’s time.
public GanttTask unassign(String resourceId)
public float getUnits(String resourceId)The units of a resource the task uses, 0 when it is not assigned.
public int getColor()An RGB colour for the bar, or -1 for the theme’s.
public GanttTask setColor(int v)
public String getUIID()The UIID the bar is drawn with in place of GanttBar, or null.
public GanttTask setUIID(String v)
public Object getUserObject()
public GanttTask setUserObject(Object v)
public long getEarlyStart()The earliest the task can start, from the last scheduling pass.
public long getEarlyFinish()
public long getLateStart()The latest the task can start without delaying the project.
public long getLateFinish()
public long getTotalSlack()Working time the task can slip by without delaying the project.
public long getFreeSlack()Working time the task can slip by without delaying any successor.
public boolean isCritical()Whether the task is on the critical path: any slip delays the project.
public boolean isConstraintViolated()Whether the dependencies pushed the task past a “no later than” constraint, or a “must” constraint pulled it ahead of a predecessor.
public String toString()Returns a string representation of the object.

Inherited methods

Constructor details

GanttTask

public GanttTask(String id, String name)

GanttTask

public GanttTask(String id, String name, long duration)
A task of duration milliseconds of working time.

Method details

getId

public String getId()

getName

public String getName()

setName

public GanttTask setName(String v)

getParent

public GanttTask getParent()

getChildren

public List<GanttTask> getChildren()

isSummary

public boolean isSummary()

isMilestone

public boolean isMilestone()

getLevel

public int getLevel()
How deep the task is in the tree; a top level task is at 0.

isDescendantOf

public boolean isDescendantOf(GanttTask other)
Whether other is this task’s parent, or its parent’s, and so on.

getDuration

public long getDuration()
Working time the task takes, in milliseconds. Ignored for a summary.

setDuration

public GanttTask setDuration(long millis)

getStart

public long getStart()

getEnd

public long getEnd()

setDates

public GanttTask setDates(long start, long end)
Sets the dates directly. The scheduler overwrites them unless the task is scheduled manually.

getPercentComplete

public int getPercentComplete()
0 to 100.

setPercentComplete

public GanttTask setPercentComplete(int v)

getConstraint

public GanttTask.Constraint getConstraint()

getConstraintDate

public long getConstraintDate()

setConstraint

public GanttTask setConstraint(GanttTask.Constraint type, long date)

isManuallyScheduled

public boolean isManuallyScheduled()
Whether the task keeps the dates it was given instead of being moved by its dependencies. Its successors still follow it.

setManuallyScheduled

public GanttTask setManuallyScheduled(boolean v)

getLevelingDelay

public long getLevelingDelay()
Working time the task is held back by after its dependencies would let it start. ResourceLeveler sets it; zero undoes leveling.

setLevelingDelay

public GanttTask setLevelingDelay(long millis)

getPriority

public int getPriority()
0 to 1000; when two tasks want the same resource the higher keeps its dates. 1000 is never delayed by leveling.

setPriority

public GanttTask setPriority(int v)

hasBaseline

public boolean hasBaseline()

getBaselineStart

public long getBaselineStart()

getBaselineEnd

public long getBaselineEnd()

setBaseline

public GanttTask setBaseline(long start, long end)
Records the dates the task was planned at, to compare with later.

clearBaseline

public GanttTask clearBaseline()

getAssignments

public List<ResourceAssignment> getAssignments()

assign

public GanttTask assign(String resourceId)
Assigns a resource full time.

assign

public GanttTask assign(String resourceId, float units)
Assigns units of a resource: 0.5f is half of somebody’s time.

unassign

public GanttTask unassign(String resourceId)

getUnits

public float getUnits(String resourceId)
The units of a resource the task uses, 0 when it is not assigned.

getColor

public int getColor()
An RGB colour for the bar, or -1 for the theme’s.

setColor

public GanttTask setColor(int v)

getUIID

public String getUIID()
The UIID the bar is drawn with in place of GanttBar, or null.

setUIID

public GanttTask setUIID(String v)

getUserObject

public Object getUserObject()

setUserObject

public GanttTask setUserObject(Object v)

getEarlyStart

public long getEarlyStart()
The earliest the task can start, from the last scheduling pass.

getEarlyFinish

public long getEarlyFinish()

getLateStart

public long getLateStart()
The latest the task can start without delaying the project.

getLateFinish

public long getLateFinish()

getTotalSlack

public long getTotalSlack()
Working time the task can slip by without delaying the project. Negative when a constraint or a deadline cannot be met.

getFreeSlack

public long getFreeSlack()
Working time the task can slip by without delaying any successor.

isCritical

public boolean isCritical()
Whether the task is on the critical path: any slip delays the project.

isConstraintViolated

public boolean isConstraintViolated()
Whether the dependencies pushed the task past a “no later than” constraint, or a “must” constraint pulled it ahead of a predecessor.

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())