org.swiftgantt.model
Class Task

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.swiftgantt.model.BaseTask<Task>
          extended by org.swiftgantt.model.Task
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, PredecessorChangeListener

public final class Task
extends BaseTask<Task>
implements PredecessorChangeListener

A Task is an object that represent a task in project, it is task node in the tasks tree.
PropertyChangeEvent event raised after:
task start time changed, task end time changed, task progress changed.

Version:
1.0
Author:
Yuxing Wang
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
Task()
           
Task(java.lang.String name, java.lang.String description, org.swiftgantt.common.Time startTime, org.swiftgantt.common.Time endTime, int progress, java.util.List<Task> predecessors)
           
Task(java.lang.String name, org.swiftgantt.common.Time startTime, org.swiftgantt.common.Time endTime)
           
Task(java.lang.String name, org.swiftgantt.common.Time startTime, org.swiftgantt.common.Time endTime, int progress)
           
Task(java.lang.String name, org.swiftgantt.common.Time startTime, org.swiftgantt.common.Time endTime, java.util.List<Task> predecessors)
           
 
Method Summary
 void adjustActualTimesByPredecessor()
          Adjust actual start and end time by it's latest predecessor.
 int calcProgressSteps()
          Calculate displaying progress steps by task progress.
 int calcTaskSteps()
          Calculate how many steps for this task in Gantt chart.
 void copy(Task sourceTask)
          Copy content from given source task
 org.swiftgantt.common.Time getActualEnd()
          Get actual end time of this task.
 org.swiftgantt.common.Time getActualStart()
          Get actual start time of this task.
 int getDuration()
          Get duration of this Task, exclude the rest-out time.
 Task getEarliestSubTask()
          Get the sub-task, who has the earliest end time, in the sub-task tree.
 Task getEarliestTask()
          Get the sub-task, who has the earliest end time, in the sub-task tree include myself.
 org.swiftgantt.common.Time getEnd()
          Get end time of this Task.
 Task getLatestSubTask()
          Get the last task, who has the latest end time, in the sub task tree.
 Task getLatestTask()
          Get the last task, who has the latest end time, in the sub task tree include myself.
 int getProgress()
          Get progress of this Task.
 org.swiftgantt.common.Time getStart()
          Get start time of this Task.
 void predecessorChanged(PredecessorChangeEvent e)
          Handler the predecessor changes event.
 void setEnd(java.util.Calendar end)
          Set end time of this Task.
 void setEnd(org.swiftgantt.common.Time end)
          Set end time of this Task.
 void setProgress(int progress)
          Set progress of this Task.
 void setStart(java.util.Calendar start)
          Set start time of this Task.
 void setStart(org.swiftgantt.common.Time start)
          Set start time of this Task.
 java.lang.String toSimpleString()
          Task name, actual start and end time.
 java.lang.String toString()
          The detail information for this Task.
 
Methods inherited from class org.swiftgantt.model.BaseTask
add, add, addPredecessor, addPredecessorChangeListener, addPropertyChangeListener, getBackcolor, getChildren, getDescription, getId, getLevel, getName, getPredecessors, getTasksCount, removePredecessorChangeListener, removePropertyChangeListener, setBackcolor, setDescription, setId, setName
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Task

public Task()

Task

public Task(java.lang.String name,
            org.swiftgantt.common.Time startTime,
            org.swiftgantt.common.Time endTime)

Task

public Task(java.lang.String name,
            org.swiftgantt.common.Time startTime,
            org.swiftgantt.common.Time endTime,
            int progress)

Task

public Task(java.lang.String name,
            org.swiftgantt.common.Time startTime,
            org.swiftgantt.common.Time endTime,
            java.util.List<Task> predecessors)

Task

public Task(java.lang.String name,
            java.lang.String description,
            org.swiftgantt.common.Time startTime,
            org.swiftgantt.common.Time endTime,
            int progress,
            java.util.List<Task> predecessors)
Method Detail

copy

public void copy(Task sourceTask)
Copy content from given source task


getEarliestSubTask

public Task getEarliestSubTask()
Get the sub-task, who has the earliest end time, in the sub-task tree.

Returns:

getEarliestTask

public Task getEarliestTask()
Get the sub-task, who has the earliest end time, in the sub-task tree include myself.

Returns:

getLatestSubTask

public Task getLatestSubTask()
Get the last task, who has the latest end time, in the sub task tree.

Returns:

getLatestTask

public Task getLatestTask()
Get the last task, who has the latest end time, in the sub task tree include myself.

Returns:

calcTaskSteps

public int calcTaskSteps()
Calculate how many steps for this task in Gantt chart.

Parameters:
task -
Returns:

calcProgressSteps

public int calcProgressSteps()
Calculate displaying progress steps by task progress.

Parameters:
start -
progress -
Returns:

getDuration

public int getDuration()
Get duration of this Task, exclude the rest-out time.

Returns:
the duration

getProgress

public int getProgress()
Get progress of this Task. If progress exceeds the task duration, it will be limited within the duration.

Returns:
the progress

setProgress

public void setProgress(int progress)
Set progress of this Task.

Parameters:
progress - the progress to set

getStart

public org.swiftgantt.common.Time getStart()
Get start time of this Task.

Returns:
the start

setStart

public void setStart(java.util.Calendar start)
Set start time of this Task.

Parameters:
start -

setStart

public void setStart(org.swiftgantt.common.Time start)
Set start time of this Task.

Parameters:
start - the start to set
Since:
0.4.0

predecessorChanged

public void predecessorChanged(PredecessorChangeEvent e)
Handler the predecessor changes event.

Specified by:
predecessorChanged in interface PredecessorChangeListener

adjustActualTimesByPredecessor

public void adjustActualTimesByPredecessor()
Adjust actual start and end time by it's latest predecessor.


getActualStart

public org.swiftgantt.common.Time getActualStart()
Get actual start time of this task.

Returns:

getEnd

public org.swiftgantt.common.Time getEnd()
Get end time of this Task.

Returns:
the end
Since:
0.4.0

setEnd

public void setEnd(java.util.Calendar end)
Set end time of this Task.

Parameters:
end -

setEnd

public void setEnd(org.swiftgantt.common.Time end)
Set end time of this Task.

Parameters:
end - The end time of task to set
Since:
0.4.0

getActualEnd

public org.swiftgantt.common.Time getActualEnd()
Get actual end time of this task.

Returns:

toString

public java.lang.String toString()
The detail information for this Task.

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode

toSimpleString

public java.lang.String toSimpleString()
Task name, actual start and end time.

Returns: