net.sf.doolin.gui.service.support
Class PropertyFileGUIPreferences

java.lang.Object
  extended by net.sf.doolin.gui.service.support.AbstractGUIPreferences
      extended by net.sf.doolin.gui.service.support.PropertyFileGUIPreferences
All Implemented Interfaces:
GUIPreferences

public class PropertyFileGUIPreferences
extends AbstractGUIPreferences

This implementation saves preferences in a local property file.

Author:
Damien Coraboeuf

Constructor Summary
PropertyFileGUIPreferences()
           
 
Method Summary
 void delete(String key)
          Deletes a preference entry.
 Boolean getBoolean(String key, Boolean defaultValue)
          Get a preference value as a boolean
 File getFile(String key)
          Gets a preference value as a file.
 String getFilePath()
          Gets the relative file path to the preferences file.
 Integer getInt(String key, Integer defaultValue)
          Get a preference value as an integer
 Long getLong(String key, Long defaultValue)
          Get a preference value as a long
 String getString(String key, String defaultValue)
          Get a preference value as a string
protected  void init()
          Lazily initialises the preferences by loading them.
protected  void load()
          Actually loads the preferences.
 void save()
          Saves the preferences in the back store
 void setBoolean(String key, Boolean value)
          Sets a preference value as a string
 void setFile(String key, File file)
          Sets a preference value as a file.
 void setFilePath(String filePath)
          Sets the relative file path to the preferences file (may be local).
 void setInt(String key, Integer value)
          Sets a preference value as an integer
 void setLong(String key, Long value)
          Sets a preference value as a long
 void setString(String key, String value)
          Sets a preference value as a string
 
Methods inherited from class net.sf.doolin.gui.service.support.AbstractGUIPreferences
restoreMemento, saveMemento
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyFileGUIPreferences

public PropertyFileGUIPreferences()
Method Detail

getFilePath

public String getFilePath()
Gets the relative file path to the preferences file.

Returns:
Relative file path

setFilePath

public void setFilePath(String filePath)
Sets the relative file path to the preferences file (may be local).

Parameters:
filePath - Relative file path

init

protected void init()
Lazily initialises the preferences by loading them.

See Also:
load()

load

protected void load()
Actually loads the preferences.


delete

public void delete(String key)
Description copied from interface: GUIPreferences
Deletes a preference entry.

Parameters:
key - Preference entry key

getBoolean

public Boolean getBoolean(String key,
                          Boolean defaultValue)
Description copied from interface: GUIPreferences
Get a preference value as a boolean

Parameters:
key - Preference key
defaultValue - Default value if the key is not defined
Returns:
Preference value

getFile

public File getFile(String key)
Description copied from interface: GUIPreferences
Gets a preference value as a file.

Parameters:
key - Preference key
Returns:
File or null if not found

getInt

public Integer getInt(String key,
                      Integer defaultValue)
Description copied from interface: GUIPreferences
Get a preference value as an integer

Parameters:
key - Preference key
defaultValue - Default value if the key is not defined
Returns:
Preference value

getLong

public Long getLong(String key,
                    Long defaultValue)
Description copied from interface: GUIPreferences
Get a preference value as a long

Parameters:
key - Preference key
defaultValue - Default value if the key is not defined
Returns:
Preference value

getString

public String getString(String key,
                        String defaultValue)
Description copied from interface: GUIPreferences
Get a preference value as a string

Parameters:
key - Preference key
defaultValue - Default value if the key is not defined
Returns:
Preference value

save

public void save()
Description copied from interface: GUIPreferences
Saves the preferences in the back store


setBoolean

public void setBoolean(String key,
                       Boolean value)
Description copied from interface: GUIPreferences
Sets a preference value as a string

Parameters:
key - Preference key
value - Value to store

setFile

public void setFile(String key,
                    File file)
Description copied from interface: GUIPreferences
Sets a preference value as a file.

Parameters:
key - Preference key
file - File to store

setInt

public void setInt(String key,
                   Integer value)
Description copied from interface: GUIPreferences
Sets a preference value as an integer

Parameters:
key - Preference key
value - Value to store

setLong

public void setLong(String key,
                    Long value)
Description copied from interface: GUIPreferences
Sets a preference value as a long

Parameters:
key - Preference key
value - Value to store

setString

public void setString(String key,
                      String value)
Description copied from interface: GUIPreferences
Sets a preference value as a string

Parameters:
key - Preference key
value - Value to store


Copyright © 2011. All Rights Reserved.