public class JSONPreferenceControl
extends java.lang.Object
PreferenceControl
that uses
JSON instead of XMLModifier and Type | Field and Description |
---|---|
static java.lang.String |
PREFERENCE_CONTROL |
static java.lang.String |
SAVE_MODIFIED |
static int |
VERSION |
Constructor and Description |
---|
JSONPreferenceControl() |
Modifier and Type | Method and Description |
---|---|
void |
addSerializer(JSONPreferenceSerializer s) |
static JSONPreferenceControl |
getInstance() |
java.util.List<JSONPreferenceSerializer> |
getSerializers() |
void |
initDefaults(MapView mapView) |
boolean |
load(java.io.File file) |
boolean |
load(java.io.File file,
boolean readOnly) |
boolean |
load(java.io.File file,
JSONPreferenceSerializer serializer) |
boolean |
load(java.io.File file,
JSONPreferenceSerializer serializer,
boolean readOnly)
Load preferences using a specific serializer
|
void |
removeSerializer(JSONPreferenceSerializer s) |
boolean |
save(java.io.File file)
Save all preferences to a file
|
boolean |
save(java.io.File file,
JSONPreferenceSerializer serializer)
Save preferences to file
|
static boolean |
writeJSONFile(java.io.File file,
org.json.JSONObject root) |
public static final java.lang.String PREFERENCE_CONTROL
public static final int VERSION
public static final java.lang.String SAVE_MODIFIED
public static JSONPreferenceControl getInstance()
public void initDefaults(MapView mapView)
public void addSerializer(JSONPreferenceSerializer s)
public void removeSerializer(JSONPreferenceSerializer s)
public java.util.List<JSONPreferenceSerializer> getSerializers()
public boolean save(java.io.File file, JSONPreferenceSerializer serializer)
file
- File to save toserializer
- Serializer to use (null to use all registered)public boolean save(java.io.File file)
file
- File to save topublic boolean load(java.io.File file, JSONPreferenceSerializer serializer, boolean readOnly)
file
- Preferences fileserializer
- Preference reader (null to run through all)readOnly
- Do not allow modification of the preferences herepublic boolean load(java.io.File file, JSONPreferenceSerializer serializer)
public boolean load(java.io.File file, boolean readOnly)
public boolean load(java.io.File file)
public static boolean writeJSONFile(java.io.File file, org.json.JSONObject root)