Class JosmComboBoxModel.Preferences
- java.lang.Object
-
- org.openstreetmap.josm.gui.widgets.JosmComboBoxModel.Preferences
-
- Enclosing class:
- JosmComboBoxModel<E>
public final class JosmComboBoxModel.Preferences extends java.lang.Object
Loads and saves the model to the JOSM preferences.Obtainable through
JosmComboBoxModel.prefs(java.util.function.Function<java.lang.String, E>, java.util.function.Function<E, java.lang.String>).
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePreferences(java.util.function.Function<java.lang.String,E> readE, java.util.function.Function<E,java.lang.String> writeE)Private constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>asStringList()Returns the model elements as list of strings.voidload(java.lang.String key)Loads the model from the JOSM preferences.voidload(java.lang.String key, java.util.List<java.lang.String> defaults)Loads the model from the JOSM preferences.voidload(ListProperty prop)Loads the model from the JOSM preferences.voidsave(java.lang.String key)Saves the model to the JOSM preferences.voidsave(ListProperty prop)Saves the model to the JOSM preferences.
-
-
-
Constructor Detail
-
Preferences
private Preferences(java.util.function.Function<java.lang.String,E> readE, java.util.function.Function<E,java.lang.String> writeE)
Private constructor- Parameters:
readE- AFunctionthat builds an<E>from aString.writeE- AFunctionthat serializes an<E>to aString
-
-
Method Detail
-
load
public void load(java.lang.String key)
Loads the model from the JOSM preferences.- Parameters:
key- The preferences key
-
load
public void load(java.lang.String key, java.util.List<java.lang.String> defaults)
Loads the model from the JOSM preferences.- Parameters:
key- The preferences keydefaults- A list of default values.
-
load
public void load(ListProperty prop)
Loads the model from the JOSM preferences.- Parameters:
prop- The property holding the strings.
-
asStringList
public java.util.List<java.lang.String> asStringList()
Returns the model elements as list of strings.- Returns:
- a list of strings
-
save
public void save(java.lang.String key)
Saves the model to the JOSM preferences.- Parameters:
key- The preferences key
-
save
public void save(ListProperty prop)
Saves the model to the JOSM preferences.- Parameters:
prop- The property to write to.
-
-