public class Prefs
extends java.lang.Object
Once you have retrieved the Preferences object and modified it, you must save it before MASON is terminated.
How this works with Java's Preferences: All preferences start with a certain path and then add a namespace onto it. Global preferences have a path which starts with "edu/gmu/mason/global/" -- Display2D's namespace is "Display2D", so for example, Display2D's global preferences are "edu/gmu/mason/global/Display2D". App-specific preferences also have unique paths. For example, HeatBugs's preferences path is "edu/gmu/mason/app/sim/app/heatbugs/", so Display2D's app preferences, when used with Heatbugs, is "edu/gmu/mason/app/sim/app/heatbugs/Display2D". You don't need to be concerned with this if you just want to retrieve and/or delete preferences objects.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APP_PREFERENCES |
static java.lang.String |
MASON_PREFERENCES |
Constructor and Description |
---|
Prefs() |
Modifier and Type | Method and Description |
---|---|
static java.util.prefs.Preferences |
getAppPreferences(GUIState simulation,
java.lang.String namespace)
Returns app-specific preferences for MASON, with the given additional prefix as a namespace.
|
static java.util.prefs.Preferences |
getGlobalPreferences(java.lang.String namespace)
Returns the global preferences for MASON, with the given additional prefix as a namespace.
|
static boolean |
removeAppPreferences(GUIState simulation,
java.lang.String namespace)
Deletes certain app-specific preferences for MASON, with the given additional prefix as a namespace.
|
static boolean |
removeGlobalPreferences(java.lang.String namespace)
Deletes certain global preferences for MASON, with the given additional prefix as a namespace.
|
static boolean |
save(java.util.prefs.Preferences prefs)
Saves a given Preferences.
|
public static final java.lang.String MASON_PREFERENCES
public static final java.lang.String APP_PREFERENCES
public static java.util.prefs.Preferences getGlobalPreferences(java.lang.String namespace)
public static java.util.prefs.Preferences getAppPreferences(GUIState simulation, java.lang.String namespace)
public static boolean removeGlobalPreferences(java.lang.String namespace)
public static boolean removeAppPreferences(GUIState simulation, java.lang.String namespace)
public static boolean save(java.util.prefs.Preferences prefs)