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 - name of the enterprise.
      applicationName - name of the application.
  • Method Details

    • getProperty

      public Optional<String> getProperty(String key)
      Returns the property value.
      Parameters:
      key - key.
      Returns:
      property value, empty if no value is given.
    • setProperty

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

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

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

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

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

      public Color getColor(String key)
      Returns color of given key.
      Parameters:
      key - key
      Returns:
      color
    • getInt

      public int getInt(String key)
      Returns int for given key.
      Parameters:
      key - key
      Returns:
      int