Top Description Fields Constructors Methods
com.sun.scenario

public Class Settings

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map, java.util.concurrent.CopyOnWriteArrayList, com.sun.javafx.tk.Toolkit, javafx.util.Callback

A simple class to store and retrieve internal Scenario settings in the form of String key/value pairs. It is meant to be used in a similar way to System Properties, but without the security restrictions. This class is designed primarily to aid in testing and benchmarking Scenario itself. If you are running in an environment that allows System Property access, this class will attempt to look for a key's value in the System Properties if none is found in Settings. This allows Settings to be set on the command line as well as via the Settings API.

Field Summary

Modifier and TypeField and Description
private final CopyOnWriteArrayList<Callback<String, Void>>
private final Map<String, String>
private static final Object

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
addPropertyChangeListener(Callback<String, Void> pcl)

Add a PropertyChangeListener for the specified setting Note that the PropertyChangeEvent will contain old and new values as they would be returned from get(), meaning they may come from the System Properties.

private void
private void
public static String
get(String key)

Retrieve the value for the given key.

public static boolean
getBoolean(String key)

Convenience method for boolean settings.

public static boolean
getBoolean(String key, boolean defaultVal)

Convenience method for boolean settings.

private boolean
private boolean
getBooleanImpl(String key, boolean defaultVal)

private String
private static synchronized Settings
public static int
getInt(String key, int defaultVal)

Convenience method for int settings.

private int
getIntImpl(String key, int defaultVal)

public static void
removePropertyChangeListener(Callback<String, Void> pcl)

Remove the specified PropertyChangeListener.

private void
public static void
set(String key, String value)

Add a new key-value setting.

private void
setImpl(String key, String value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

listenersback to summary
private final CopyOnWriteArrayList<Callback<String, Void>> listeners
settingsback to summary
private final Map<String, String> settings
SETTINGS_KEYback to summary
private static final Object SETTINGS_KEY

Constructor Detail

Settingsback to summary
private Settings()

Method Detail

addPropertyChangeListenerback to summary
public static void addPropertyChangeListener(Callback<String, Void> pcl)

Add a PropertyChangeListener for the specified setting Note that the PropertyChangeEvent will contain old and new values as they would be returned from get(), meaning they may come from the System Properties. If key is "" or null, this methods throws an IllegalArgumentException. If listener is null no exception is thrown and no action is taken.

addPropertyChangeListenerImplback to summary
private void addPropertyChangeListenerImpl(Callback<String, Void> pcl)
checkKeyArgback to summary
private void checkKeyArg(String key)
getback to summary
public static String get(String key)

Retrieve the value for the given key. If the key is not present in Settings or its value is null, this methods then checks to see if a value for this key is present in the System Properties (provided you have sufficient privileges). If no value can be found for the given key, this method returns null. If key is "" or null, this methods throws an IllegalArgumentException.

getBooleanback to summary
public static boolean getBoolean(String key)

Convenience method for boolean settings. If the setting exists and its value is "true", true is returned. Otherwise, false is returned. If key is "" or null, this methods throws an IllegalArgumentException.

getBooleanback to summary
public static boolean getBoolean(String key, boolean defaultVal)

Convenience method for boolean settings. If the setting is set to "true", true is returned. If the setting is set to "false", false is returned. It the setting is set to anything else, defaultVal is returned. If key is "" or null, this methods throws an IllegalArgumentException.

getBooleanImplback to summary
private boolean getBooleanImpl(String key)
getBooleanImplback to summary
private boolean getBooleanImpl(String key, boolean defaultVal)
getImplback to summary
private String getImpl(String key)
getInstanceback to summary
private static synchronized Settings getInstance()
getIntback to summary
public static int getInt(String key, int defaultVal)

Convenience method for int settings. If the setting exists and its value can be parsed to an int, the int value is returned. Otherwise, the default value is returned. If key is "" or null, this methods throws an IllegalArgumentException.

getIntImplback to summary
private int getIntImpl(String key, int defaultVal)
removePropertyChangeListenerback to summary
public static void removePropertyChangeListener(Callback<String, Void> pcl)

Remove the specified PropertyChangeListener. If listener is null, or was never added, no exception is thrown and no action is taken.

removePropertyChangeListenerImplback to summary
private void removePropertyChangeListenerImpl(Callback<String, Void> pcl)
setback to summary
public static void set(String key, String value)

Add a new key-value setting. Passing a value of null indicates that the value for this key should be looked for in the System Properties. If PropertyChangeListeners have been registered for the given key, they will be notified of a change in value. If key is "" or null, this methods throws an IllegalArgumentException.

setImplback to summary
private void setImpl(String key, String value)