public class Task extends java.lang.Object implements ClockListener
Modifier and Type | Field and Description |
---|---|
static int |
PRIORITY_HIGH
High level of task priority.
|
static int |
PRIORITY_LOW
Low level of task priority.
|
static int |
PRIORITY_MEDIUM
Medium level of task priority.
|
static int |
STATE_DONE
State representing already finished task.
|
static int |
STATE_NEW
State representing not started task.
|
static int |
STATE_STARTED
State representing already started task.
|
Constructor and Description |
---|
Task(java.lang.String description,
java.lang.String keyword,
java.lang.String notes,
int priority,
int state,
long duration,
java.util.Date notificationTime,
boolean automaticStart,
boolean privateTask)
Creates a new instance of Task
|
Modifier and Type | Method and Description |
---|---|
void |
addDuration(long duration)
Adds time in ms that was additionally spent on task.
|
void |
addNote(java.lang.String note,
boolean recordTime)
Appends a timestamp and given note to notes of this task.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds new listener to set of objects interested in this task.
|
boolean |
automaticStart()
Returns whether system should switch to task automatically.
|
Task |
cloneTask()
Returns clone of itself with time set to 0, empty notes and state set to STATE_NEW.
|
Task |
compare(Task task,
int attribute,
boolean ascendingOrder)
Compare attributes with given task and return the one which is greater/smaller according to sorting order.
|
java.lang.String |
getDescription()
Returns description of this task.
|
long |
getDuration()
Returns time in ms that was already spent on task.
|
java.lang.String |
getKeyword()
Returns keyword of this task.
|
java.util.Iterator |
getKeywordIterator()
Returns keywords of this task.
|
java.lang.String |
getNotes()
Returns notes of this task.
|
java.util.Date |
getNotificationTime()
Returns time when system should warn about task or null if no warning is required.
|
int |
getPriority()
Returns priority of this task.
|
static java.lang.String |
getPriority(int priority)
Returns priority of this task.
|
int |
getState()
Returns state of this task.
|
static java.lang.String |
getState(int state)
Returns state of this task.
|
boolean |
isIdleTask()
Returns false meaning that the task does not measure idle time.
|
boolean |
isRunning()
Returns whether task is being worked on or not.
|
boolean |
privateTask()
Returns whether this task is private.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds new listener to set of objects interested in this task.
|
void |
setAutomaticStart(boolean automaticStart)
Sets whether system should switch to task automatically.
|
void |
setDescription(java.lang.String description)
Sets description of this task.
|
void |
setDuration(long duration)
Sets time in ms that was already spent on task.
|
void |
setKeyword(java.lang.String keyword)
Sets keyword of this task.
|
void |
setNotes(java.lang.String notes)
Sets notes of this task.
|
void |
setNotificationTime(java.util.Date notificationTime)
Sets notification time when system should warn about task.
|
void |
setPriority(int priority)
Sets priority of this task.
|
void |
setPrivateTask(boolean privateTask)
Sets whether this task is private or not.
|
void |
setState(int state)
Sets state of this task.
|
void |
startWork()
Method called when user starts to work on task.
|
void |
suspendWork()
Method called when user temporarily stops to work on task.
|
void |
tick()
Method called by clock after one tick.
|
java.lang.String |
toString()
Return textual representation of task.
|
void |
workDone()
Method called when user finished to work on task.
|
void |
write(java.io.PrintStream stream)
Writes task to given writer.
|
void |
writeRepetition(java.io.PrintStream stream)
Writes information about repetition of task.
|
public static int STATE_NEW
public static int STATE_STARTED
public static int STATE_DONE
public static int PRIORITY_HIGH
public static int PRIORITY_MEDIUM
public static int PRIORITY_LOW
public Task(java.lang.String description, java.lang.String keyword, java.lang.String notes, int priority, int state, long duration, java.util.Date notificationTime, boolean automaticStart, boolean privateTask)
description
- Description of task.keyword
- Arbitrary text for grouping tasks etc.notes
- Any kind of additional information about task.priority
- Priority of task.state
- State of progress of task.duration
- Time in ms that was already spent on task.notificationTime
- Time when system should warn about task.automaticStart
- Should system switch to task automatically ?privateTask
- Is this task private ?public void setDescription(java.lang.String description)
description
- Description of task.public java.lang.String getDescription()
public void setKeyword(java.lang.String keyword)
keyword
- Keyword of task.public java.lang.String getKeyword()
public java.util.Iterator getKeywordIterator()
public void setNotes(java.lang.String notes)
notes
- Notes of task.public java.lang.String getNotes()
public void addNote(java.lang.String note, boolean recordTime)
note
- Note to be appended.recordTime
- If true, timestamp will be inserted before the note.public void setPriority(int priority)
priority
- Priority of task.public int getPriority()
public static java.lang.String getPriority(int priority)
priority
- Priority of task as number.public void setState(int state)
state
- State of task.public int getState()
public static java.lang.String getState(int state)
state
- State of task as number.public void setDuration(long duration)
duration
- Time in ms that was already spent on task.public void addDuration(long duration)
duration
- Time in ms that was additionally spent on task.public long getDuration()
public void setNotificationTime(java.util.Date notificationTime)
notificationTime
- Time when system should warn about task.public java.util.Date getNotificationTime()
public void setAutomaticStart(boolean automaticStart)
automaticStart
- Should system switch to task automatically ?public boolean automaticStart()
public void setPrivateTask(boolean privateTask)
privateTask
- Is this private task or not ?public boolean privateTask()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- Object interested in this task.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- Object interested in this task.public void write(java.io.PrintStream stream) throws java.io.IOException
stream
- Print stream where task will be written.java.io.IOException
- Input/output exception thrown when some error during writing basic task information occurs.public void writeRepetition(java.io.PrintStream stream) throws java.io.IOException
stream
- Print stream where task will be written.java.io.IOException
- Input/output exception thrown when some error during writing repetition information occurs.public void startWork()
public void suspendWork()
public void workDone()
public boolean isRunning()
public void tick()
tick
in interface ClockListener
public Task compare(Task task, int attribute, boolean ascendingOrder)
task
- Task to be compared with.attribute
- Property of task to be compared e.g. DayTableModel.TASK_PRIORITY.ascendingOrder
- If true smaller task will be returned.public Task cloneTask()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isIdleTask()