Class Settings


  • public class Settings
    extends java.lang.Object
    Persistent settings of the system.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACTIVITY_NOT_REPORTED
      Activity not yet reported.
      static java.lang.String ACTIVITY_REPORT_FAILED
      Tried to report activity but failed.
      static java.lang.String DAY_WORKING_HOURS
      Static String used to store the daily working hours field.
      private static java.util.logging.Logger logger
      Logger for recording important or erroneous events.
      static java.lang.String ON_EXIT_ASK
      On exit, ask for measuring downtime.
      static java.lang.String ON_EXIT_STOP
      On exit, stop measuring downtime.
      static java.lang.String ON_HIBERNATION_ASK
      Flag to ask user if hibernation was detected.
      static java.lang.String ON_HIBERNATION_IGNORE
      Flag to ignore downtime if hibernation was detected.
      static java.lang.String ON_HIBERNATION_INCLUDE
      Flag to include downtime if hibernation was detected.
      static java.lang.String ON_INACTIVITY_ASK
      On inactivity, ask user what to do next.
      static java.lang.String ON_INACTIVITY_NOTIFY
      On inactivity, only notify user.
      static java.lang.String ON_INACTIVITY_STOP
      On inactivity, stop measuring current task.
      private java.beans.PropertyChangeSupport propertyChangeSupport
      Class containing all registered listeners interested in settings.
      private static Settings settings
      The only instance of Settings object in the system.
      private java.util.HashMap settingsMap
      Map containing all settings.
      static java.lang.String UPLOAD_OFF
      Upload of diary file turned off.
      static java.lang.String UPLOAD_ON
      Upload of diary file turned on.
      static java.lang.String UPLOAD_SUSPENDED
      Upload of diary file suspended until next Rachota session.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Settings()
      Creates private instance of Settings object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Adds new listener to set of objects interested in this settings.
      boolean getCountPrivateTasks()
      Return whether or not to count private tasks towards the daily working hours.
      static Settings getDefault()
      Returns the only instance of persistent system settings.
      java.lang.Object getSetting​(java.lang.String setting)
      Returns value of given setting.
      boolean getUseEstimatedWorkDay()
      Returns whether or not to use estimated work day in the day view when viewing current working day.
      double getWorkingHours()
      Returns the daily working hours.
      static void loadSettings()
      Loads all settings from settings.cfg file.
      void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Adds new listener to set of objects interested in this settings.
      static void saveSettings()
      Saves all settings into settings.cfg file.
      void setCountPrivateTasks​(boolean countPrivateTasks)
      Sets whether or not to count private tasks towards the daily working hours.
      void setSetting​(java.lang.String setting, java.lang.Object value)
      Sets given setting to given value.
      void setUseEstimatedWorkDay​(boolean useEstimate)
      Sets whether or not to use estimated work day in the day view.
      void setWorkingHours​(double value)
      Sets the daily working hours.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
        Logger for recording important or erroneous events.
      • settings

        private static Settings settings
        The only instance of Settings object in the system.
      • settingsMap

        private java.util.HashMap settingsMap
        Map containing all settings. Key is setting name e.g. "displayFinishedTasks" and value holds the setting value e.g. "true".
      • propertyChangeSupport

        private java.beans.PropertyChangeSupport propertyChangeSupport
        Class containing all registered listeners interested in settings.
      • ON_HIBERNATION_IGNORE

        public static java.lang.String ON_HIBERNATION_IGNORE
        Flag to ignore downtime if hibernation was detected.
      • ON_HIBERNATION_INCLUDE

        public static java.lang.String ON_HIBERNATION_INCLUDE
        Flag to include downtime if hibernation was detected.
      • ON_HIBERNATION_ASK

        public static java.lang.String ON_HIBERNATION_ASK
        Flag to ask user if hibernation was detected.
      • ON_EXIT_ASK

        public static final java.lang.String ON_EXIT_ASK
        On exit, ask for measuring downtime.
        See Also:
        Constant Field Values
      • ON_EXIT_STOP

        public static final java.lang.String ON_EXIT_STOP
        On exit, stop measuring downtime.
        See Also:
        Constant Field Values
      • ON_INACTIVITY_NOTIFY

        public static final java.lang.String ON_INACTIVITY_NOTIFY
        On inactivity, only notify user.
        See Also:
        Constant Field Values
      • ON_INACTIVITY_ASK

        public static final java.lang.String ON_INACTIVITY_ASK
        On inactivity, ask user what to do next.
        See Also:
        Constant Field Values
      • ON_INACTIVITY_STOP

        public static final java.lang.String ON_INACTIVITY_STOP
        On inactivity, stop measuring current task.
        See Also:
        Constant Field Values
      • ACTIVITY_REPORT_FAILED

        public static final java.lang.String ACTIVITY_REPORT_FAILED
        Tried to report activity but failed.
        See Also:
        Constant Field Values
      • ACTIVITY_NOT_REPORTED

        public static final java.lang.String ACTIVITY_NOT_REPORTED
        Activity not yet reported.
        See Also:
        Constant Field Values
      • UPLOAD_OFF

        public static java.lang.String UPLOAD_OFF
        Upload of diary file turned off.
      • UPLOAD_ON

        public static java.lang.String UPLOAD_ON
        Upload of diary file turned on.
      • UPLOAD_SUSPENDED

        public static java.lang.String UPLOAD_SUSPENDED
        Upload of diary file suspended until next Rachota session.
      • DAY_WORKING_HOURS

        public static final java.lang.String DAY_WORKING_HOURS
        Static String used to store the daily working hours field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Settings

        private Settings()
        Creates private instance of Settings object.
    • Method Detail

      • getDefault

        public static Settings getDefault()
        Returns the only instance of persistent system settings.
        Returns:
        Persistent system settings.
      • setSetting

        public void setSetting​(java.lang.String setting,
                               java.lang.Object value)
        Sets given setting to given value.
        Parameters:
        setting - Setting to be set.
        value - New value of setting.
      • getSetting

        public java.lang.Object getSetting​(java.lang.String setting)
        Returns value of given setting.
        Parameters:
        setting - Setting whose value will be returned.
        Returns:
        Value of given setting or null if it does not exist.
      • addPropertyChangeListener

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

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Adds new listener to set of objects interested in this settings.
        Parameters:
        listener - Object interested in this settings.
      • saveSettings

        public static void saveSettings()
        Saves all settings into settings.cfg file.
      • loadSettings

        public static void loadSettings()
        Loads all settings from settings.cfg file.
      • getWorkingHours

        public double getWorkingHours()
        Returns the daily working hours.
        Returns:
        The daily working hours.
      • setWorkingHours

        public void setWorkingHours​(double value)
        Sets the daily working hours.
        Parameters:
        value - The new value for the daily working hours.
      • getCountPrivateTasks

        public boolean getCountPrivateTasks()
        Return whether or not to count private tasks towards the daily working hours.
        Returns:
        true if the private tasks should count towards the daily working hours, false if not.
        See Also:
        setCountPrivateTasks(boolean)
      • setCountPrivateTasks

        public void setCountPrivateTasks​(boolean countPrivateTasks)
        Sets whether or not to count private tasks towards the daily working hours.
        Parameters:
        countPrivateTasks - whether or not to count tasks towards the daily working hours.
        See Also:
        getCountPrivateTasks()
      • getUseEstimatedWorkDay

        public boolean getUseEstimatedWorkDay()
        Returns whether or not to use estimated work day in the day view when viewing current working day.
        Returns:
        true if the day view should show estimated end of work day, false otherwise.
      • setUseEstimatedWorkDay

        public void setUseEstimatedWorkDay​(boolean useEstimate)
        Sets whether or not to use estimated work day in the day view.
        Parameters:
        useEstimate - whether or not to use estimated work day in the day view.