|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmain.UserPreferences
public class UserPreferences
This class stores all user preference settings. When the user makes changes to settings such as default background color of charts or delimiting characters for data imports these settings are stored in an instance of this class.
Each time a change is made the information is automatically saved by serializing the class instance to a file in the application directory.
User specific settings are supported by naming the settings file after the user name, followed by the extension .pref.
If this file is missing upon startup, a new file with the default settings is created. The default settings used for this purpose are also defined in this class.
Field Summary | |
---|---|
private java.awt.Color |
activeDesignDefaultColor
The active design default color. |
private boolean |
autoFitAxis
Axes are autofitted |
private java.awt.Color |
axisColor
The axis color. |
private double |
axisDefaultMax
The axis default maximum value. |
private double |
axisDefaultMin
The axis default minimum value. |
private int |
axisHeight
The axis height in pixels. |
private boolean |
axisInverted
Flips the axes upside down. |
private java.awt.Color |
axisLabelFontColor
The axis font color used for the axis title labels. |
private int |
axisLabelFontSize
The axis label font size. |
private int |
axisTicCount
The number of tics used on the axis count. |
private java.awt.Color |
axisTicLabelFontColor
The font color used for the axis tic labels. |
private java.lang.String |
axisTicLabelFormat
The axis tic label format. |
private int |
axisTicLength
The axis tic length in pixels. |
private int |
axisWidth
The width in pixels that is used by one axis. |
private java.awt.Color |
backgroundDefaultColor
The default background color for charts. |
private java.lang.String |
delimiter
The delimiter used to distinguish columns when importing data. |
private int |
designIDFontSize
The design id font size. |
private int |
designLabelFontSize
The design label font size. |
private int |
dirToImportFrom
The directory to import from. |
private java.awt.Color |
filterColor
The filter color. |
private int |
filterHeight
The height of the triangles that represent the filter in pixels. |
private boolean |
filterInverted
Inverts filters. |
private int |
filterWidth
The width of one half triangle that represents a filter in pixels. |
private java.lang.String |
homeDir
The user's home directory. |
static int |
IMPORT_FROM_HOMEDIR
Open file import browse dialog in the user's home directory by default. |
static int |
IMPORT_FROM_LASTDIR
Open file import browse dialog in the last opened directory by default. |
static int |
IMPORT_FROM_USERDIR
Open file import browse dialog in a userspecified directory by default. |
private java.awt.Color |
inActiveDesignDefaultColor
The inactive (filtered) design default color. |
private java.lang.String |
lastFile
The last file that was selected. |
private boolean |
lastFileInitialised
Flag to remember when lastFile is initialised. |
private java.lang.String |
otherDelimiter
Character that is used as delimiter when importing data. |
(package private) static boolean |
printLog
Flag to enable debug message printing for this class. |
(package private) static long |
serialVersionUID
The version tracking unique identifier for Serialization. |
private boolean |
showDesignIDs
Flag to enable plotting design id numbers to the left of the left-most axis. |
private boolean |
showFilteredDesigns
Switch that enables displaying filtered designs. |
private int |
ticLabelFontSize
The tic label font size. |
private boolean |
treatConsecutiveAsOne
Flag to enable treating consecutive delimiters as one. |
private java.lang.String |
userDir
User-specified setting where the file browsing dialog should start by default. |
Constructor Summary | |
---|---|
UserPreferences()
Instantiates a new user preferences. |
Method Summary | |
---|---|
java.awt.Color |
getActiveDesignDefaultColor()
Gets the active design default color. |
java.awt.Color |
getAxisColor()
Gets the axis color. |
double |
getAxisDefaultMax()
Gets the axis default maximum value. |
double |
getAxisDefaultMin()
Gets the axis default minimum value. |
int |
getAxisHeight()
Gets the axis height. |
java.awt.Color |
getAxisLabelFontColor()
Gets the axis label font color. |
int |
getAxisLabelFontSize()
Gets the axis label font size. |
int |
getAxisTicCount()
Gets the axis tic count. |
java.awt.Color |
getAxisTicLabelFontColor()
Gets the axis tic label font color. |
int |
getAxisTicLabelFontSize()
Gets the axis tic label font size. |
java.lang.String |
getAxisTicLabelFormat()
Gets the axis tic label format. |
int |
getAxisTicLength()
Gets the axis tic length. |
int |
getAxisWidth()
Gets the axis width. |
java.lang.String |
getCurrentDir()
Gets the directory for the file browsing dialog. |
java.awt.Color |
getDefaultBackgroundColor()
Gets the default background color. |
java.lang.String |
getDelimiter()
Gets the delimiter for importing data. |
int |
getDesignIDFontSize()
Gets the design id font size. |
int |
getDesignLabelFontSize()
Gets the design label font size. |
int |
getDirToImportFrom()
Gets the dir to import from. |
java.awt.Color |
getFilterDefaultColor()
Gets the filter default color. |
java.awt.Color |
getFilteredDesignDefaultColor()
Gets the filtered design default color. |
int |
getFilterHeight()
Gets the filter height. |
int |
getFilterWidth()
Gets the filter width. |
java.lang.String |
getHomeDir()
Gets the user home directory. |
java.lang.String |
getLastFile()
Gets the last file. |
java.lang.String |
getOtherDelimiter()
Gets the user-defined delimiter. |
static java.lang.String |
getPreferenceFileName()
Gets the preference file name. |
java.lang.String |
getUserDir()
Gets the user directory. |
boolean |
isAutoFitAxis()
Checks if axes are autofitted. |
boolean |
isAxisInverted()
Checks whether axes are inverted. |
boolean |
isFilterInverted()
Checks whether filters are inverted. |
boolean |
isLastFileInitialised()
Checks if the last file field has been initialised. |
boolean |
isShowDesignIDs()
Checks if design id numbers are shown left to the left-most axis. |
boolean |
isShowFilteredDesigns()
Checks if filtered designs should be shown. |
boolean |
isTreatConsecutiveAsOne()
Checks . |
private void |
log(java.lang.String message)
Prints debug information to stdout when printLog is set to true. |
static UserPreferences |
readFromFile(Main mainWindow)
Read from file. |
void |
resetToDefault()
Restores all default settings. |
void |
saveToFile()
Save to file. |
void |
setActiveDesignDefaultColor(java.awt.Color activeDesignDefaultColor)
Sets the active design default color. |
void |
setAutoFitAxis(boolean autoFitAxis)
Specifies whether axes should be autofitted. |
void |
setAxisColor(java.awt.Color axisColor)
Sets the axis color. |
void |
setAxisDefaultMax(double axisDefaultMax)
Sets the axis default max. |
void |
setAxisDefaultMin(double axisDefaultMin)
Sets the axis default minimum value. |
void |
setAxisHeight(int axisHeight)
Sets the axis height. |
void |
setAxisInverted(boolean axisInverted)
Specifies whether axes are inverted. |
void |
setAxisLabelFontColor(java.awt.Color axisLabelFontColor)
Sets the axis label font color. |
void |
setAxisLabelFontSize(int axisLabelFontSize)
Sets the axis label font size. |
void |
setAxisTicCount(int axisTicCount)
Sets the axis tic count. |
void |
setAxisTicLabelFontColor(java.awt.Color axisTicLabelFontColor)
Sets the axis tic label font color. |
void |
setAxisTicLabelFontSize(int ticLabelFontSize)
Sets the axis tic label font size. |
void |
setAxisTicLabelFormat(java.lang.String axisTicLabelFormat)
Sets the axis tic label format. |
void |
setAxisTicLength(int axisTicLength)
Sets the axis tic length. |
void |
setAxisWidth(int axisWidth)
Sets the axis width. |
void |
setDefaultBackgroundColor(java.awt.Color backgroundColor)
Sets the default background color. |
void |
setDelimiter(java.lang.String delimiter)
Sets the delimiter for importing data. |
void |
setDesignIDFontSize(int designIDFontSize)
Sets the design id font size. |
void |
setDesignLabelFontSize(int designLabelFontSize)
Sets the design label font size. |
void |
setDirToImportFrom(int dirToImportFrom)
Sets the dir to import from. |
void |
setFilterColor(java.awt.Color filterColor)
Sets the filter color. |
void |
setFilterHeight(int filterHeight)
Sets the filter height. |
void |
setFilterInverted(boolean filterInverted)
Specifies whether filters inverted. |
void |
setFilterWidth(int filterWidth)
Sets the filter width. |
void |
setHomeDir(java.lang.String homeDir)
Sets the home directory. |
void |
setInActiveDesignDefaultColor(java.awt.Color inActiveDesignDefaultColor)
Sets the in active design default color. |
void |
setLastFile(java.lang.String lastFileBrowsingDirectory)
Sets the last file. |
void |
setOtherDelimiter(java.lang.String otherDelimiter)
Sets the user-defined delimiter. |
void |
setShowDesignIDs(boolean showDesignIDs)
Specifies whether design id numbers are shown left to the left-most axis. |
void |
setShowFilteredDesigns(boolean showFilteredDesigns)
Sets whether filtered designs should be shown. |
void |
setTreatConsecutiveAsOne(boolean treatConsecutiveAsOne)
Sets whether consecutive delimiters should be treated as one. |
void |
setUserDir(java.lang.String userDir)
Sets the user directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
static final boolean printLog
public static final int IMPORT_FROM_HOMEDIR
dirToImportFrom
,
Constant Field Valuespublic static final int IMPORT_FROM_LASTDIR
dirToImportFrom
,
lastFile
,
Constant Field Valuespublic static final int IMPORT_FROM_USERDIR
dirToImportFrom
,
userDir
,
Constant Field Valuesprivate int dirToImportFrom
IMPORT_FROM_HOMEDIR
,
IMPORT_FROM_LASTDIR
,
IMPORT_FROM_USERDIR
,
lastFile
,
userDir
private boolean lastFileInitialised
lastFile
is initialised.
private java.lang.String homeDir
private java.lang.String lastFile
private java.lang.String userDir
private boolean showFilteredDesigns
private java.awt.Color backgroundDefaultColor
private int axisWidth
private int axisHeight
private int axisTicCount
private java.awt.Color axisColor
private java.awt.Color axisLabelFontColor
private java.awt.Color axisTicLabelFontColor
private int axisLabelFontSize
private int ticLabelFontSize
private int designLabelFontSize
private java.lang.String axisTicLabelFormat
private int axisTicLength
private java.awt.Color filterColor
private int filterHeight
private int filterWidth
private java.awt.Color activeDesignDefaultColor
private java.awt.Color inActiveDesignDefaultColor
showFilteredDesigns
is true.
private boolean showDesignIDs
private int designIDFontSize
private java.lang.String delimiter
private java.lang.String otherDelimiter
delimiter
private boolean treatConsecutiveAsOne
private boolean filterInverted
private boolean axisInverted
private boolean autoFitAxis
private double axisDefaultMax
autoFitAxis
is false.
private double axisDefaultMin
autoFitAxis
is false.
Constructor Detail |
---|
public UserPreferences()
Method Detail |
---|
public java.awt.Color getAxisColor()
public void setAxisColor(java.awt.Color axisColor)
axisColor
- the new axis colorpublic int getAxisHeight()
public void setAxisHeight(int axisHeight)
axisHeight
- the new axis heightpublic java.awt.Color getAxisLabelFontColor()
public void setAxisLabelFontColor(java.awt.Color axisLabelFontColor)
axisLabelFontColor
- the new axis label font colorpublic int getAxisLabelFontSize()
public void setAxisLabelFontSize(int axisLabelFontSize)
axisLabelFontSize
- the new axis label font sizepublic int getAxisTicCount()
public void setAxisTicCount(int axisTicCount)
axisTicCount
- the new axis tic countpublic java.awt.Color getAxisTicLabelFontColor()
public void setAxisTicLabelFontColor(java.awt.Color axisTicLabelFontColor)
axisTicLabelFontColor
- the new axis tic label font colorpublic java.lang.String getAxisTicLabelFormat()
public void setAxisTicLabelFormat(java.lang.String axisTicLabelFormat)
axisTicLabelFormat
- the new axis tic label formatpublic int getAxisTicLength()
public void setAxisTicLength(int axisTicLength)
axisTicLength
- the new axis tic lengthpublic int getAxisWidth()
public void setAxisWidth(int axisWidth)
axisWidth
- the new axis widthpublic java.awt.Color getFilterDefaultColor()
public void setFilterColor(java.awt.Color filterColor)
filterColor
- the new filter colorpublic int getFilterHeight()
public void setFilterHeight(int filterHeight)
filterHeight
- the new filter heightpublic int getFilterWidth()
public void setFilterWidth(int filterWidth)
filterWidth
- the new filter widthpublic int getAxisTicLabelFontSize()
public void setAxisTicLabelFontSize(int ticLabelFontSize)
ticLabelFontSize
- the new axis tic label font sizepublic void saveToFile()
public static UserPreferences readFromFile(Main mainWindow) throws java.io.InvalidClassException, java.io.IOException
mainWindow
- the main window
InvalidClassException
- the invalid class exception
java.io.IOException
- Signals that an I/O exception has occurred.public int getDesignLabelFontSize()
public void setDesignLabelFontSize(int designLabelFontSize)
designLabelFontSize
- the new design label font sizepublic int getDirToImportFrom()
public void setDirToImportFrom(int dirToImportFrom)
dirToImportFrom
- the new dir to import frompublic java.lang.String getLastFile()
public void setLastFile(java.lang.String lastFileBrowsingDirectory)
lastFileBrowsingDirectory
- the new last filepublic boolean isLastFileInitialised()
public java.lang.String getHomeDir()
public void setHomeDir(java.lang.String homeDir)
homeDir
- the new home directorypublic java.lang.String getUserDir()
public void setUserDir(java.lang.String userDir)
userDir
- the new user directorypublic java.lang.String getCurrentDir()
public java.lang.String getDelimiter()
public void setDelimiter(java.lang.String delimiter)
delimiter
- the new delimiterpublic boolean isTreatConsecutiveAsOne()
public void setTreatConsecutiveAsOne(boolean treatConsecutiveAsOne)
treatConsecutiveAsOne
- flag for treating consecutive delimiters as onepublic java.lang.String getOtherDelimiter()
public void setOtherDelimiter(java.lang.String otherDelimiter)
otherDelimiter
- the user-defined delimiterpublic boolean isShowFilteredDesigns()
public void setShowFilteredDesigns(boolean showFilteredDesigns)
showFilteredDesigns
- flag to set whether filtered designs should be shown.public java.awt.Color getActiveDesignDefaultColor()
public void setActiveDesignDefaultColor(java.awt.Color activeDesignDefaultColor)
activeDesignDefaultColor
- the new active design default colorpublic java.awt.Color getFilteredDesignDefaultColor()
public void setInActiveDesignDefaultColor(java.awt.Color inActiveDesignDefaultColor)
inActiveDesignDefaultColor
- the new in active design default colorpublic boolean isShowDesignIDs()
public void setShowDesignIDs(boolean showDesignIDs)
showDesignIDs
- specifies whether design id numbers are shown left to the left-most axis.public int getDesignIDFontSize()
public void setDesignIDFontSize(int designIDFontSize)
designIDFontSize
- the new design id font sizepublic java.awt.Color getDefaultBackgroundColor()
public void setDefaultBackgroundColor(java.awt.Color backgroundColor)
backgroundColor
- the new default background colorpublic boolean isFilterInverted()
public void setFilterInverted(boolean filterInverted)
filterInverted
- Specifies whether filters inverted.private void log(java.lang.String message)
message
- the messagepublic boolean isAxisInverted()
public void setAxisInverted(boolean axisInverted)
axisInverted
- Specifies whether axes are inverted.public boolean isAutoFitAxis()
public void setAutoFitAxis(boolean autoFitAxis)
autoFitAxis
- Specifies whether axes should be autofitted.public double getAxisDefaultMax()
public double getAxisDefaultMin()
public void setAxisDefaultMin(double axisDefaultMin)
axisDefaultMin
- the new axis default minimum valuepublic void setAxisDefaultMax(double axisDefaultMax)
axisDefaultMax
- the new axis default maxpublic static java.lang.String getPreferenceFileName()
public void resetToDefault()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |