Last update: 2011-06-23

org.proteios.core
Class PreferencesFile

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.proteios.core.PreferencesFile
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public final class PreferencesFile
extends Properties

Manages user preferences data stored in user preference file.

Author:
olle
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
PreferencesFile(User owner)
          Constructor for class PreferencesFile.
 
Method Summary
 DbControl getDbControl()
          Get the DbControl.
 FileWriter getFileWriter()
          Get FileWriter instance to preferences file (Internal use only).
 String getFromName()
          Get the "from" name to use for e-mail notification.
 int getNotificationMode()
          Get the notification mode.
 String getPreferencesFilePath()
          Get preferences file path.
 String getSmtpHost()
          Get the SMTP host to use for e-mail notification.
 List<TablePreferences> getTablePreferencesList()
          Get the table preferences list.
 int getTablePreferencesMode()
          Get the table preferences mode.
 String getToAddress()
          Get the "to" address to use for e-mail notification.
 User getUser()
          Get the user the preferences file is intended for.
 void resetTablePreferences()
          Resets user preferences for tables stored in instance variables.
 void save()
          Saves settings in user preferences file.
 void saveBackupFile()
          Save backup copy of user preferences file.
 void setDbControl(DbControl dbControl)
          Set the DbControl.
 void setFromName(String fromName)
          Set the "from" name to use for e-mail notification.
 void setNotificationMode(int notificationMode)
          Set the notification mode.
 void setSmtpHost(String smtpHost)
          Set the SMTP host to use for e-mail notification.
 void setTablePreferencesList(List<TablePreferences> tablePreferencesList)
          Set the table preferences list.
 void setTablePreferencesMode(int tablePreferencesMode)
          Set the table preferences mode.
 void setToAddress(String toAddress)
          Set the "to" address to use for e-mail notification.
 void setUser(User user)
          Set the user the preferences file is intended for.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreferencesFile

public PreferencesFile(User owner)
Constructor for class PreferencesFile. Loads user file _preferences.properties, where "" is the name of the user. It is assumed to be located in sub-directory "conf" in the user files directory.

Parameters:
owner - User The user to load preferences for.
Method Detail

getUser

public User getUser()
Get the user the preferences file is intended for.

Returns:
User The user the preferences file is intended for.

setUser

public void setUser(User user)
Set the user the preferences file is intended for.

Parameters:
user - User The user the preferences file is intended for.

getDbControl

public DbControl getDbControl()
Get the DbControl.

Returns:
DbControl The DbControl

setDbControl

public void setDbControl(DbControl dbControl)
Set the DbControl.

Parameters:
dbControl - DbControl The DbControl to use.

getPreferencesFilePath

public String getPreferencesFilePath()
Get preferences file path.

Returns:
String The preferences file path.

getSmtpHost

public String getSmtpHost()
Get the SMTP host to use for e-mail notification.

Returns:
String The SMTP host

setSmtpHost

public void setSmtpHost(String smtpHost)
Set the SMTP host to use for e-mail notification.

Parameters:
smtpHost - String The SMTP host to use for e-mail notification.

getFromName

public String getFromName()
Get the "from" name to use for e-mail notification.

Returns:
String The "from" name

setFromName

public void setFromName(String fromName)
Set the "from" name to use for e-mail notification.

Parameters:
fromName - String The "from" name to use for e-mail notification.

getToAddress

public String getToAddress()
Get the "to" address to use for e-mail notification.

Returns:
String The "to" address

setToAddress

public void setToAddress(String toAddress)
Set the "to" address to use for e-mail notification.

Parameters:
toAddress - String The "to" address to use for e-mail notification.

getNotificationMode

public int getNotificationMode()
Get the notification mode.

Returns:
int The notification mode.

setNotificationMode

public void setNotificationMode(int notificationMode)
Set the notification mode.

Parameters:
notificationMode - int The notification mode to use.

getTablePreferencesMode

public int getTablePreferencesMode()
Get the table preferences mode.

Returns:
int The table preferences mode.

setTablePreferencesMode

public void setTablePreferencesMode(int tablePreferencesMode)
Set the table preferences mode.

Parameters:
tablePreferencesMode - int The table preferences mode to use.

getTablePreferencesList

public List<TablePreferences> getTablePreferencesList()
Get the table preferences list.

Returns:
List The table preferences list.

setTablePreferencesList

public void setTablePreferencesList(List<TablePreferences> tablePreferencesList)
Set the table preferences list.

Parameters:
tablePreferencesList - List The table preferences list to set.

getFileWriter

public FileWriter getFileWriter()
Get FileWriter instance to preferences file (Internal use only).

Returns:
FileWriter The FileWriter instance to preferences file.

saveBackupFile

public void saveBackupFile()
Save backup copy of user preferences file. The name of the backup file will be equal to that of the preferences file, but with file extension ".bup".


resetTablePreferences

public void resetTablePreferences()
Resets user preferences for tables stored in instance variables.


save

public void save()
Saves settings in user preferences file.


Last update: 2011-06-23