org.jdesktop.jdic.screensaver
Class ScreensaverSettings

java.lang.Object
  extended by org.jdesktop.jdic.screensaver.ScreensaverSettings

public class ScreensaverSettings
extends java.lang.Object

Holds the currently active settings for a screensaver. Assists in persisting the settings if the underlying platform specific screensaver APIs do not do this for you (e.g. on Windows). The settings are saved to the user's home directory under .saverbeans/screensaver.properties. In order for this class to work properly, the configuration file must use '-' before each option. Boolean options must be of the form '-option' and value options must be of the form '-option value'.

Author:
Mark Roth

Constructor Summary
ScreensaverSettings()
           
 
Method Summary
 java.lang.String getNormalizedCommandline()
          Returns these settings as a normalized commandline.
 java.lang.String getProperty(java.lang.String key)
          Gets a property for this screensaver.
 void loadFromCommandline(java.lang.String loadedSettingsParam)
          Load the current settings from the given normalized commandline
 void loadSettings(java.lang.String screensaverName)
          Loads the currently selected settings from the user's home directory.
 void saveSettings(java.lang.String screensaverName)
          Saves the currently selected settings in the user's home directory.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a property for this screensaver.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreensaverSettings

public ScreensaverSettings()
Method Detail

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a property for this screensaver.

Parameters:
key - The key of the property
value - The value of the property

getProperty

public java.lang.String getProperty(java.lang.String key)
Gets a property for this screensaver.

Parameters:
key - The key to retrieve the value for
Returns:
The value associated with the given key

getNormalizedCommandline

public java.lang.String getNormalizedCommandline()
Returns these settings as a normalized commandline. Boolean options are represented as -option if set or nothing if unset. Options with values are represented as '-option value'.

Returns:
The normalized commandline

saveSettings

public void saveSettings(java.lang.String screensaverName)
Saves the currently selected settings in the user's home directory. This is provided if the underlying platform specific screensaver APIs do not do this for you (e.g. on Windows). If an error occurs, it is ignored.

Parameters:
screensaverName - The key to store the settings under in the properties file.

loadSettings

public void loadSettings(java.lang.String screensaverName)
Loads the currently selected settings from the user's home directory.

Parameters:
screensaverName - The key to load the settings from in the properties file.

loadFromCommandline

public void loadFromCommandline(java.lang.String loadedSettingsParam)
Load the current settings from the given normalized commandline

Parameters:
loadedSettingsParam - The settings to be loaded, in normalized commandline form.
See Also:
getNormalizedCommandline()