Class DayView

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, ClockListener

public class DayView extends JPanel implements ClockListener, PropertyChangeListener
Panel showing tasks planned for one day and manipulation with them.
See Also:
  • Field Details

    • btAdd

      private JButton btAdd
    • btDone

      private JButton btDone
    • btEdit

      private JButton btEdit
    • btNext

      private JButton btNext
    • btNextMonth

      private JButton btNextMonth
    • btNextWeek

      private JButton btNextWeek
    • btPrevious

      private JButton btPrevious
    • btPreviousMonth

      private JButton btPreviousMonth
    • btPreviousWeek

      private JButton btPreviousWeek
    • btRelax

      private JButton btRelax
    • btRemove

      private JButton btRemove
    • btSelect

      private JButton btSelect
    • btWork

      private JButton btWork
    • chbShowFinished

      private JCheckBox chbShowFinished
    • lblDate

      private JLabel lblDate
    • lblEnd

      private JLabel lblEnd
    • lblPlan

      private JLabel lblPlan
    • lblProgress

      private JLabel lblProgress
    • lblStart

      private JLabel lblStart
    • lblTask

      private JLabel lblTask
    • lblWeek

      private JLabel lblWeek
    • pbProgress

      private JProgressBar pbProgress
    • pnButtons

      private JPanel pnButtons
    • pnDayView

      private JPanel pnDayView
    • pnWorkButtons

      private JPanel pnWorkButtons
    • spPlan

      private JScrollPane spPlan
    • tbPlan

      private JTable tbPlan
    • txtDate

      private JTextField txtDate
    • txtEnd

      private JTextField txtEnd
    • txtStart

      private JTextField txtStart
    • txtTask

      private JTextField txtTask
    • txtWeek

      private JTextField txtWeek
    • day

      private Day day
      Day that is actually being displayed.
    • task

      private Task task
      Task that is currently selected and may be started.
    • clickedWhere

      private Point clickedWhere
      Point in the plan table when user clicked last time.
    • clickedWhen

      private Date clickedWhen
      Time when user clicked in the plan table last time.
    • selectButtonEnabled

      private boolean selectButtonEnabled
      Whether Select button is currently enabled or not.
    • warningConfirmed

      private boolean warningConfirmed
      Whether user already confirmed warning about exceeded working hours or not.
  • Constructor Details

    • DayView

      public DayView()
      Creates new DayView panel containing tasks planned for given day.
  • Method Details

    • setupEndTimeMouseListener

      private void setupEndTimeMouseListener(JComponent... components)
    • getFont

      public Font getFont()
      Returns font that should be used for all widgets in this component based on the language preferences specified by user.
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component
      Returns:
      Font to be used in this component.
    • adjustStartTime

      public void adjustStartTime(Frame parent)
      Method called when user wants to adjust day start time.
      Parameters:
      parent - Main window which called this method to set correct location.
    • initComponents

      private void initComponents()
      This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
    • btNextWeekActionPerformed

      private void btNextWeekActionPerformed(ActionEvent evt)
    • btNextMonthActionPerformed

      private void btNextMonthActionPerformed(ActionEvent evt)
    • btPreviousMonthActionPerformed

      private void btPreviousMonthActionPerformed(ActionEvent evt)
    • btPreviousWeekActionPerformed

      private void btPreviousWeekActionPerformed(ActionEvent evt)
    • txtDateMouseClicked

      private void txtDateMouseClicked(MouseEvent evt)
      Method called when date textfield is clicked.
      Parameters:
      evt - Event that invoked the action.
    • btRemoveActionPerformed

      private void btRemoveActionPerformed(ActionEvent evt)
      Method called when remove button is pressed.
      Parameters:
      evt - Event that invoked the action.
    • btEditActionPerformed

      private void btEditActionPerformed(ActionEvent evt)
      Method called when edit button is pressed.
      Parameters:
      evt - Event that invoked the action.
    • btAddActionPerformed

      private void btAddActionPerformed(ActionEvent evt)
      Method called when add button is pressed.
      Parameters:
      evt - Event that invoked the action.
    • btSelectActionPerformed

      private void btSelectActionPerformed(ActionEvent evt)
      Method called when select button is pressed.
      Parameters:
      evt - Event that invoked the action.
    • chbShowFinishedActionPerformed

      private void chbShowFinishedActionPerformed(ActionEvent evt)
      Method called when visibility of finished tasks should be changed.
      Parameters:
      evt - Event that invoked the action.
    • btNextActionPerformed

      private void btNextActionPerformed(ActionEvent evt)
      Method called when next button is pressed.
      Parameters:
      evt - Event that invoked the action.
    • btPreviousActionPerformed

      private void btPreviousActionPerformed(ActionEvent evt)
      Method called when previous button is pressed.
      Parameters:
      evt - Event that invoked the action.
    • tbPlanKeyReleased

      private void tbPlanKeyReleased(KeyEvent evt)
      Method called when any key is released while table of planned tasks has focus.
      Parameters:
      evt - Event that invoked this method call.
    • btDoneActionPerformed

      private void btDoneActionPerformed(ActionEvent evt)
      Method called when Done button is pressed.
      Parameters:
      evt - Event that invoked this action.
    • btRelaxActionPerformed

      private void btRelaxActionPerformed(ActionEvent evt)
      Method called when Relax button is pressed.
      Parameters:
      evt - Event that invoked this action.
    • btWorkActionPerformed

      private void btWorkActionPerformed(ActionEvent evt)
      Method called when Work button is pressed.
      Parameters:
      evt - Event that invoked this action.
    • tbPlanMouseClicked

      private void tbPlanMouseClicked(MouseEvent evt)
      Method called when user clicks to table with tasks plan.
      Parameters:
      evt - Event that invoked this action.
    • spPlanMouseMoved

      private void spPlanMouseMoved(MouseEvent evt)
    • formMouseMoved

      private void formMouseMoved(MouseEvent evt)
    • tbPlanMouseMoved

      private void tbPlanMouseMoved(MouseEvent evt)
    • tbPlanKeyPressed

      private void tbPlanKeyPressed(KeyEvent evt)
    • updateInformation

      private void updateInformation(boolean taskDurationChanged)
      Method called when some information needs to be updated. This means that start and finish times will be updated or information about selected task.
      Parameters:
      taskDurationChanged - If true, only task row will be updated and working hours will be checked. Otherwise whole table gets updated.
    • useEstimatedEnd

      private boolean useEstimatedEnd()
    • getFinishedAtText

      private String getFinishedAtText()
    • getFinishedAtTime

      private String getFinishedAtTime()
    • checkButtons

      private void checkButtons()
      Check availability of buttons according to current state of view.
    • switchDate

      public void switchDate(Frame parent)
      Method called when switch date action is required.
    • moveTime

      public void moveTime(Frame parent)
      Method called when move time action is required.
    • copyTask

      public void copyTask(Frame parent)
      Method called when copy task action is required.
    • correctTaskDuration

      public void correctTaskDuration(Frame parent)
      Method called when correct task duration action is required.
      Parameters:
      parent - Main window which called this method to set correct location.
    • addNote

      public void addNote(Frame parent)
      Method called when add note to task action is required.
      Parameters:
      parent - Main window which called this method to set correct location.
    • setFinishedTasksVisibility

      public void setFinishedTasksVisibility(boolean visibility)
      Set whether finished tasks should be displayed or not.
      Parameters:
      visibility - Should be finished tasks displayed or not ?
    • getTitleSuffix

      public String getTitleSuffix()
      Get suffix to be appended to title of application depending on user preference.
      Returns:
      Title suffix: name of current task and/or total/task time or nothing.
    • loadRunningTask

      private void loadRunningTask()
      Tries to load restarting task and run it.
    • tick

      public void tick()
      Method called when one clock tick is over.
      Specified by:
      tick in interface ClockListener
    • setTask

      public void setTask(Task task, boolean startTask)
      Set description of selected task and start it if required.
      Parameters:
      task - Task to be selected.
      startTask - Whether the task should be started.
    • setDay

      private void setDay(Day newDay)
      Sets day view to given day.
      Parameters:
      newDay - New day to be displayed by day view.
    • getDay

      public Day getDay()
      Returns day that is currently being displayed.
      Returns:
      Day that is currently displayed by day view.
    • getTask

      public Task getTask()
      Returns task that is currently selected.
      Returns:
      Task that is currently selected or null if none is selected.
    • 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.
    • saveSetup

      void saveSetup()
      Saves setup customized by user i.e. selected columns and their widths.
    • loadSetup

      void loadSetup()
      Loads setup customized by user i.e. selected columns and their widths.
    • pauseTask

      public void pauseTask()
      Stops working on currently selected running task.
    • startTask

      public void startTask()
      Starts working on currently selected task.
    • finishTask

      public void finishTask()
      Finishes working on currently selected task.
    • selectTask

      public void selectTask(Task task)
      Sets given task as selected and starts to work on it.
      Parameters:
      task - Task that will be selected and run.
    • switchAfterNight

      private void switchAfterNight()
      Switches day view after or at the mightnight.