Package org.cesilko.rachota.core
Class Day
java.lang.Object
org.cesilko.rachota.core.Day
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
Day with plan of tasks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds new listener to set of objects interested in this day.void
Adds new task to plan of day.boolean
existsMorePriorityTask
(int priority) Checks if there is some unfinished task in plan with higher priority.getDate()
Returns identification of day.Returns finish time of day.Returns idle task of the day.Returns start time of day.Returns task with given description or null if such does not exist.getTasks()
Returns tasks planned for day.long
getTotalTime
(boolean includePrivateTasks) Get total time spent on tasks without idle time.boolean
Returns if day was modified or not since it was created.void
Method called when some property of task was changed.void
Removes all not started regular tasks from plan of day.void
Adds new listener to set of objects interested in this day.void
removeTask
(Task task) Removes given task from plan of day.void
Sets identification of day.void
setFinishTime
(Date finishTime) Sets finish time of day.void
setStartTime
(Date startTime) Sets start time of day.void
Sets tasks of day.void
sortTasks
(int attribute, boolean ascendingOrder) Sort tasks by given attribute and sorting order.toString()
Returns textual representation of day's date e.g.void
write
(PrintStream stream) Write day to given writer.
-
Constructor Details
-
Day
Creates a new instance of day.- Parameters:
tasks
- Vector of tasks planned for day.date
- Identification of day.startTime
- Time when first task was started.finishTime
- Last time when some task was worked on.
-
-
Method Details
-
setTasks
Sets tasks of day.- Parameters:
tasks
- Tasks of day.
-
getTasks
Returns tasks planned for day.- Returns:
- Tasks planned for day.
-
addPropertyChangeListener
Adds new listener to set of objects interested in this day.- Parameters:
listener
- Object interested in this day.
-
removePropertyChangeListener
Adds new listener to set of objects interested in this day.- Parameters:
listener
- Object interested in this day.
-
addTask
Adds new task to plan of day.- Parameters:
task
- New task to be added.
-
removeTask
Removes given task from plan of day.- Parameters:
task
- Task to be removed from plan.
-
removeNotStartedRegularTasks
public void removeNotStartedRegularTasks()Removes all not started regular tasks from plan of day. -
getTask
Returns task with given description or null if such does not exist.- Parameters:
description
- Description of task to be searched for.- Returns:
- Task with given description or null otherwise.
-
getIdleTask
Returns idle task of the day. -
existsMorePriorityTask
public boolean existsMorePriorityTask(int priority) Checks if there is some unfinished task in plan with higher priority.- Parameters:
priority
- Priority to be compared with.- Returns:
- True if plan contains at least one task with higher priority than given one, else false.
-
setDate
Sets identification of day.- Parameters:
date
- Identification of day.
-
getDate
Returns identification of day.- Returns:
- Identification of day.
-
setStartTime
Sets start time of day.- Parameters:
startTime
- Start time of day.
-
getStartTime
Returns start time of day.- Returns:
- Start time of day.
-
setFinishTime
Sets finish time of day.- Parameters:
finishTime
- Finish time of day.
-
getFinishTime
Returns finish time of day.- Returns:
- Finish time of day.
-
isModified
public boolean isModified()Returns if day was modified or not since it was created.- Returns:
- True if some task was added, removed or start or finish times were changed.
-
getTotalTime
public long getTotalTime(boolean includePrivateTasks) Get total time spent on tasks without idle time.- Parameters:
includePrivateTasks
- If true, also time spent on private tasks will be calculated.- Returns:
- Total time spent on tasks in milliseconds.
-
sortTasks
public void sortTasks(int attribute, boolean ascendingOrder) Sort tasks by given attribute and sorting order.- Parameters:
attribute
- Attribute used for sorting tasks e.g. DayTableModel.TASK_PRIORITYascendingOrder
- Sorting order. If true, tasks will be sorted in ascending order.
-
write
Write day to given writer.- Parameters:
stream
- Print stream where day will be written.- Throws:
IOException
- Input/Output exception thrown whenever any problem while writing day occurs.
-
toString
Returns textual representation of day's date e.g. 11/25 or 25.11. -
propertyChange
Method called when some property of task was changed.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
evt
- Event describing what was changed.
-