resources
Class Settings

java.lang.Object
  extended by resources.Settings
All Implemented Interfaces:
java.io.Serializable

public class Settings
extends java.lang.Object
implements java.io.Serializable

A collection of keys (names) and associated String values. Standard component types use settings to control how cards are laid out and to localize text for the game language. The main application uses settings to control program behaviour and store user preferences.

Settings values are scoped. Within a given scope a setting key can have a different value than it would in another scope. If a key is not defined at the current scope, then the value in the parent scope (if any) will be used instead.

The most common place where where a scoping is encountered is in the private settings managed by every game component. When you change the value of a key in a component's private settings, the new value is visible only to that component. This can be used to customize an existing standard component, for example, by changing the images normally used for its card faces.

At the highest level in the scope chain for every Settings object there is a common global scope. This scope contains the settings made up from the default values for the application, changes applied because of the game language setting, and user settings (representing user preferences that persist between sessions). (Technically, these are actually different scopes, but from the point of view of users of this class that is rarely significant.) You can obtain a Settings instance that represents the global scope by calling Settings.getShared().

See Also:
Serialized Form

Nested Class Summary
static class Settings.Colour
          A specialized Color that is more easily converted to or from a setting value.
static class Settings.Region
          A specialized Rectangle that is more easily converted to or from a setting value.
static class Settings.Region2D
          A specialized Rectangle that is more easily converted to or from a setting value.
 
Field Summary
static java.beans.PropertyChangeListener DEBUG_LISTENER
          A PropertyChangeListener that will print diagnostic information to the script console whenever a key's value changes.
 
Constructor Summary
Settings()
          Creates a new Settings scope whose parent is the shared global scope.
Settings(Settings parent)
          Create a new settings scope within the scope of parent.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener for this scope.
 void addSettingsFrom(java.util.Map<java.lang.String,java.lang.String> settings)
          Add settings stored in a resource file to this settings object.
 void addSettingsFrom(java.lang.String resource)
          Add settings stored in a resource file to this settings object.
 boolean applyWindowSettings(java.lang.String prefix, java.awt.Window window)
          Restores the position and size of a window from the last time its settings were stored in this settings object.
static java.awt.Color color(java.lang.String value)
          Cover method for #colour(value).
static java.awt.Color colour(java.lang.String value)
          Parses a Color from a string in the same way that getColour(java.lang.String) does.
 javax.swing.Icon createIcon(java.lang.String key)
          Deprecated.  
 Settings createNamespace(java.lang.String namespace)
          Return a view of this Settings instance within a namespace; all keys accessed through the returned Settings will add the namespace prefix to their keys.
static PageShape.CupShape cupShape(java.lang.String value)
           
 void flush()
          If this settings object is backed by a persistent store, then this method will immediately write the settings to the store.
static Settings forProperties(java.util.Properties p)
          Creates a Settings view of Properties object.
 java.lang.String get(java.lang.String key)
          Return a setting value, or null if it is not defined.
 java.lang.String get(java.lang.String key, java.lang.String defaultValue)
          Returns a setting value, or a default value if it is not defined.
 boolean getBoolean(java.lang.String key)
          This is a cover for getYesNo(java.lang.String).
 java.awt.Color getColor(java.lang.String key)
          A cover method for getColour( key ).
 java.awt.Color getColour(java.lang.String key)
          Parse an RRGGBB colour from key + "-colour".
 PageShape getCupShape(java.lang.String key)
          Return a CupShape for shaping mark-up text from the value of key + "-shape".
 double getDouble(java.lang.String key)
          Return a double based on the value of key.
 java.lang.String getExpansionSymbol()
           
 int getExtraRegionType(java.lang.String key, int index)
          Parse an extra region type from a key + "-extra-" + index "-type".
 float getFloat(java.lang.String key)
          Return a float based on the value of key.
 java.lang.String getFootnoteSymbol(int index)
          Return the footnote symbol for the indexth footnote.
 javax.swing.Icon getIconResource(java.lang.String key)
          Return an Icon from an image resource pointed to by key.
 java.awt.image.BufferedImage getImageResource(java.lang.String key)
          Return a BufferedImage from an image resource pointed to by key.
 int getInt(java.lang.String key)
          Return an integer value based on the value of key.
 java.util.Set<java.lang.String> getKeySet()
          Returns an immutable set of all of the keys that have values defined at this scope.
 java.awt.image.BufferedImage getNumberedImageResource(java.lang.String base, int number)
          Get an image resource that follows a numbered sequence by replacing "00" in the the file name with the requested number.
 java.lang.String getOverride(java.lang.String key)
          Return a setting value, or null if it is not defined.
 Settings getParent()
          Returns the parent scope of this Settings, or null if this is the shared scope.
 float getPointSize(java.lang.String key)
          Return a font point size from key + "-pointsize".
 java.awt.Rectangle getRegion(java.lang.String key)
          Return a Rectangle from the value of key + "-region".
 java.awt.geom.Rectangle2D.Double getRegion2D(java.lang.String key)
          Return a Rectangle from the value of key + "-region".
 java.net.URL getResourceURL(java.lang.String key)
          Returns the URL of a resource by looking up the value of key and treating it as a relative URL in the applications /resources folder.
static Settings getShared()
          Returns the Settings object that represents the shared global scope.
 java.lang.String getText(java.lang.String key)
          Returns the value of the setting formed by appending "-text" to key (key + "text").
 int getTextFittingMethod(java.lang.String key)
          Return a text-fitting method stored in key + "-text-fitting".
 java.lang.String getTextOrNull(java.lang.String key)
          Returns the value of the setting formed by appending "-text" to key (key + "text").
 float[] getTint(java.lang.String key)
          Parse a tint from a comma separated list of three numbers from key + "-tint".
static Settings getUser()
          Returns the Settings object that represents user settings.
 java.util.Set<java.lang.String> getVisibleKeySet()
          Returns an immutable set of all of the keys that are visible from this scope (including all parent scopes).
 boolean getYesNo(java.lang.String key)
          Return a boolean value based on the value of key.
static int integer(java.lang.String value)
          Parse a string into an integer value.
static double number(java.lang.String value)
          Parse a string into a double value.
static java.awt.Rectangle region(java.lang.String value)
          Parse a string into an integer region.
static java.awt.geom.Rectangle2D.Double region2D(java.lang.String value)
          Parse a string into a double precision region.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener that was previously added to this Settings.
 void reset(java.lang.String key)
          Removes a key from this scope, returning the key to whatever value it has in the parent scope.
 void set(java.lang.String key, java.lang.String value)
          Sets the value of a key at this scope.
 void setSettings(java.lang.String... keyValuePairs)
          Set mulitple key, value pairs in a single call.
 int size()
          Returns the number of keys that are defined at this scope.
 void storeWindowSettings(java.lang.String prefix, java.awt.Window window)
          Saves the position of a window for later recall by writing it as a group of settings.
static float[] tint(java.lang.String value)
          Given a string, parse into into a tint value.
 java.lang.String toString()
          Returns a string that uniquely identifies this scope.
static void traceSetting(Settings scope, java.lang.String key)
          A debugging aid that prints tracing information for a key, relative to the scope defined by a particular Settings object.
 void traceSetting(java.lang.String key)
          Print tracing information for a key to the script console from the scope of this Settings object.
static boolean yesNo(java.lang.String value)
          Convert a string into a boolean value using the same rules as those used by getYesNo(java.lang.String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_LISTENER

public static final java.beans.PropertyChangeListener DEBUG_LISTENER
A PropertyChangeListener that will print diagnostic information to the script console whenever a key's value changes.

Constructor Detail

Settings

public Settings()
Creates a new Settings scope whose parent is the shared global scope.


Settings

public Settings(Settings parent)
Create a new settings scope within the scope of parent. Passing null or Settings.getShared() for the parent will use the shared global scope.

Parameters:
parent - the parent scope that will be used to look up keys not defined in this scope
Since:
2.00.7
Method Detail

forProperties

public static Settings forProperties(java.util.Properties p)
Creates a Settings view of Properties object. The Settings is backed by the Properties instance; changes to one affect the other.

Parameters:
p -
Returns:

getParent

public Settings getParent()
Returns the parent scope of this Settings, or null if this is the shared scope.

Returns:
the parent scope that will be used to look up keys not defined in this scope
Since:
2.00.7

createNamespace

public Settings createNamespace(java.lang.String namespace)
Return a view of this Settings instance within a namespace; all keys accessed through the returned Settings will add the namespace prefix to their keys. As long as the name is unique keys in the returned Settings will be private to it and not conflict with keys with the same name but a different namespace. (This may fail to hold if the naming conventions for keys names are not followed.)

Parameters:
namespace - the space to create a view for
Returns:
a view of this Settings that is confined to the namespace
Since:
2.1 alpha 1

getKeySet

public java.util.Set<java.lang.String> getKeySet()
Returns an immutable set of all of the keys that have values defined at this scope. Keys that are visible from this scope because they exist in a parent scope, but which are not actually defined in this scope, are not included. To get all of the keys that are visible from this scope, use getVisibleKeySet() instead.

Note that the set returned by this is a copy of the keys at the time that this method was called. It is not updated as this Settings instance is modified.

Returns:
a set of the names of the keys that have been set at this scope

getVisibleKeySet

public java.util.Set<java.lang.String> getVisibleKeySet()
Returns an immutable set of all of the keys that are visible from this scope (including all parent scopes).

Note that the set returned by this is a copy of the keys at the time that this method was called. It is not updated as this Settings instance is modified. Be aware that

Returns:
a set of the names of the keys that have been set at this scope
Since:
2.00.7

size

public int size()
Returns the number of keys that are defined at this scope. Additional keys may be visible from this scope if they are defined in a parent scope. If you need to know the total number of unique keys that are visible from this scope, use this.getVisibleKeySet().size().

Returns:
the number of keys that have been defined within this scope

getShared

public static Settings getShared()
Returns the Settings object that represents the shared global scope.

Currently, attempting to set or reset a setting key in the shared scope will cause an UnsupportedOperationException to be thrown, although this may change in the future.

Returns:
the shared global settings scope

getUser

public static Settings getUser()
Returns the Settings object that represents user settings. User settings are used to store data that must persist between program runs, such as the recent file list and preference choices. Because user settings take precedence over the standard Strange Eons settings, it can also be used to permanently modify a layout setting at the global scope. This is not usually recommended. The preferred way to achieve this is to write an extension that temporarily changes the setting for the duration of the program run. This way, the extension can be uninstalled to eliminate the effect.

Note that user settings can be read through the shared scope. Using the user scope directly is mainly useful for writing settings that will persist.

The user settings scope should not be used to store preference settings for a plug-in. Instead, use PluginContext#setPluginSetting(java.lang.String, java.lang.String). Using this method ensures that your setting names will not conflict with standard SE settings or preferecnes from other plug-ins.

Returns:
the shared user settings scope
Since:
2.00.8

get

public java.lang.String get(java.lang.String key)
Return a setting value, or null if it is not defined.

Parameters:
key - the key to fetch the value of
Returns:
the value of key, or null

get

public java.lang.String get(java.lang.String key,
                            java.lang.String defaultValue)
Returns a setting value, or a default value if it is not defined.

Parameters:
key - the key to fetch the value of
defaultValue - the default value to return if get(key) == null
Returns:
the value of the key, or its default

getOverride

public java.lang.String getOverride(java.lang.String key)
Return a setting value, or null if it is not defined. This method searches only the local scope without delegating to parent scopes.

Parameters:
key - the key to fetch the value of
Returns:
the value of key, or null

set

public void set(java.lang.String key,
                java.lang.String value)
Sets the value of a key at this scope.

Parameters:
key - the key to whose value at this scope should be changed
value - the value to set for this scope

reset

public void reset(java.lang.String key)
Removes a key from this scope, returning the key to whatever value it has in the parent scope.

Parameters:
key - the key to be remove

setSettings

public void setSettings(java.lang.String... keyValuePairs)
Set mulitple key, value pairs in a single call.

Parameters:
keyValuePairs -

addSettingsFrom

public void addSettingsFrom(java.lang.String resource)
                     throws java.io.IOException
Add settings stored in a resource file to this settings object. The resource file must use the same syntax as the standard setting files. Namely, definitions formatted as key = value lines.

Parameters:
resource - a file relative to the resources folder
Throws:
java.io.IOException

addSettingsFrom

public void addSettingsFrom(java.util.Map<java.lang.String,java.lang.String> settings)
Add settings stored in a resource file to this settings object. The resource file must use the same syntax as the standard setting files. Namely, definitions formatted as key = value lines.

Parameters:
resource - a file relative to the resources folder
Throws:
java.io.IOException

flush

public void flush()
If this settings object is backed by a persistent store, then this method will immediately write the settings to the store. Otherwise, it has no effect.

The only standard settings object that is backed by a persistent store is the user settings object obtained with getUser(). Calling this method on the user settings object will immediately write user settings to the user settings file (typically, ~/.strange-eons-settings). (User settings will always be flushed during program shutdown.)

Since:
2.00.8

getText

public java.lang.String getText(java.lang.String key)
Returns the value of the setting formed by appending "-text" to key (key + "text"). If no such setting is defined, the string "[UNDEFINED: " + key + "]" is returned instead.

Parameters:
key - the name of a text key, less -text
Returns:
the value of the key, or a special undefined string if the key does not exist

getTextOrNull

public java.lang.String getTextOrNull(java.lang.String key)
Returns the value of the setting formed by appending "-text" to key (key + "text"). If no such setting is defined, returns null.

Parameters:
key - the name of a text key, less -text
Returns:
the value of the key, or null

getFootnoteSymbol

public java.lang.String getFootnoteSymbol(int index)
Return the footnote symbol for the indexth footnote. Footnote symbol settings are stored in a sequence of keys of the form footnote-symboln-text, where n is the value of index. Footnote numbers start at 1 and there are guaranteed to be as many unique symbols as the value of this.getInt( "footnote-symbol" ). (The global scope currently provides four unique symbols.) If there is no unique symbol for the requested index, a unique footnote symbol consisting of multiple copies of an existing symbol will be generated.

Parameters:
index - the footnote number, starting from 1
Returns:
the symbol for the indexth footnote, or null if the number of symbols is exceeded
Throws:
java.lang.IndexOutOfBoundsException - if index < 1
See Also:
#getInt(key)

getYesNo

public boolean getYesNo(java.lang.String key)
Return a boolean value based on the value of key. Any of "yes", "true", or "1" are mapped to true, and all other values are mapped to false.

Parameters:
key - the name of the setting key
Returns:
true if the value of the setting is "yes", "true", or "1"

getBoolean

public final boolean getBoolean(java.lang.String key)
This is a cover for getYesNo(java.lang.String).

Parameters:
key - the name of the setting key
Returns:
true if the value of the setting is "yes", "true", or "1"

yesNo

public static final boolean yesNo(java.lang.String value)
Convert a string into a boolean value using the same rules as those used by getYesNo(java.lang.String).

Parameters:
value - the value to parse
Returns:
true if the value is "yes", "true", or "1"

getInt

public int getInt(java.lang.String key)
Return an integer value based on the value of key. The conversion of the value is performed as if by integer(java.lang.String).

Parameters:
key - the name of the setting key
Returns:
the integer value of the setting

integer

public static int integer(java.lang.String value)
Parse a string into an integer value. The value must be in the range Integer.MIN_VALUE + 1 to Integer.MAX_VALUE, inclusive. The value is parsed identically to Integer.valueOf(String), except that it is legal for the value to begin with a plus sign (which is ignored) or a decimal point (the number is parsed only up to the decimal point). If the value cannot be parsed, Integer.MIN_VALUE is returned.

Parameters:
value - the string to convert to an integer
Returns:
the converted value, or Integer.MIN_VALUE

getFloat

public float getFloat(java.lang.String key)
Return a float based on the value of key. The conversion of the value is performed similarly to number(java.lang.String), except that float precision is used throughout the conversion.

Parameters:
key - the name of the setting key
Returns:
the float value of the setting, or Float.NaN

getDouble

public double getDouble(java.lang.String key)
Return a double based on the value of key. The conversion of the value is performed as if by number(java.lang.String).

Parameters:
key - the name of the setting key
Returns:
the double value of the setting, or Double.NaN

number

public static double number(java.lang.String value)
Parse a string into a double value. The value is parsed identically to Double.valueOf(String). If the value cannot be parsed, Double.NaN is returned.

Parameters:
value - the string to convert to a floating-point number
Returns:
the converted value, or Double.NaN

getColour

public java.awt.Color getColour(java.lang.String key)
Parse an RRGGBB colour from key + "-colour". Fatal error if key undefined.

Parameters:
the - name of a key, less -colour, that names a colour value
Returns:
a colour obtained by interpreting value in either RRGGBB or AARRGGBB formats
See Also:
colour(java.lang.String)

getColor

public final java.awt.Color getColor(java.lang.String key)
A cover method for getColour( key ).

Parameters:
the - name of a key, less -colour that names a colour value
Returns:
a colour obtained by interpreting value in either RRGGBB or AARRGGBB formats
See Also:
colour(java.lang.String)

colour

public static final java.awt.Color colour(java.lang.String value)
Parses a Color from a string in the same way that getColour(java.lang.String) does. Returns null if it is unable to parse the string.

The string is taken to be a hexadecimal number which consists of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. Optionally, bits 24-31 describe an alpha value. If the length of value if 6 characters or less (RRGGBB) then the alpha value will be set to FF (that is, 255, or completely opaque).

Parameters:
value - a string of six or eight hex digits to parse
Returns:
a colour obtained by interpreting value in either RRGGBB or AARRGGBB formats
Since:
2.00.7

color

public static final java.awt.Color color(java.lang.String value)
Cover method for #colour(value).

Parameters:
value - a string of six or eight hex digits to parse
Returns:
a colour obtained by interpreting value in either RRGGBB or AARRGGBB formats
Since:
2.00.7

getTint

public float[] getTint(java.lang.String key)
Parse a tint from a comma separated list of three numbers from key + "-tint". A tint is a relative colour described in terms of shifts to the hue, saturation, and brightness of a source colour. Tints can be applied to an image using the filters in ca.cgjennings.graphics.filters.

Parameters:
the - name of a key, less -tint, that names a tint value
Returns:
a colour obtained by interpreting value in either RRGGBB or AARRGGBB formats
See Also:
colour(java.lang.String)

tint

public static final float[] tint(java.lang.String value)
Given a string, parse into into a tint value. A tint is a relative colour described in terms of shifts to the hue, saturation, and brightness of a source colour. Tints can be applied to an image using the filters in ca.cgjennings.graphics.filters. A tint is described using a list of comma-separated floating point numbers. The first number is an angle, in degrees, that describes the shift to apply to the hue. The second number is a relative saturation factor (normally between 0 and 1). The third number is a relative brightness (normally greater than or equal to 0). The exact effect of these values depends on the filter used. The tint is returned as an array of three float values. The hue is converted to the range -1 to 1. The other two values are unchanged. This function returns null if it is unable to parse the tint string.

Parameters:
value - a tint string consisting of three numbers separated by commas: h,s,b
Returns:
an array describing the tint that can be passed to tinting filters
Since:
2.00.7

getResourceURL

public java.net.URL getResourceURL(java.lang.String key)
Returns the URL of a resource by looking up the value of key and treating it as a relative URL in the applications /resources folder. This folder consists of the resources stored in the main application file, as well as the contents of the /resources folders stored in any installed plug-in bundles, libraries, or themes. Note that if there is a naming conflict, resources obtained with this method will prefer the main application's resources over any add-ons.

Parameters:
key - a key whose value is a resource URL
Returns:
the location of the resource, if it exists, or null

getRegion

public java.awt.Rectangle getRegion(java.lang.String key)
Return a Rectangle from the value of key + "-region". The returned rectangle is limited to integer precision. If the requested region is not defined, or its is formatted incorrectly, this method displays an error and returns a dummy region.

Parameters:
key - the key whose value should be parsed, less <-region

getRegion2D

public java.awt.geom.Rectangle2D.Double getRegion2D(java.lang.String key)
Return a Rectangle from the value of key + "-region". If the requested region is not defined, returns null. If it is formatted incorrectly, this method logs an error and returns a dummy region. this method returns null.

Parameters:
key - the key whose value should be parsed, less <-region

getCupShape

public PageShape getCupShape(java.lang.String key)
Return a CupShape for shaping mark-up text from the value of key + "-shape". If the requested shape is not defined, returns null. If it is formatted incorrectly, this method logs an error and returns a dummy shape.

Parameters:
key - the key whose value should be parsed, less <-shape
Since:
2.1

region

public static final java.awt.Rectangle region(java.lang.String value)
Parse a string into an integer region. The region is described by four comma-separated integersm which give the x- and y-coordinates of the upper left corner, the width, and the height.

Note: Since 2.00.8, the object returned is an instance of Settings.Region.

Parameters:
value - the comma separated coordinate string to parse
Returns:
the region represented by value, or null

region2D

public static final java.awt.geom.Rectangle2D.Double region2D(java.lang.String value)
Parse a string into a double precision region. The region is described by four comma-separated numbers which give the x- and y-coordinates of the upper left corner, the width, and the height. Note: Since 2.00.8, the object returned is an instance of Settings.Region2D.

Parameters:
value - the comma separated coordinate string to parse
Returns:
the region represented by value, or null

cupShape

public static final PageShape.CupShape cupShape(java.lang.String value)

getPointSize

public float getPointSize(java.lang.String key)
Return a font point size from key + "-pointsize".

Parameters:
key - the base name of a key whose value is a point size

getTextFittingMethod

public int getTextFittingMethod(java.lang.String key)
Return a text-fitting method stored in key + "-text-fitting". The value is mapped to a text-fitting constant as follows:
 "none"    MarkupRenderer.FIT_NONE
 "spacing" MarkupRenderer.FIT_TIGHTEN_LINE_SPACING
 "scaling" MarkupRenderer.FIT_SCALE_TEXT
 "both"    MarkupRenderer.FIT_BOTH
 

Parameters:
key - the key, less -text-fitting to obtain a fitting value from
Returns:
a text fitting constant suitable for use with a MarkupRenderer.

getExtraRegionType

public int getExtraRegionType(java.lang.String key,
                              int index)
Parse an extra region type from a key + "-extra-" + index "-type". Extra regions are used by some sheets as a way to support a specific game language. The value is converted to a CharacterSheet constant as follows:
 "left"   CharacterSheet.EXTRA_REGION_LEFT
 "center" CharacterSheet.EXTRA_REGION_CENTER
 "body"   CharacterSheet.EXTRA_REGION_BODY
 


getExpansionSymbol

public java.lang.String getExpansionSymbol()

getImageResource

public java.awt.image.BufferedImage getImageResource(java.lang.String key)
Return a BufferedImage from an image resource pointed to by key. This will convert the value of key into a resource URL using getResourceURL(java.lang.String), then create an image from the resulting resource.

The format of the image is guaranteed to be one of three types. If the image does not contain alpha data, then it is normalized to BufferedImage.TYPE_INT_RGB. If it does contain alpha data, then the type will either be BufferedImage.TYPE_INT_ARGB or BufferedImage.TYPE_INT_ARGB_PRE. The later type is returned only if the global boolean settings key premultiply-image-alpha is true.

Parameters:
key - a key whose value points to an image file
Returns:
the image

getNumberedImageResource

public java.awt.image.BufferedImage getNumberedImageResource(java.lang.String base,
                                                             int number)
Get an image resource that follows a numbered sequence by replacing "00" in the the file name with the requested number. If number is less than 10, the replacement will use two digits (01 instead of 1).

This method takes the base file name directly, not the key that points to the base file name. As a result, its use normally follows the pattern:

 settings.getNumberedImageResource( settings.get( key ), number );
 


getIconResource

public javax.swing.Icon getIconResource(java.lang.String key)
Return an Icon from an image resource pointed to by key. This will convert the value of key into a resource URL using getResourceURL(java.lang.String), then create an icon from the resulting resource.

Parameters:
key - a key whose value points to an image file
Returns:
an icon of the image
Since:
2.00.7

storeWindowSettings

public void storeWindowSettings(java.lang.String prefix,
                                java.awt.Window window)
Saves the position of a window for later recall by writing it as a group of settings. The prefix is a unique prefix for that window. To restore the position later, call applyWindowSettings(java.lang.String, java.awt.Window) using the same prefix. Usually used with the getUser() instance.

Parameters:
prefix - a unique name for the window
window - the window whose shape should be written into settings

applyWindowSettings

public boolean applyWindowSettings(java.lang.String prefix,
                                   java.awt.Window window)
Restores the position and size of a window from the last time its settings were stored in this settings object.

Parameters:
prefix - the unique prefix chosen for this window when it was stored
window - the window to be restored
Returns:
true if there were settings to restore; otherwise you should use a default placement algorithm to place the window

createIcon

@Deprecated
public javax.swing.Icon createIcon(java.lang.String key)
Deprecated. 

This is a cover for getIconResource(java.lang.String) and is provided for backward compatibility.

Parameters:
key - a key whose value points to an image file
Returns:
an icon of the image

traceSetting

public void traceSetting(java.lang.String key)
Print tracing information for a key to the script console from the scope of this Settings object.

Parameters:
key - the key to trace
See Also:
traceSetting(resources.Settings, java.lang.String)

traceSetting

public static void traceSetting(Settings scope,
                                java.lang.String key)
A debugging aid that prints tracing information for a key, relative to the scope defined by a particular Settings object. This will trace the value of key up from scope through to the shared global scope. The value of the key at each scope will be printed to the script console.

Parameters:
scope - the scope to start tracing from
key - the key whose value should be traced

toString

public java.lang.String toString()
Returns a string that uniquely identifies this scope. The shared global Settings will return "Settings (Shared)". Other scopes will return a string specifying "Private" instead of "Shared", along with a hexadecimal number that uniquely identifies this instance.

Overrides:
toString in class java.lang.Object
Returns:

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener for this scope. The listener will be notified when any key's value changes at this scope. Changes made in parent scopes will not fire an event, but you may also add listeners to each of the parent scopes.

Parameters:
listener - the listener to call when a key's value changes

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener that was previously added to this Settings.

Parameters:
listener - the listener to remove