Class Day

java.lang.Object
org.cesilko.rachota.core.Day
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class Day extends Object implements PropertyChangeListener
Day with plan of tasks.
  • Constructor Details

    • Day

      public Day(Vector tasks, Date date, Date startTime, Date finishTime)
      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

      public void setTasks(Vector tasks)
      Sets tasks of day.
      Parameters:
      tasks - Tasks of day.
    • getTasks

      public Vector getTasks()
      Returns tasks planned for day.
      Returns:
      Tasks planned for day.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds new listener to set of objects interested in this day.
      Parameters:
      listener - Object interested in this day.
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Adds new listener to set of objects interested in this day.
      Parameters:
      listener - Object interested in this day.
    • addTask

      public void addTask(Task task)
      Adds new task to plan of day.
      Parameters:
      task - New task to be added.
    • removeTask

      public void removeTask(Task task)
      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

      public Task getTask(String description)
      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

      public Task 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

      public void setDate(Date date)
      Sets identification of day.
      Parameters:
      date - Identification of day.
    • getDate

      public Date getDate()
      Returns identification of day.
      Returns:
      Identification of day.
    • setStartTime

      public void setStartTime(Date startTime)
      Sets start time of day.
      Parameters:
      startTime - Start time of day.
    • getStartTime

      public Date getStartTime()
      Returns start time of day.
      Returns:
      Start time of day.
    • setFinishTime

      public void setFinishTime(Date finishTime)
      Sets finish time of day.
      Parameters:
      finishTime - Finish time of day.
    • getFinishTime

      public Date 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_PRIORITY
      ascendingOrder - Sorting order. If true, tasks will be sorted in ascending order.
    • write

      public void write(PrintStream stream) throws IOException
      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

      public String toString()
      Returns textual representation of day's date e.g. 11/25 or 25.11.
      Overrides:
      toString in class Object
      Returns:
      Tex representation of days' date.
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Method called when some property of task was changed.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      evt - Event describing what was changed.