Class ApplicationStore

java.lang.Object
org.opentrafficsim.editor.ApplicationStore

public class ApplicationStore extends Object
Stores preferences, recently opened files, etc.

Copyright (c) 2024-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
  • Constructor Details

    • ApplicationStore

      public ApplicationStore(String enterpriseName, String applicationName)
      Constructor. Properties are stored under "{user.home}/{enterprise}/{application}.ini".
      Parameters:
      enterpriseName - String; name of the enterprise.
      applicationName - String; name of the application.
  • Method Details

    • getProperty

      public String getProperty(String key)
      Returns the property value.
      Parameters:
      key - String; key.
      Returns:
      String; property value, or null if no value is given.
    • setProperty

      public void setProperty(String key, String value)
      Sets a property value.
      Parameters:
      key - String; key.
      value - String; value.
    • getRecentFiles

      public List<String> getRecentFiles(String key)
      Returns recent files.
      Parameters:
      key - String; key under which files are stored.
      Returns:
      List<String>; files (recent to old).
    • addRecentFile

      public void addRecentFile(String key, String file)
      Add recent file. If the file is already in the list, it is moved to the front.
      Parameters:
      key - String; key under which files are stored.
      file - String; latest file.
    • removeRecentFile

      public void removeRecentFile(String key, String file)
      Clears a recent file.
      Parameters:
      key - String; key.
      file - String; file.
    • clearProperty

      public void clearProperty(String key)
      Removes key from the store.
      Parameters:
      key - String; key.