Class ProjectModel
A project: a tree of tasks, the links between them, the resources they use and the calendar their durations are measured in.
Building or editing a project is two steps. The methods that change it
(addTask, link, a setter on a task) only change it; update then
schedules the whole project and tells the listeners, so a hundred edits
cost one pass:
ProjectModel p = new ProjectModel();
GanttTask design = new GanttTask("design", "Design", 3 * p.getCalendar().getMillisPerDay());
GanttTask build = new GanttTask("build", "Build", 5 * p.getCalendar().getMillisPerDay());
p.addTask(design).addTask(build);
p.link(design, build);
p.update();
-
Constructor Summary
ConstructorsConstructorDescriptionA project that starts today, on the default working week.ProjectModel(WorkCalendar calendar, long start) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a top level task.Adds a task at a position amongparent's children; -1 is the end, and a null parent is the top level.Adds a task underparent, which becomes a summary.booleanWhether a link frompredecessortosuccessoris possible: they are two tasks of this project, neither is inside the other, they are not linked already, and the link would not close a loop.Records every task's current dates as its baseline.Removes every leveling delay.booleanWhether a task is in this project's tree.voidTells the listeners without scheduling, for a change that moves no date, such as a name.longA task with this much total slack or less is critical.getDependency(GanttTask predecessor, GanttTask successor) The link from one task to another, or null.longWhen the last task finishes, from the last scheduling pass.getPredecessors(GanttTask task) The links that end attask.getResource(String id) longgetStart()The earliest any task is scheduled.getSuccessors(GanttTask task) The links that start attask.getTasks()Every task, a parent before its children, in the order of the outline.Links two tasks finish to start.link(GanttTask predecessor, GanttTask successor, TaskDependency.Type type, long lag) Links two tasks.booleanMoves a task, with everything under it, to another place in the tree.voidremoveTask(GanttTask task) Removes a task, everything under it, and every link to any of them.setCriticalSlack(long millis) setStart(long millis) voidupdate()Schedules the project and tells the listeners.
-
Constructor Details
-
ProjectModel
public ProjectModel()A project that starts today, on the default working week. -
ProjectModel
-
-
Method Details
-
getCalendar
-
setCalendar
-
getStart
public long getStart()The earliest any task is scheduled. -
setStart
-
getFinish
public long getFinish()When the last task finishes, from the last scheduling pass. -
getCriticalSlack
public long getCriticalSlack()A task with this much total slack or less is critical. Zero by default; a day makes the tasks that are nearly critical stand out too. -
setCriticalSlack
-
addTask
Adds a top level task. -
addTask
Adds a task underparent, which becomes a summary. -
addTask
Adds a task at a position among
parent's children; -1 is the end, and a null parent is the top level. A task that is in the project already is moved. A task belongs to one project: one that is a task of another is to be removed from that project first, withremoveTask, which also drops the links that project has to it.Throws
IllegalArgumentException: when the task would go under itself, when the parent is not in this project, or when its links would then run in a loop through the summary
-
contains
Whether a task is in this project's tree. -
moveTask
-
removeTask
Removes a task, everything under it, and every link to any of them. -
getRootTasks
-
getTasks
-
getTask
-
link
Links two tasks finish to start. -
link
public TaskDependency link(GanttTask predecessor, GanttTask successor, TaskDependency.Type type, long lag) Links two tasks.
A link whose successor is a summary holds the start of every task under it, whatever its type: a summary's finish is the result of its children and cannot be held by itself.
Throws
IllegalArgumentException: whencanLinksays no
-
canLink
-
unlink
-
getDependencies
-
getDependency
The link from one task to another, or null. -
getPredecessors
The links that end attask. -
getSuccessors
The links that start attask. -
addResource
-
removeResource
-
getResources
-
getResource
-
captureBaseline
Records every task's current dates as its baseline. -
clearLeveling
Removes every leveling delay. Callupdateafter it. -
update
public void update()Schedules the project and tells the listeners. Call it after a change, or after a group of them. -
addChangeListener
-
removeChangeListener
-
fireChanged
public void fireChanged()Tells the listeners without scheduling, for a change that moves no date, such as a name.
-