Package org.opentrafficsim.editor
Class ApplicationStore
java.lang.Object
org.opentrafficsim.editor.ApplicationStore
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 Summary
ConstructorsConstructorDescriptionApplicationStore(String enterpriseName, String applicationName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRecentFile(String key, String file) Add recent file.voidclearProperty(String key) Removes key from the store.getProperty(String key) Returns the property value.getRecentFiles(String key) Returns recent files.voidremoveRecentFile(String key, String file) Clears a recent file.voidsetProperty(String key, String value) Sets a property value.
-
Constructor Details
-
ApplicationStore
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
Returns the property value.- Parameters:
key- String; key.- Returns:
- String; property value, or
nullif no value is given.
-
setProperty
Sets a property value.- Parameters:
key- String; key.value- String; value.
-
getRecentFiles
Returns recent files.- Parameters:
key- String; key under which files are stored.- Returns:
- List<String>; files (recent to old).
-
addRecentFile
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
Clears a recent file.- Parameters:
key- String; key.file- String; file.
-
clearProperty
Removes key from the store.- Parameters:
key- String; key.
-