Class JESConfig

java.lang.Object
  extended by JESConfig

public class JESConfig
extends java.lang.Object

Represents a set of JES configuration information. There is only one instance of this class, because the configuration values are used in many places. The class loads and stores its data in a .properties file. It also can read and write old files that stored the property values one per line in a predefined order.


Field Summary
static java.lang.String CONFIG_AUTOSAVEONRUN
          Whether to save files automatically on load.
static java.lang.String CONFIG_BACKUPSAVE
          Whether to save backup files.
static java.lang.String CONFIG_BLOCK
          Whether to help the user indent with an indentation block.
static java.lang.String CONFIG_COMMAND_WINDOW_THEME
          The command-window color scheme.
static java.lang.String CONFIG_FONT
          The interface font size.
static java.lang.String CONFIG_GUTTER
          Whether to display line numbers.
static java.lang.String CONFIG_MEDIAPATH
          The last-used media path.
static java.lang.String CONFIG_MODE
          The selected interface mode.
static java.lang.String CONFIG_RECENT_FILES
          The list of recent files.
static java.lang.String CONFIG_SKIN
          The Java UI skin.
static java.lang.String CONFIG_WRAPPIXELVALUES
          Whether to wrap red/blue/green values from 0 to 255.
static java.lang.String DEFAULT_FILE_NAME
          The default name of the modern JES .properties files.
static int FONT_SIZE_MAX
           
static int FONT_SIZE_MAXREC
           
static int FONT_SIZE_MIN
           
static java.lang.String MIGRATION_FILE_NAME
          The default name of the legacy JESConfig.txt files.
static java.lang.String MODE_BEGINNER
           
static java.lang.String MODE_EXPERT
           
 
Method Summary
 boolean getBooleanProperty(java.lang.String property)
          Reads a property from the settings as a Boolean.
static java.io.File getConfigFile()
          Returns a File pointing to the current configuration file, as indicated by the jes.configfile property.
static java.io.File getDefaultConfigFile()
          Returns a File pointing to the default configuration file location, independent of the current platform.
static JESConfig getInstance()
          Returns the one instance of JESConfig, loading the configuration files in the process.
 int getIntegerProperty(java.lang.String property)
          Reads a property from the settings as an integer.
 java.io.IOException getLoadError()
          Returns the most recent load error.
static java.io.File getMigrationConfigFile()
          Returns a File pointing to the location of the configuration file used before JES 5.0.
 java.lang.String getStringProperty(java.lang.String property)
          Reads a property from the settings.
 boolean isModified()
          Indicates that a property has been added to the configuration since it was loaded.
 void loadConfig()
          Reads a file full of properties.
 void setBooleanProperty(java.lang.String property, boolean value)
          Sets a property and stores it as a Boolean.
 void setIntegerProperty(java.lang.String property, int value)
          Sets a property and stores it as an integer.
 void setStringProperty(java.lang.String property, java.lang.String value)
          Sets a property.
 boolean wasLoaded()
          Indicates that the configuration was loaded from a file.
 boolean wasMigrated()
          Indicates that the configuration was loaded from an configuration file from before JES 5.0.
 void writeConfig()
          Method to write the current JES settings to the file user.home/JES_CONFIG_FILE_NAME
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_WRAPPIXELVALUES

public static final java.lang.String CONFIG_WRAPPIXELVALUES
Whether to wrap red/blue/green values from 0 to 255.

See Also:
Constant Field Values

CONFIG_MEDIAPATH

public static final java.lang.String CONFIG_MEDIAPATH
The last-used media path.

See Also:
Constant Field Values

CONFIG_MODE

public static final java.lang.String CONFIG_MODE
The selected interface mode.

See Also:
Constant Field Values

MODE_BEGINNER

public static final java.lang.String MODE_BEGINNER
See Also:
Constant Field Values

MODE_EXPERT

public static final java.lang.String MODE_EXPERT
See Also:
Constant Field Values

CONFIG_SKIN

public static final java.lang.String CONFIG_SKIN
The Java UI skin.

See Also:
Constant Field Values

CONFIG_COMMAND_WINDOW_THEME

public static final java.lang.String CONFIG_COMMAND_WINDOW_THEME
The command-window color scheme.

See Also:
Constant Field Values

CONFIG_FONT

public static final java.lang.String CONFIG_FONT
The interface font size.

See Also:
Constant Field Values

FONT_SIZE_MIN

public static final int FONT_SIZE_MIN
See Also:
Constant Field Values

FONT_SIZE_MAX

public static final int FONT_SIZE_MAX
See Also:
Constant Field Values

FONT_SIZE_MAXREC

public static final int FONT_SIZE_MAXREC
See Also:
Constant Field Values

CONFIG_GUTTER

public static final java.lang.String CONFIG_GUTTER
Whether to display line numbers.

See Also:
Constant Field Values

CONFIG_BLOCK

public static final java.lang.String CONFIG_BLOCK
Whether to help the user indent with an indentation block.

See Also:
Constant Field Values

CONFIG_AUTOSAVEONRUN

public static final java.lang.String CONFIG_AUTOSAVEONRUN
Whether to save files automatically on load.

See Also:
Constant Field Values

CONFIG_BACKUPSAVE

public static final java.lang.String CONFIG_BACKUPSAVE
Whether to save backup files.

See Also:
Constant Field Values

CONFIG_RECENT_FILES

public static final java.lang.String CONFIG_RECENT_FILES
The list of recent files.

See Also:
Constant Field Values

DEFAULT_FILE_NAME

public static final java.lang.String DEFAULT_FILE_NAME
The default name of the modern JES .properties files.

See Also:
Constant Field Values

MIGRATION_FILE_NAME

public static final java.lang.String MIGRATION_FILE_NAME
The default name of the legacy JESConfig.txt files.

See Also:
Constant Field Values
Method Detail

getConfigFile

public static java.io.File getConfigFile()
Returns a File pointing to the current configuration file, as indicated by the jes.configfile property. If that property is not set, then the default config file is used.


getDefaultConfigFile

public static java.io.File getDefaultConfigFile()
Returns a File pointing to the default configuration file location, independent of the current platform. (This is usually not ideal.)


getMigrationConfigFile

public static java.io.File getMigrationConfigFile()
Returns a File pointing to the location of the configuration file used before JES 5.0.


getInstance

public static JESConfig getInstance()
Returns the one instance of JESConfig, loading the configuration files in the process.


loadConfig

public void loadConfig()
Reads a file full of properties.


writeConfig

public void writeConfig()
Method to write the current JES settings to the file user.home/JES_CONFIG_FILE_NAME


wasLoaded

public boolean wasLoaded()
Indicates that the configuration was loaded from a file.


wasMigrated

public boolean wasMigrated()
Indicates that the configuration was loaded from an configuration file from before JES 5.0. It will be saved to a .properties file when it's written out.


isModified

public boolean isModified()
Indicates that a property has been added to the configuration since it was loaded.


getLoadError

public java.io.IOException getLoadError()
Returns the most recent load error.


getStringProperty

public java.lang.String getStringProperty(java.lang.String property)
Reads a property from the settings.

Parameters:
property - The name of the property. You should use one of the JESConfig.CONFIG_* constants.
Returns:
The string value, or "" if the value is unset.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String property)
Reads a property from the settings as a Boolean.

Parameters:
property - The name of the property. You should use one of the JESConfig.CONFIG_* constants.
Returns:
The boolean value, or false if the value is unset.

getIntegerProperty

public int getIntegerProperty(java.lang.String property)
Reads a property from the settings as an integer.

Parameters:
property - The name of the property. You should use one of the JESConfig.CONFIG_* constants.
Returns:
The integral value, or 0 if the value is unset.

setStringProperty

public void setStringProperty(java.lang.String property,
                              java.lang.String value)
Sets a property.

Parameters:
property - The name of the property. You should use one of the JESConfig.CONFIG_* constants.
value - The value to set for the property.

setIntegerProperty

public void setIntegerProperty(java.lang.String property,
                               int value)
Sets a property and stores it as an integer.

Parameters:
property - The name of the property. You should use one of the JESConfig.CONFIG_* constants.
value - The value to set for the property.

setBooleanProperty

public void setBooleanProperty(java.lang.String property,
                               boolean value)
Sets a property and stores it as a Boolean.

Parameters:
property - The name of the property. You should use one of the JESConfig.CONFIG_* constants.
value - The value to set for the property.