Class 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.PropertyChangeListener
    Panel 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
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private float categorization
      Usage of categories across tasks.
      private ComparisonChart comparisonChart
      Comparison chart showing average weekly usage times
      private float effectivity
      How much user is effective in using his working hours.
      private float granularity
      How much time an average task take.
      private javax.swing.JLabel lbCategorization  
      private javax.swing.JLabel lbCategorizationResult  
      private javax.swing.JLabel lbEffectivity  
      private javax.swing.JLabel lbEffectivityResult  
      private javax.swing.JLabel lbGranularity  
      private javax.swing.JLabel lbGranularityResult  
      private javax.swing.JLabel lbPrioritization  
      private javax.swing.JLabel lbPrioritizationResult  
      private javax.swing.JLabel lbRepetition  
      private javax.swing.JLabel lbRepetitionResult  
      private javax.swing.JLabel lbStatusing  
      private javax.swing.JLabel lbStatusingResult  
      private javax.swing.JPanel pnAnalysis  
      private javax.swing.JPanel pnChart  
      private javax.swing.JPanel pnSuggestions  
      private javax.swing.JPanel pnTimeUsage  
      private float prioritization
      Distribution of priorities across tasks.
      private javax.swing.JRadioButton rbAllTime  
      private javax.swing.JRadioButton rbMonth  
      private javax.swing.JRadioButton rbWeek  
      private float repetition
      Clever usage of regular tasks.
      static int SCALE_PAST_MONTH
      Index of past month scale
      static int SCALE_PAST_WEEK
      Index of past week scale
      static int SCALE_WHOLE_TIME
      Index of whole time scale
      private javax.swing.JScrollPane spSuggestions  
      private float statusing
      Usage of all statuses.
      private javax.swing.JTextPane tpSuggestions  
      private java.lang.String usageTimesAll
      Usage times downloaded from Rachota Analytics server in format: totalTime|idleTime|privateTime
      private java.lang.String usageTimesUser
      Usage 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
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • 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 float countCategorization​(int scale)
      Counts usage of categories across tasks in given period.
      private float countEffectivity​(int scale)
      Counts how much user is effective in using his/her working hours in given period.
      private float countGranularity​(int scale)
      In given period counts distribution of tasks durations in selected shares intervals and compares it to normal distribution.
      private float countPrioritization​(int scale)
      Counts distribution of priorities across tasks in given period.
      private float countRepetition​(int scale)
      Verifies clever usage of regular tasks in given period.
      private float countStatusing​(int scale)
      Counts usage of DONE status in given period.
      private void countUserTimes​(int scale)
      Computes total, idle and private times of current user in given time scale.
      private boolean downloadTimesAll()
      Tries to download usage times from Rachota Analytics server and reports success or failure.
      private void formMouseMoved​(java.awt.event.MouseEvent evt)  
      java.awt.Font getFont()
      Returns font that should be used for all widgets in this component based on the language preferences specified by user.
      private javax.swing.ImageIcon getIcon​(int ranking)
      Returns image with appropriate number of highlighted stars based on given ranking.
      private long getIdleTimeAll()
      Returns idle time of all Rachota users worldwide in milliseconds.
      private long getIdleTimeUser()
      Returns idle time of current Rachota user in milliseconds.
      private long getPrivateTimeAll()
      Returns private time of all Rachota users worldwide in milliseconds.
      private long getPrivateTimeUser()
      Returns private time of current Rachota user in milliseconds.
      private java.lang.String getSuggestions()
      Returns compiled summary of all suitable suggestions.
      private long getTotalTimeAll()
      Returns total working time of all Rachota users worldwide in milliseconds.
      private long getTotalTimeUser()
      Returns total working time of current Rachota user in milliseconds.
      java.lang.String getWeeklyAnalysis()
      Returns all efficiency factors as a text separated by | character.
      private void initComponents()
      This method is called from within the constructor to initialize the form.
      void propertyChange​(java.beans.PropertyChangeEvent evt)
      Method called when some setting has changed.
      private void rbAllTimeActionPerformed​(java.awt.event.ActionEvent evt)
      Method called when All time radio button was clicked.
      private void rbMonthActionPerformed​(java.awt.event.ActionEvent evt)
      Method called when Last month radio button was clicked.
      private void rbWeekActionPerformed​(java.awt.event.ActionEvent evt)
      Method called when Last week radio button was clicked.
      private void updateAnalysis​(int scale)
      Updates all efficiency factors in selected time scale.
      private void updateCategorization​(int scale)
      Counts categorization factor in given period and updates users star ranking.
      void updateChart()
      Downloads working times of other users and updates comparison chart.
      private void updateEffectivity​(int scale)
      Counts effectivity factor in given period and updates users star ranking.
      private void updateGranularity​(int scale)
      Counts granularity factor in given period and updates users star ranking.
      private void updatePrioritization​(int scale)
      Counts prioritization factor in given period and updates users star ranking.
      private void updateRepetition​(int scale)
      Counts repetition factor in given period and updates users star ranking.
      private void updateStatusing​(int scale)
      Counts statusing factor in given period and updates users star ranking.
      private void updateSuggestions()
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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?
    • Constructor Detail

      • AnalyticsView

        public AnalyticsView()
        Creates new HistoryView panel charts and table.
    • 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:
        getFont in interface java.awt.MenuContainer
        Overrides:
        getFont in class java.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:
        propertyChange in interface java.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.