Package org.cesilko.rachota.gui
Class DayView
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.cesilko.rachota.gui.DayView
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,ClockListener
public class DayView extends javax.swing.JPanel implements ClockListener, java.beans.PropertyChangeListener
Panel showing tasks planned for one day and manipulation with them.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JButtonbtAddprivate javax.swing.JButtonbtDoneprivate javax.swing.JButtonbtEditprivate javax.swing.JButtonbtNextprivate javax.swing.JButtonbtNextMonthprivate javax.swing.JButtonbtNextWeekprivate javax.swing.JButtonbtPreviousprivate javax.swing.JButtonbtPreviousMonthprivate javax.swing.JButtonbtPreviousWeekprivate javax.swing.JButtonbtRelaxprivate javax.swing.JButtonbtRemoveprivate javax.swing.JButtonbtSelectprivate javax.swing.JButtonbtWorkprivate javax.swing.JCheckBoxchbShowFinishedprivate java.util.DateclickedWhenTime when user clicked in the plan table last time.private java.awt.PointclickedWherePoint in the plan table when user clicked last time.private DaydayDay that is actually being displayed.private javax.swing.JLabellblDateprivate javax.swing.JLabellblEndprivate javax.swing.JLabellblPlanprivate javax.swing.JLabellblProgressprivate javax.swing.JLabellblStartprivate javax.swing.JLabellblTaskprivate javax.swing.JLabellblWeekprivate javax.swing.JProgressBarpbProgressprivate javax.swing.JPanelpnButtonsprivate javax.swing.JPanelpnDayViewprivate javax.swing.JPanelpnWorkButtonsprivate booleanselectButtonEnabledWhether Select button is currently enabled or not.private javax.swing.JScrollPanespPlanprivate TasktaskTask that is currently selected and may be started.private javax.swing.JTabletbPlanprivate javax.swing.JTextFieldtxtDateprivate javax.swing.JTextFieldtxtEndprivate javax.swing.JTextFieldtxtStartprivate javax.swing.JTextFieldtxtTaskprivate javax.swing.JTextFieldtxtWeekprivate booleanwarningConfirmedWhether user already confirmed warning about exceeded working hours or not.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description DayView()Creates new DayView panel containing tasks planned for given day.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNote(java.awt.Frame parent)Method called when add note to task action is required.voidadjustStartTime(java.awt.Frame parent)Method called when user wants to adjust day start time.private voidbtAddActionPerformed(java.awt.event.ActionEvent evt)Method called when add button is pressed.private voidbtDoneActionPerformed(java.awt.event.ActionEvent evt)Method called when Done button is pressed.private voidbtEditActionPerformed(java.awt.event.ActionEvent evt)Method called when edit button is pressed.private voidbtNextActionPerformed(java.awt.event.ActionEvent evt)Method called when next button is pressed.private voidbtNextMonthActionPerformed(java.awt.event.ActionEvent evt)private voidbtNextWeekActionPerformed(java.awt.event.ActionEvent evt)private voidbtPreviousActionPerformed(java.awt.event.ActionEvent evt)Method called when previous button is pressed.private voidbtPreviousMonthActionPerformed(java.awt.event.ActionEvent evt)private voidbtPreviousWeekActionPerformed(java.awt.event.ActionEvent evt)private voidbtRelaxActionPerformed(java.awt.event.ActionEvent evt)Method called when Relax button is pressed.private voidbtRemoveActionPerformed(java.awt.event.ActionEvent evt)Method called when remove button is pressed.private voidbtSelectActionPerformed(java.awt.event.ActionEvent evt)Method called when select button is pressed.private voidbtWorkActionPerformed(java.awt.event.ActionEvent evt)Method called when Work button is pressed.private voidchbShowFinishedActionPerformed(java.awt.event.ActionEvent evt)Method called when visibility of finished tasks should be changed.private voidcheckButtons()Check availability of buttons according to current state of view.voidcopyTask(java.awt.Frame parent)Method called when copy task action is required.voidcorrectTaskDuration(java.awt.Frame parent)Method called when correct task duration action is required.voidfinishTask()Finishes working on currently selected task.private voidformMouseMoved(java.awt.event.MouseEvent evt)DaygetDay()Returns day that is currently being displayed.private java.lang.StringgetFinishedAtText()private java.lang.StringgetFinishedAtTime()java.awt.FontgetFont()Returns font that should be used for all widgets in this component based on the language preferences specified by user.TaskgetTask()Returns task that is currently selected.java.lang.StringgetTitleSuffix()Get suffix to be appended to title of application depending on user preference.private voidinitComponents()This method is called from within the constructor to initialize the form.private voidloadRunningTask()Tries to load restarting task and run it.(package private) voidloadSetup()Loads setup customized by user i.e.voidmoveTime(java.awt.Frame parent)Method called when move time action is required.voidpauseTask()Stops working on currently selected running task.voidpropertyChange(java.beans.PropertyChangeEvent evt)Method called when some property of task was changed.(package private) voidsaveSetup()Saves setup customized by user i.e.voidselectTask(Task task)Sets given task as selected and starts to work on it.private voidsetDay(Day newDay)Sets day view to given day.voidsetFinishedTasksVisibility(boolean visibility)Set whether finished tasks should be displayed or not.voidsetTask(Task task, boolean startTask)Set description of selected task and start it if required.private voidsetupEndTimeMouseListener(javax.swing.JComponent... components)private voidspPlanMouseMoved(java.awt.event.MouseEvent evt)voidstartTask()Starts working on currently selected task.private voidswitchAfterNight()Switches day view after or at the mightnight.voidswitchDate(java.awt.Frame parent)Method called when switch date action is required.private voidtbPlanKeyPressed(java.awt.event.KeyEvent evt)private voidtbPlanKeyReleased(java.awt.event.KeyEvent evt)Method called when any key is released while table of planned tasks has focus.private voidtbPlanMouseClicked(java.awt.event.MouseEvent evt)Method called when user clicks to table with tasks plan.private voidtbPlanMouseMoved(java.awt.event.MouseEvent evt)voidtick()Method called when one clock tick is over.private voidtxtDateMouseClicked(java.awt.event.MouseEvent evt)Method called when date textfield is clicked.private voidupdateInformation(boolean taskDurationChanged)Method called when some information needs to be updated.private booleanuseEstimatedEnd()-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
btAdd
private javax.swing.JButton btAdd
-
btDone
private javax.swing.JButton btDone
-
btEdit
private javax.swing.JButton btEdit
-
btNext
private javax.swing.JButton btNext
-
btNextMonth
private javax.swing.JButton btNextMonth
-
btNextWeek
private javax.swing.JButton btNextWeek
-
btPrevious
private javax.swing.JButton btPrevious
-
btPreviousMonth
private javax.swing.JButton btPreviousMonth
-
btPreviousWeek
private javax.swing.JButton btPreviousWeek
-
btRelax
private javax.swing.JButton btRelax
-
btRemove
private javax.swing.JButton btRemove
-
btSelect
private javax.swing.JButton btSelect
-
btWork
private javax.swing.JButton btWork
-
chbShowFinished
private javax.swing.JCheckBox chbShowFinished
-
lblDate
private javax.swing.JLabel lblDate
-
lblEnd
private javax.swing.JLabel lblEnd
-
lblPlan
private javax.swing.JLabel lblPlan
-
lblProgress
private javax.swing.JLabel lblProgress
-
lblStart
private javax.swing.JLabel lblStart
-
lblTask
private javax.swing.JLabel lblTask
-
lblWeek
private javax.swing.JLabel lblWeek
-
pbProgress
private javax.swing.JProgressBar pbProgress
-
pnButtons
private javax.swing.JPanel pnButtons
-
pnDayView
private javax.swing.JPanel pnDayView
-
pnWorkButtons
private javax.swing.JPanel pnWorkButtons
-
spPlan
private javax.swing.JScrollPane spPlan
-
tbPlan
private javax.swing.JTable tbPlan
-
txtDate
private javax.swing.JTextField txtDate
-
txtEnd
private javax.swing.JTextField txtEnd
-
txtStart
private javax.swing.JTextField txtStart
-
txtTask
private javax.swing.JTextField txtTask
-
txtWeek
private javax.swing.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 java.awt.Point clickedWhere
Point in the plan table when user clicked last time.
-
clickedWhen
private java.util.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.
-
-
Method Detail
-
setupEndTimeMouseListener
private void setupEndTimeMouseListener(javax.swing.JComponent... components)
-
getFont
public java.awt.Font getFont()
Returns font that should be used for all widgets in this component based on the language preferences specified by user.- Specified by:
getFontin interfacejava.awt.MenuContainer- Overrides:
getFontin classjava.awt.Component- Returns:
- Font to be used in this component.
-
adjustStartTime
public void adjustStartTime(java.awt.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(java.awt.event.ActionEvent evt)
-
btNextMonthActionPerformed
private void btNextMonthActionPerformed(java.awt.event.ActionEvent evt)
-
btPreviousMonthActionPerformed
private void btPreviousMonthActionPerformed(java.awt.event.ActionEvent evt)
-
btPreviousWeekActionPerformed
private void btPreviousWeekActionPerformed(java.awt.event.ActionEvent evt)
-
txtDateMouseClicked
private void txtDateMouseClicked(java.awt.event.MouseEvent evt)
Method called when date textfield is clicked.- Parameters:
evt- Event that invoked the action.
-
btRemoveActionPerformed
private void btRemoveActionPerformed(java.awt.event.ActionEvent evt)
Method called when remove button is pressed.- Parameters:
evt- Event that invoked the action.
-
btEditActionPerformed
private void btEditActionPerformed(java.awt.event.ActionEvent evt)
Method called when edit button is pressed.- Parameters:
evt- Event that invoked the action.
-
btAddActionPerformed
private void btAddActionPerformed(java.awt.event.ActionEvent evt)
Method called when add button is pressed.- Parameters:
evt- Event that invoked the action.
-
btSelectActionPerformed
private void btSelectActionPerformed(java.awt.event.ActionEvent evt)
Method called when select button is pressed.- Parameters:
evt- Event that invoked the action.
-
chbShowFinishedActionPerformed
private void chbShowFinishedActionPerformed(java.awt.event.ActionEvent evt)
Method called when visibility of finished tasks should be changed.- Parameters:
evt- Event that invoked the action.
-
btNextActionPerformed
private void btNextActionPerformed(java.awt.event.ActionEvent evt)
Method called when next button is pressed.- Parameters:
evt- Event that invoked the action.
-
btPreviousActionPerformed
private void btPreviousActionPerformed(java.awt.event.ActionEvent evt)
Method called when previous button is pressed.- Parameters:
evt- Event that invoked the action.
-
tbPlanKeyReleased
private void tbPlanKeyReleased(java.awt.event.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(java.awt.event.ActionEvent evt)
Method called when Done button is pressed.- Parameters:
evt- Event that invoked this action.
-
btRelaxActionPerformed
private void btRelaxActionPerformed(java.awt.event.ActionEvent evt)
Method called when Relax button is pressed.- Parameters:
evt- Event that invoked this action.
-
btWorkActionPerformed
private void btWorkActionPerformed(java.awt.event.ActionEvent evt)
Method called when Work button is pressed.- Parameters:
evt- Event that invoked this action.
-
tbPlanMouseClicked
private void tbPlanMouseClicked(java.awt.event.MouseEvent evt)
Method called when user clicks to table with tasks plan.- Parameters:
evt- Event that invoked this action.
-
spPlanMouseMoved
private void spPlanMouseMoved(java.awt.event.MouseEvent evt)
-
formMouseMoved
private void formMouseMoved(java.awt.event.MouseEvent evt)
-
tbPlanMouseMoved
private void tbPlanMouseMoved(java.awt.event.MouseEvent evt)
-
tbPlanKeyPressed
private void tbPlanKeyPressed(java.awt.event.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 java.lang.String getFinishedAtText()
-
getFinishedAtTime
private java.lang.String getFinishedAtTime()
-
checkButtons
private void checkButtons()
Check availability of buttons according to current state of view.
-
switchDate
public void switchDate(java.awt.Frame parent)
Method called when switch date action is required.
-
moveTime
public void moveTime(java.awt.Frame parent)
Method called when move time action is required.
-
copyTask
public void copyTask(java.awt.Frame parent)
Method called when copy task action is required.
-
correctTaskDuration
public void correctTaskDuration(java.awt.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(java.awt.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 java.lang.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:
tickin interfaceClockListener
-
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(java.beans.PropertyChangeEvent evt)
Method called when some property of task was changed.- Specified by:
propertyChangein interfacejava.beans.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.
-
-