xdat
Class UserPreferences

java.lang.Object
  extended by xdat.UserPreferences

public class UserPreferences
extends java.lang.Object

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 using the java Preferences API.


Field Summary
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.
static int LOCALE_DE
          German Locale for number formatting.
static int LOCALE_US
          US Locale for number formatting.
private  java.util.prefs.Preferences prefs
          Preferences Object to store settings.
(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  java.lang.String versionString
          Current Release Version to be able to store version-specific boolean value for the click-wrap license.
 
Constructor Summary
UserPreferences(java.lang.String versionString)
          Instantiates a new user preferences object.
 
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 tick count.
 java.awt.Color getAxisTicLabelFontColor()
          Gets the axis tick label font color.
 int getAxisTicLabelFontSize()
          Gets the axis tick label font size.
 java.lang.String getAxisTicLabelFormat()
          Gets the axis tick label format.
 int getAxisTicLength()
          Gets the axis tick length.
 int getAxisWidth()
          Gets the width in pixels that is used by one axis.
 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 width of one half triangle that represents a filter in pixels.
 java.lang.String getHomeDir()
          Gets the user home directory.
 java.lang.String getLastFile()
          Gets the last file.
 java.util.Locale getLocale()
          Returns the number format locale to be used for parsing data.
 java.lang.String getOtherDelimiter()
          Gets the character that is used as delimiter when importing data.
 java.lang.String getUserDir()
          Gets the user directory.
 boolean isAutoFitAxis()
          Checks if axes are autofitted.
 boolean isAxisInverted()
          Checks whether axes are inverted.
 boolean isFilterInverted()
          True, when filters are inverted.
 boolean isLastFileInitialised()
          Checks if the last file field has been initialised.
 boolean isLicenseAccepted()
          Returns true, when the user has accepted the license
 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.
 void resetToDefault()
          Restores all default settings.
 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 tick count.
 void setAxisTicLabelFontColor(java.awt.Color axisTicLabelFontColor)
          Sets the axis tick label font color.
 void setAxisTicLabelFontSize(int ticLabelFontSize)
          Sets the axis tick label font size.
 void setAxisTicLabelFormat(java.lang.String axisTicLabelFormat)
          Sets the axis tick label format.
 void setAxisTicLength(int axisTicLength)
          Sets the axis tick 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 setLicenseAccepted(boolean licenseAccepted)
          Specifies whether the user has accepted the license.
 void setLocale(int locale)
          Sets the number format string to be used for both parsing data.
 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

serialVersionUID

static final long serialVersionUID
The version tracking unique identifier for Serialization.

See Also:
Constant Field Values

printLog

static final boolean printLog
Flag to enable debug message printing for this class.

See Also:
Constant Field Values

prefs

private java.util.prefs.Preferences prefs
Preferences Object to store settings.


versionString

private java.lang.String versionString
Current Release Version to be able to store version-specific boolean value for the click-wrap license.


IMPORT_FROM_HOMEDIR

public static final int IMPORT_FROM_HOMEDIR
Open file import browse dialog in the user's home directory by default.

See Also:
Constant Field Values

IMPORT_FROM_LASTDIR

public static final int IMPORT_FROM_LASTDIR
Open file import browse dialog in the last opened directory by default.

See Also:
Constant Field Values

IMPORT_FROM_USERDIR

public static final int IMPORT_FROM_USERDIR
Open file import browse dialog in a userspecified directory by default.

See Also:
Constant Field Values

LOCALE_US

public static final int LOCALE_US
US Locale for number formatting.

See Also:
Constant Field Values

LOCALE_DE

public static final int LOCALE_DE
German Locale for number formatting.

See Also:
Constant Field Values
Constructor Detail

UserPreferences

public UserPreferences(java.lang.String versionString)
Instantiates a new user preferences object.

Method Detail

isLicenseAccepted

public boolean isLicenseAccepted()
Returns true, when the user has accepted the license

Returns:
whether the license was accepted by the user

setLicenseAccepted

public void setLicenseAccepted(boolean licenseAccepted)
Specifies whether the user has accepted the license.

Parameters:
licenseAccepted - the flag that specifies whether the user has accepted the license

getAxisColor

public java.awt.Color getAxisColor()
Gets the axis color

Returns:
the axis color

setAxisColor

public void setAxisColor(java.awt.Color axisColor)
Sets the axis color.

Parameters:
axisColor - the new axis color

getAxisHeight

public int getAxisHeight()
Gets the axis height.

Returns:
the axis height

setAxisHeight

public void setAxisHeight(int axisHeight)
Sets the axis height.

Parameters:
axisHeight - the new axis height

getAxisLabelFontColor

public java.awt.Color getAxisLabelFontColor()
Gets the axis label font color.

Returns:
the axis label font color

setAxisLabelFontColor

public void setAxisLabelFontColor(java.awt.Color axisLabelFontColor)
Sets the axis label font color.

Parameters:
axisLabelFontColor - the new axis label font color

getAxisLabelFontSize

public int getAxisLabelFontSize()
Gets the axis label font size.

Returns:
the axis label font size

setAxisLabelFontSize

public void setAxisLabelFontSize(int axisLabelFontSize)
Sets the axis label font size.

Parameters:
axisLabelFontSize - the new axis label font size

getAxisTicCount

public int getAxisTicCount()
Gets the axis tick count.

Returns:
the axis tick count

setAxisTicCount

public void setAxisTicCount(int axisTicCount)
Sets the axis tick count.

Parameters:
axisTicCount - the new axis tick count

getAxisTicLabelFontColor

public java.awt.Color getAxisTicLabelFontColor()
Gets the axis tick label font color.

Returns:
the axis tick label font color

setAxisTicLabelFontColor

public void setAxisTicLabelFontColor(java.awt.Color axisTicLabelFontColor)
Sets the axis tick label font color.

Parameters:
axisTicLabelFontColor - the new axis tick label font color

getAxisTicLabelFormat

public java.lang.String getAxisTicLabelFormat()
Gets the axis tick label format.

Returns:
the axis tick label format

setAxisTicLabelFormat

public void setAxisTicLabelFormat(java.lang.String axisTicLabelFormat)
Sets the axis tick label format.

Parameters:
axisTicLabelFormat - the new axis tick label format

getAxisTicLength

public int getAxisTicLength()
Gets the axis tick length.

Returns:
the axis tick length

setAxisTicLength

public void setAxisTicLength(int axisTicLength)
Sets the axis tick length.

Parameters:
axisTicLength - the new axis tick length

getAxisWidth

public int getAxisWidth()
Gets the width in pixels that is used by one axis. This setting is used to define the axis spacing. The distance of two axes is defined by the sum of their respective widths, divided by two.

Returns:
the axis width

setAxisWidth

public void setAxisWidth(int axisWidth)
Sets the axis width.

Parameters:
axisWidth - the new axis width

getFilterDefaultColor

public java.awt.Color getFilterDefaultColor()
Gets the filter default color.

Returns:
the filter default color

setFilterColor

public void setFilterColor(java.awt.Color filterColor)
Sets the filter color.

Parameters:
filterColor - the new filter color

getFilterHeight

public int getFilterHeight()
Gets the filter height.

Returns:
the filter height

setFilterHeight

public void setFilterHeight(int filterHeight)
Sets the filter height.

Parameters:
filterHeight - the new filter height

getFilterWidth

public int getFilterWidth()
Gets the width of one half triangle that represents a filter in pixels. In other words, the filter triangle will be twice as large as the value entered here.

Returns:
the filter width

setFilterWidth

public void setFilterWidth(int filterWidth)
Sets the filter width.

Parameters:
filterWidth - the new filter width

getAxisTicLabelFontSize

public int getAxisTicLabelFontSize()
Gets the axis tick label font size.

Returns:
the axis tick label font size

setAxisTicLabelFontSize

public void setAxisTicLabelFontSize(int ticLabelFontSize)
Sets the axis tick label font size.

Parameters:
ticLabelFontSize - the new axis tick label font size

getDesignLabelFontSize

public int getDesignLabelFontSize()
Gets the design label font size.

Returns:
the design label font size

setDesignLabelFontSize

public void setDesignLabelFontSize(int designLabelFontSize)
Sets the design label font size.

Parameters:
designLabelFontSize - the new design label font size

getDirToImportFrom

public int getDirToImportFrom()
Gets the dir to import from.

Returns:
the dir to import from

setDirToImportFrom

public void setDirToImportFrom(int dirToImportFrom)
Sets the dir to import from.

Parameters:
dirToImportFrom - the new dir to import from

getLastFile

public java.lang.String getLastFile()
Gets the last file.

Returns:
the last file

setLastFile

public void setLastFile(java.lang.String lastFileBrowsingDirectory)
Sets the last file.

Parameters:
lastFileBrowsingDirectory - the new last file

isLastFileInitialised

public boolean isLastFileInitialised()
Checks if the last file field has been initialised.

Returns:
true, if is last file field has been initialised

getHomeDir

public java.lang.String getHomeDir()
Gets the user home directory.

Returns:
the user home directory

setHomeDir

public void setHomeDir(java.lang.String homeDir)
Sets the home directory.

Parameters:
homeDir - the new home directory

getUserDir

public java.lang.String getUserDir()
Gets the user directory.

Returns:
the user directory

setUserDir

public void setUserDir(java.lang.String userDir)
Sets the user directory.

Parameters:
userDir - the new user directory

getCurrentDir

public java.lang.String getCurrentDir()
Gets the directory for the file browsing dialog.

Returns:
the current directory based on the user preferences.

getDelimiter

public java.lang.String getDelimiter()
Gets the delimiter for importing data.

Returns:
the delimiter

setDelimiter

public void setDelimiter(java.lang.String delimiter)
Sets the delimiter for importing data.

Parameters:
delimiter - the new delimiter

isTreatConsecutiveAsOne

public boolean isTreatConsecutiveAsOne()
Checks .

Returns:
true, if consecutive delimiters should be treated as one

setTreatConsecutiveAsOne

public void setTreatConsecutiveAsOne(boolean treatConsecutiveAsOne)
Sets whether consecutive delimiters should be treated as one.

Parameters:
treatConsecutiveAsOne - flag for treating consecutive delimiters as one

getOtherDelimiter

public java.lang.String getOtherDelimiter()
Gets the character that is used as delimiter when importing data. Only used to store this information internally.

Returns:
the user-defined delimiter

setOtherDelimiter

public void setOtherDelimiter(java.lang.String otherDelimiter)
Sets the user-defined delimiter.

Parameters:
otherDelimiter - the user-defined delimiter

isShowFilteredDesigns

public boolean isShowFilteredDesigns()
Checks if filtered designs should be shown.

Returns:
true, if filtered designs are shown

setShowFilteredDesigns

public void setShowFilteredDesigns(boolean showFilteredDesigns)
Sets whether filtered designs should be shown.

Parameters:
showFilteredDesigns - flag to set whether filtered designs should be shown.

getActiveDesignDefaultColor

public java.awt.Color getActiveDesignDefaultColor()
Gets the active design default color.

Returns:
the active design default color

setActiveDesignDefaultColor

public void setActiveDesignDefaultColor(java.awt.Color activeDesignDefaultColor)
Sets the active design default color.

Parameters:
activeDesignDefaultColor - the new active design default color

getFilteredDesignDefaultColor

public java.awt.Color getFilteredDesignDefaultColor()
Gets the filtered design default color.

Returns:
the filtered design default color

setInActiveDesignDefaultColor

public void setInActiveDesignDefaultColor(java.awt.Color inActiveDesignDefaultColor)
Sets the in active design default color.

Parameters:
inActiveDesignDefaultColor - the new in active design default color

isShowDesignIDs

public boolean isShowDesignIDs()
Checks if design id numbers are shown left to the left-most axis.

Returns:
whether design id numbers are shown left to the left-most axis.

setShowDesignIDs

public void setShowDesignIDs(boolean showDesignIDs)
Specifies whether design id numbers are shown left to the left-most axis.

Parameters:
showDesignIDs - specifies whether design id numbers are shown left to the left-most axis.

getDesignIDFontSize

public int getDesignIDFontSize()
Gets the design id font size.

Returns:
the design id font size

setDesignIDFontSize

public void setDesignIDFontSize(int designIDFontSize)
Sets the design id font size.

Parameters:
designIDFontSize - the new design id font size

getDefaultBackgroundColor

public java.awt.Color getDefaultBackgroundColor()
Gets the default background color.

Returns:
the default background color

setDefaultBackgroundColor

public void setDefaultBackgroundColor(java.awt.Color backgroundColor)
Sets the default background color.

Parameters:
backgroundColor - the new default background color

isFilterInverted

public boolean isFilterInverted()
True, when filters are inverted. This means that designs between the filters are shown, while designs above the top filter and below the bottom filter are not.

Returns:
true, if filters are inverted.

setFilterInverted

public void setFilterInverted(boolean filterInverted)
Specifies whether filters inverted.

Parameters:
filterInverted - Specifies whether filters inverted.

isAxisInverted

public boolean isAxisInverted()
Checks whether axes are inverted.

Returns:
true, if axes are inverted

setAxisInverted

public void setAxisInverted(boolean axisInverted)
Specifies whether axes are inverted.

Parameters:
axisInverted - Specifies whether axes are inverted.

isAutoFitAxis

public boolean isAutoFitAxis()
Checks if axes are autofitted.

Returns:
true, if axes are autofitted.

setAutoFitAxis

public void setAutoFitAxis(boolean autoFitAxis)
Specifies whether axes should be autofitted.

Parameters:
autoFitAxis - Specifies whether axes should be autofitted.

getAxisDefaultMin

public double getAxisDefaultMin()
Gets the axis default minimum value.

Returns:
the axis default minimum value

setAxisDefaultMin

public void setAxisDefaultMin(double axisDefaultMin)
Sets the axis default minimum value.

Parameters:
axisDefaultMin - the new axis default minimum value

getAxisDefaultMax

public double getAxisDefaultMax()
Gets the axis default maximum value.

Returns:
the axis default maximum value

setAxisDefaultMax

public void setAxisDefaultMax(double axisDefaultMax)
Sets the axis default max.

Parameters:
axisDefaultMax - the new axis default max

getLocale

public java.util.Locale getLocale()
Returns the number format locale to be used for parsing data.

Returns:
the locale

setLocale

public void setLocale(int locale)
Sets the number format string to be used for both parsing data.

Parameters:
locale - the Number Format locale

resetToDefault

public void resetToDefault()
Restores all default settings.


log

private void log(java.lang.String message)
Prints debug information to stdout when printLog is set to true.

Parameters:
message - the message