Class JaxoPrefs

java.lang.Object
net.sf.jaxodraw.util.JaxoPrefs

public final class JaxoPrefs extends Object
Responsible for importing/exporting user preferences.
Since:
2.0
  • Field Details

  • Method Details

    • getRecentFiles

      public static String[] getRecentFiles()
      Returns an array of recently opened files.
      Returns:
      An array containing the absolute paths of recently opened files or empty Strings.
    • setRecentFiles

      public static void setRecentFiles(String[] filePaths)
      Set the recently opened files to the given array of absolute path names.
      Parameters:
      filePaths - the absolute path names. If an entry is null, it will be replaced by an empty String.
    • clearRecentFiles

      public static void clearRecentFiles()
      Sets all recent files to empty Strings.
    • addRecentFile

      public static void addRecentFile(String st)
      Adds the given absolute path name to the list of recntly opened files.
      Parameters:
      st - an absolute path name.
    • getStringPref

      public static String getStringPref(String name)
      Returns the preference with 'name' as a String, or throws a IllegalArgumentException if it does not correspond to a String.
      Parameters:
      name - The name of the preference.
      Returns:
      The preference with 'name'.
    • getIntPref

      public static int getIntPref(String name)
      Returns the preference with 'name' as an integer, or throws a IllegalArgumentException if it does not correspond to an int.
      Parameters:
      name - The name of the preference.
      Returns:
      The preference with 'name'.
    • getFloatPref

      public static float getFloatPref(String name)
      Returns the preference with 'name' as a float, or throws a IllegalArgumentException if it does not correspond to a float.
      Parameters:
      name - The name of the preference.
      Returns:
      The preference with 'name'.
    • getBooleanPref

      public static boolean getBooleanPref(String name)
      Returns the preference with 'name' as a boolean, or throws a IllegalArgumentException if it does not correspond to a boolean.
      Parameters:
      name - The name of the preference.
      Returns:
      The preference with 'name'.
    • setStringPref

      public static void setStringPref(String name, String str)
      Sets the preference with 'name' to the string str.
      Parameters:
      name - The name of the preference to be set.
      str - the preference to be set.
    • setIntPref

      public static void setIntPref(String name, int newPref)
      Sets the preference with 'name' to the int value newPref.
      Parameters:
      name - The name of the preference to be set.
      newPref - The preference to be set.
    • setFloatPref

      public static void setFloatPref(String name, float newPref)
      Sets the preference with 'name' to the float value of newPref.
      Parameters:
      name - The name of the preference to be set.
      newPref - The preference to be set.
    • setBooleanPref

      public static void setBooleanPref(String name, boolean newPref)
      Sets the preference with 'name' to the boolean value of newPref.
      Parameters:
      name - The name of the preference to be set.
      newPref - The preference to be set.
    • getState

      public static Map<String,Object> getState()
      State of preferences. The only use is to restore the current state later (after having made temporary changes) with setState(java.util.Map).
      Returns:
      Object
    • setState

      public static void setState(Map<String,Object> value)
      Restore the preferences to a previous state.
      Parameters:
      value - previous state to be set, obtained from getState().
    • initSessionPrefs

      public static void initSessionPrefs()
      Sets the Preferences for the current session from the Preferences node.
    • resetPref

      public static void resetPref(String name)
      Re-sets the given Preference to its default value.
      Parameters:
      name - the name of the preference to re-set.
    • savePrefs

      public static void savePrefs()
      Saves the current set of Preferences to the user Preferences node, so they will be used in later sessions.
    • saveRecentFiles

      public static void saveRecentFiles()
      Saves the last visited files in the Preferences node.