Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.display
Class Prefs

    java.lang.Object
      sim.display.Prefs

    public class Prefs

extends java.lang.Object

A simple cover class for Java's preferences system. MASON has both global and application-specific preferences. Each Preferences object is associated with a unique namespace hung under the global Preferences or under an application-specific preferences. You are responsible for defining the namespace for your particular object. Typically it's a single unique word like "Display2D" or "Bugaboo". Do not include periods, whitespace, or begin or end with a slash.

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.

Field Summary
`static java.lang.String` | `APP_PREFERENCES`
`static java.lang.String` | `MASON_PREFERENCES`

Constructor Summary
`Prefs()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MASON_PREFERENCES

    public static final java.lang.String MASON_PREFERENCES

See Also:
  Constant Field Values

### APP_PREFERENCES

    public static final java.lang.String APP_PREFERENCES

See Also:
  Constant Field Values

Constructor Detail

### Prefs

    public Prefs()

Method Detail

### getGlobalPreferences

    public static java.util.prefs.Preferences getGlobalPreferences(java.lang.String namespace)

  Returns the global preferences for MASON, with the given additional prefix as a namespace.

### getAppPreferences

    public 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.

### removeGlobalPreferences

    public static boolean removeGlobalPreferences(java.lang.String namespace)

  Deletes certain global preferences for MASON, with the given additional prefix as a namespace.

### removeAppPreferences

    public static boolean removeAppPreferences(GUIState simulation,
                                               java.lang.String namespace)

  Deletes certain app-specific preferences for MASON, with the given additional prefix as a namespace.

### save

    public static boolean save(java.util.prefs.Preferences prefs)

  Saves a given Preferences.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD