Package org.cesilko.rachota.core
Class Settings
java.lang.Object
org.cesilko.rachota.core.Settings
Persistent settings of the system.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringActivity not yet reported.static final StringTried to report activity but failed.static final StringStatic String used to store the daily working hours field.private static final LoggerLogger for recording important or erroneous events.static final StringOn exit, ask for measuring downtime.static final StringOn exit, stop measuring downtime.static StringFlag to ask user if hibernation was detected.static StringFlag to ignore downtime if hibernation was detected.static StringFlag to include downtime if hibernation was detected.static final StringOn inactivity, ask user what to do next.static final StringOn inactivity, only notify user.static final StringOn inactivity, stop measuring current task.private PropertyChangeSupportClass containing all registered listeners interested in settings.private static SettingsThe only instance of Settings object in the system.private HashMapMap containing all settings.static StringUpload of diary file turned off.static StringUpload of diary file turned on.static StringUpload of diary file suspended until next Rachota session. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds new listener to set of objects interested in this settings.booleanReturn whether or not to count private tasks towards the daily working hours.static SettingsReturns the only instance of persistent system settings.getSetting(String setting) Returns value of given setting.booleanReturns whether or not to use estimated work day in the day view when viewing current working day.doubleReturns the daily working hours.static voidLoads all settings from settings.cfg file.voidAdds new listener to set of objects interested in this settings.static voidSaves all settings into settings.cfg file.voidsetCountPrivateTasks(boolean countPrivateTasks) Sets whether or not to count private tasks towards the daily working hours.voidsetSetting(String setting, Object value) Sets given setting to given value.voidsetUseEstimatedWorkDay(boolean useEstimate) Sets whether or not to use estimated work day in the day view.voidsetWorkingHours(double value) Sets the daily working hours.
-
Field Details
-
logger
Logger for recording important or erroneous events. -
settings
The only instance of Settings object in the system. -
settingsMap
Map containing all settings. Key is setting name e.g. "displayFinishedTasks" and value holds the setting value e.g. "true". -
propertyChangeSupport
Class containing all registered listeners interested in settings. -
ON_HIBERNATION_IGNORE
Flag to ignore downtime if hibernation was detected. -
ON_HIBERNATION_INCLUDE
Flag to include downtime if hibernation was detected. -
ON_HIBERNATION_ASK
Flag to ask user if hibernation was detected. -
ON_EXIT_ASK
On exit, ask for measuring downtime.- See Also:
-
ON_EXIT_STOP
On exit, stop measuring downtime.- See Also:
-
ON_INACTIVITY_NOTIFY
On inactivity, only notify user.- See Also:
-
ON_INACTIVITY_ASK
On inactivity, ask user what to do next.- See Also:
-
ON_INACTIVITY_STOP
On inactivity, stop measuring current task.- See Also:
-
ACTIVITY_REPORT_FAILED
Tried to report activity but failed.- See Also:
-
ACTIVITY_NOT_REPORTED
Activity not yet reported.- See Also:
-
UPLOAD_OFF
Upload of diary file turned off. -
UPLOAD_ON
Upload of diary file turned on. -
UPLOAD_SUSPENDED
Upload of diary file suspended until next Rachota session. -
DAY_WORKING_HOURS
Static String used to store the daily working hours field.- See Also:
-
-
Constructor Details
-
Settings
private Settings()Creates private instance of Settings object.
-
-
Method Details
-
getDefault
Returns the only instance of persistent system settings.- Returns:
- Persistent system settings.
-
setSetting
Sets given setting to given value.- Parameters:
setting- Setting to be set.value- New value of setting.
-
getSetting
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
Adds new listener to set of objects interested in this settings.- Parameters:
listener- Object interested in this settings.
-
removePropertyChangeListener
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:
trueif the private tasks should count towards the daily working hours,falseif not.- See Also:
-
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:
-
getUseEstimatedWorkDay
public boolean getUseEstimatedWorkDay()Returns whether or not to use estimated work day in the day view when viewing current working day.- Returns:
trueif the day view should show estimated end of work day,falseotherwise.
-
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.
-