Package org.cesilko.rachota.gui
Class AnalyticsView
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.cesilko.rachota.gui.AnalyticsView
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible
public class AnalyticsView extends javax.swing.JPanel implements java.beans.PropertyChangeListenerPanel providing comparison of current user's weekly times with other Rachota users and analytics summary and recommendations.- 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 floatcategorizationUsage of categories across tasks.private ComparisonChartcomparisonChartComparison chart showing average weekly usage timesprivate floateffectivityHow much user is effective in using his working hours.private floatgranularityHow much time an average task take.private javax.swing.JLabellbCategorizationprivate javax.swing.JLabellbCategorizationResultprivate javax.swing.JLabellbEffectivityprivate javax.swing.JLabellbEffectivityResultprivate javax.swing.JLabellbGranularityprivate javax.swing.JLabellbGranularityResultprivate javax.swing.JLabellbPrioritizationprivate javax.swing.JLabellbPrioritizationResultprivate javax.swing.JLabellbRepetitionprivate javax.swing.JLabellbRepetitionResultprivate javax.swing.JLabellbStatusingprivate javax.swing.JLabellbStatusingResultprivate javax.swing.JPanelpnAnalysisprivate javax.swing.JPanelpnChartprivate javax.swing.JPanelpnSuggestionsprivate javax.swing.JPanelpnTimeUsageprivate floatprioritizationDistribution of priorities across tasks.private javax.swing.JRadioButtonrbAllTimeprivate javax.swing.JRadioButtonrbMonthprivate javax.swing.JRadioButtonrbWeekprivate floatrepetitionClever usage of regular tasks.static intSCALE_PAST_MONTHIndex of past month scalestatic intSCALE_PAST_WEEKIndex of past week scalestatic intSCALE_WHOLE_TIMEIndex of whole time scaleprivate javax.swing.JScrollPanespSuggestionsprivate floatstatusingUsage of all statuses.private javax.swing.JTextPanetpSuggestionsprivate java.lang.StringusageTimesAllUsage times downloaded from Rachota Analytics server in format: totalTime|idleTime|privateTimeprivate java.lang.StringusageTimesUserUsage times calculated for user in format: totalTime|idleTime|privateTime-
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 AnalyticsView()Creates new HistoryView panel charts and table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private floatcountCategorization(int scale)Counts usage of categories across tasks in given period.private floatcountEffectivity(int scale)Counts how much user is effective in using his/her working hours in given period.private floatcountGranularity(int scale)In given period counts distribution of tasks durations in selected shares intervals and compares it to normal distribution.private floatcountPrioritization(int scale)Counts distribution of priorities across tasks in given period.private floatcountRepetition(int scale)Verifies clever usage of regular tasks in given period.private floatcountStatusing(int scale)Counts usage of DONE status in given period.private voidcountUserTimes(int scale)Computes total, idle and private times of current user in given time scale.private booleandownloadTimesAll()Tries to download usage times from Rachota Analytics server and reports success or failure.private voidformMouseMoved(java.awt.event.MouseEvent evt)java.awt.FontgetFont()Returns font that should be used for all widgets in this component based on the language preferences specified by user.private javax.swing.ImageIcongetIcon(int ranking)Returns image with appropriate number of highlighted stars based on given ranking.private longgetIdleTimeAll()Returns idle time of all Rachota users worldwide in milliseconds.private longgetIdleTimeUser()Returns idle time of current Rachota user in milliseconds.private longgetPrivateTimeAll()Returns private time of all Rachota users worldwide in milliseconds.private longgetPrivateTimeUser()Returns private time of current Rachota user in milliseconds.private java.lang.StringgetSuggestions()Returns compiled summary of all suitable suggestions.private longgetTotalTimeAll()Returns total working time of all Rachota users worldwide in milliseconds.private longgetTotalTimeUser()Returns total working time of current Rachota user in milliseconds.java.lang.StringgetWeeklyAnalysis()Returns all efficiency factors as a text separated by | character.private voidinitComponents()This method is called from within the constructor to initialize the form.voidpropertyChange(java.beans.PropertyChangeEvent evt)Method called when some setting has changed.private voidrbAllTimeActionPerformed(java.awt.event.ActionEvent evt)Method called when All time radio button was clicked.private voidrbMonthActionPerformed(java.awt.event.ActionEvent evt)Method called when Last month radio button was clicked.private voidrbWeekActionPerformed(java.awt.event.ActionEvent evt)Method called when Last week radio button was clicked.private voidupdateAnalysis(int scale)Updates all efficiency factors in selected time scale.private voidupdateCategorization(int scale)Counts categorization factor in given period and updates users star ranking.voidupdateChart()Downloads working times of other users and updates comparison chart.private voidupdateEffectivity(int scale)Counts effectivity factor in given period and updates users star ranking.private voidupdateGranularity(int scale)Counts granularity factor in given period and updates users star ranking.private voidupdatePrioritization(int scale)Counts prioritization factor in given period and updates users star ranking.private voidupdateRepetition(int scale)Counts repetition factor in given period and updates users star ranking.private voidupdateStatusing(int scale)Counts statusing factor in given period and updates users star ranking.private voidupdateSuggestions()Prepares suggestions and displays them.-
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
-
lbCategorization
private javax.swing.JLabel lbCategorization
-
lbCategorizationResult
private javax.swing.JLabel lbCategorizationResult
-
lbEffectivity
private javax.swing.JLabel lbEffectivity
-
lbEffectivityResult
private javax.swing.JLabel lbEffectivityResult
-
lbGranularity
private javax.swing.JLabel lbGranularity
-
lbGranularityResult
private javax.swing.JLabel lbGranularityResult
-
lbPrioritization
private javax.swing.JLabel lbPrioritization
-
lbPrioritizationResult
private javax.swing.JLabel lbPrioritizationResult
-
lbRepetition
private javax.swing.JLabel lbRepetition
-
lbRepetitionResult
private javax.swing.JLabel lbRepetitionResult
-
lbStatusing
private javax.swing.JLabel lbStatusing
-
lbStatusingResult
private javax.swing.JLabel lbStatusingResult
-
pnAnalysis
private javax.swing.JPanel pnAnalysis
-
pnChart
private javax.swing.JPanel pnChart
-
pnSuggestions
private javax.swing.JPanel pnSuggestions
-
pnTimeUsage
private javax.swing.JPanel pnTimeUsage
-
rbAllTime
private javax.swing.JRadioButton rbAllTime
-
rbMonth
private javax.swing.JRadioButton rbMonth
-
rbWeek
private javax.swing.JRadioButton rbWeek
-
spSuggestions
private javax.swing.JScrollPane spSuggestions
-
tpSuggestions
private javax.swing.JTextPane tpSuggestions
-
SCALE_PAST_WEEK
public static final int SCALE_PAST_WEEK
Index of past week scale- See Also:
- Constant Field Values
-
SCALE_PAST_MONTH
public static final int SCALE_PAST_MONTH
Index of past month scale- See Also:
- Constant Field Values
-
SCALE_WHOLE_TIME
public static final int SCALE_WHOLE_TIME
Index of whole time scale- See Also:
- Constant Field Values
-
usageTimesAll
private java.lang.String usageTimesAll
Usage times downloaded from Rachota Analytics server in format: totalTime|idleTime|privateTime
-
usageTimesUser
private java.lang.String usageTimesUser
Usage times calculated for user in format: totalTime|idleTime|privateTime
-
comparisonChart
private ComparisonChart comparisonChart
Comparison chart showing average weekly usage times
-
effectivity
private float effectivity
How much user is effective in using his working hours. More idle time means less effectivity.
-
granularity
private float granularity
How much time an average task take. Does user create too many or too little tasks?
-
prioritization
private float prioritization
Distribution of priorities across tasks. Does user utilize task priorities enough?
-
categorization
private float categorization
Usage of categories across tasks. Does user specify categories for tasks enough?
-
statusing
private float statusing
Usage of all statuses. Does user close tasks or leaves them open forever?
-
repetition
private float repetition
Clever usage of regular tasks. How many irregular tasks do actually repeat often?
-
-
Method Detail
-
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.
-
countEffectivity
private float countEffectivity(int scale)
Counts how much user is effective in using his/her working hours in given period. More idle time means less effectivity.- Parameters:
scale- One of three possible time scales.- Returns:
- Computed effectivity factor.
-
updateEffectivity
private void updateEffectivity(int scale)
Counts effectivity factor in given period and updates users star ranking.- Parameters:
scale- One of three possible time scales.
-
countCategorization
private float countCategorization(int scale)
Counts usage of categories across tasks in given period. Does user specify categories for tasks enough?- Parameters:
scale- One of three possible time scales.- Returns:
- Computed categorization factor.
-
updateCategorization
private void updateCategorization(int scale)
Counts categorization factor in given period and updates users star ranking.- Parameters:
scale- One of three possible time scales.
-
countGranularity
private float countGranularity(int scale)
In given period counts distribution of tasks durations in selected shares intervals and compares it to normal distribution. Does user create too many or too little tasks?- Parameters:
scale- One of three possible time scales.- Returns:
- Computed granularity factor.
-
updateGranularity
private void updateGranularity(int scale)
Counts granularity factor in given period and updates users star ranking.- Parameters:
scale- One of three possible time scales.
-
countPrioritization
private float countPrioritization(int scale)
Counts distribution of priorities across tasks in given period. Does user utilize task priorities enough?- Parameters:
scale- One of three possible time scales.- Returns:
- Computed prioritization factor.
-
updatePrioritization
private void updatePrioritization(int scale)
Counts prioritization factor in given period and updates users star ranking.- Parameters:
scale- One of three possible time scales.
-
countRepetition
private float countRepetition(int scale)
Verifies clever usage of regular tasks in given period. How many irregular tasks do actually repeat often? And how many regular tasks are useless?- Parameters:
scale- One of three possible time scales.- Returns:
- Computed repetition factor.
-
updateRepetition
private void updateRepetition(int scale)
Counts repetition factor in given period and updates users star ranking.- Parameters:
scale- One of three possible time scales.
-
countStatusing
private float countStatusing(int scale)
Counts usage of DONE status in given period. Does user close tasks or leaves them open forever?- Parameters:
scale- One of three possible time scales.- Returns:
- Computed statusing factor.
-
updateStatusing
private void updateStatusing(int scale)
Counts statusing factor in given period and updates users star ranking.- Parameters:
scale- One of three possible time scales.
-
getIdleTimeAll
private long getIdleTimeAll()
Returns idle time of all Rachota users worldwide in milliseconds.- Returns:
- Time of all Rachota users worldwide spent in idle mode in milliseconds.
-
getPrivateTimeAll
private long getPrivateTimeAll()
Returns private time of all Rachota users worldwide in milliseconds.- Returns:
- Time spent on private tasks of all Rachota users worldwide in milliseconds.
-
getTotalTimeAll
private long getTotalTimeAll()
Returns total working time of all Rachota users worldwide in milliseconds.- Returns:
- Time spent on non-private and non-idle tasks of all Rachota users worldwide in milliseconds.
-
getIdleTimeUser
private long getIdleTimeUser()
Returns idle time of current Rachota user in milliseconds.- Returns:
- Time of current Rachota user spent in idle mode in milliseconds.
-
getPrivateTimeUser
private long getPrivateTimeUser()
Returns private time of current Rachota user in milliseconds.- Returns:
- Time of current Rachota user spent on private tasks in milliseconds.
-
getTotalTimeUser
private long getTotalTimeUser()
Returns total working time of current Rachota user in milliseconds.- Returns:
- Time of current Rachota user spent on working in milliseconds.
-
downloadTimesAll
private boolean downloadTimesAll()
Tries to download usage times from Rachota Analytics server and reports success or failure.- Returns:
- Returns true if usage times were successfully downloaded. If server didn't provide the number due to missing activity report or it couldn't be even contacted false is returned.
-
countUserTimes
private void countUserTimes(int scale)
Computes total, idle and private times of current user in given time scale.- Parameters:
scale- One of three possible time scales: past week, past month or whole time.
-
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.
-
rbAllTimeActionPerformed
private void rbAllTimeActionPerformed(java.awt.event.ActionEvent evt)
Method called when All time radio button was clicked.- Parameters:
evt- Event that invoked the action.
-
rbWeekActionPerformed
private void rbWeekActionPerformed(java.awt.event.ActionEvent evt)
Method called when Last week radio button was clicked.- Parameters:
evt- Event that invoked the action.
-
rbMonthActionPerformed
private void rbMonthActionPerformed(java.awt.event.ActionEvent evt)
Method called when Last month radio button was clicked.- Parameters:
evt- Event that invoked the action.
-
formMouseMoved
private void formMouseMoved(java.awt.event.MouseEvent evt)
-
updateChart
public void updateChart()
Downloads working times of other users and updates comparison chart.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
Method called when some setting has changed.- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Parameters:
evt- Event describing what was changed.
-
updateAnalysis
private void updateAnalysis(int scale)
Updates all efficiency factors in selected time scale.- Parameters:
scale- One of three possible time scales: past week, past month or whole time.
-
getWeeklyAnalysis
public java.lang.String getWeeklyAnalysis()
Returns all efficiency factors as a text separated by | character.- Returns:
- All efficiency factors as a text separated by | character.
-
updateSuggestions
private void updateSuggestions()
Prepares suggestions and displays them.
-
getIcon
private javax.swing.ImageIcon getIcon(int ranking)
Returns image with appropriate number of highlighted stars based on given ranking.- Parameters:
ranking- Number (0-5) specifying required ranking.- Returns:
- Image with appropriate number of highlighted stars.
-
getSuggestions
private java.lang.String getSuggestions()
Returns compiled summary of all suitable suggestions.- Returns:
- Summary of all suitable suggestions based on effectivity of user.
-
-