com.ryanm.config
Interface Configurator

All Known Implementing Classes:
AbstractConfigurator, AnnotatedConfigurator, GLMaterialConfigurator, SpeckPosition.Configurator, StringSink.StringSinkConfigurator

public interface Configurator

The Configurator object provides information about variables, and methods to change them.

Author:
ryanm

Field Summary
static java.lang.Class ACTION_TYPE
          Type flag for actions.
static java.lang.Class BOOLEAN_TYPE
          Type flag for boolean variables.
static java.lang.Class COLOUR_TYPE
          Type flag for colour variables.
static java.lang.Class FILE_TYPE
          Type flag for file variables.
static java.lang.Class FLOAT_TYPE
          Type flag for float variables.
static java.lang.Class INT_TYPE
          Type flag for integer Variables.
static java.lang.Class STRING_LIST_TYPE
          Type flag for string lists.
static java.lang.Class STRING_TYPE
          Type flag for String variables.
static java.lang.Class VECTOR_TYPE
          Type flag for Vector variables.
 
Method Summary
 void addConfiguratorListener(ConfiguratorListener listener)
          Registers a ConfiguratorListener to this configuration.
 void addValueListener(ValueListener listener)
          Registers a ValueListener to this configuration.
 java.lang.String getDescription()
          Gets a descriptive string for this Configurator
 java.lang.String getDescription(java.lang.String name)
          Gets a descriptive string for a variable, such as could be put in a tooltip
 java.lang.String getName()
          Gets the name of this configurator.
 java.lang.Object[] getNames()
          Gets the names of all configurable variables.
 Configurator getParent()
          Gets a reference to the Configurator that contains this configurator.
 java.lang.String getPath()
          Gets a "/" separated sequence of configurator names that lead to this configurator
 java.lang.Object getRange(java.lang.String name)
          Gets an object that describes the range for a variable.
 java.lang.Class getType(java.lang.String name)
          Gets the type of a given variable
 java.lang.Object getValue(java.lang.String name)
          Gets the current value of a variable.
 boolean isGUIEnabled(java.lang.String variable)
          Gets the status of a variable's widgets, vis-a-vis enablement
 void removeConfiguratorListener(ConfiguratorListener listener)
          Removes a ConfiguratorListener.
 void removeValueListener(ValueListener listener)
          Removes a ValueListener.
 void setGUIEnabled(java.lang.String variable, boolean enabled, java.lang.Object key)
          Enables or disables any widgets associated with a particular variable.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets the value of a variable
 

Field Detail

BOOLEAN_TYPE

static final java.lang.Class BOOLEAN_TYPE
Type flag for boolean variables. Boolean objects should be passed into, and expected out of, the configurator. No range can be specified


INT_TYPE

static final java.lang.Class INT_TYPE
Type flag for integer Variables. Integer objects should be passed into the Configurator, Number objects expected out. Range should be specified as a float[] array, with min and max values as the first two elements. Missing or Float.NaN values mean no limit


FLOAT_TYPE

static final java.lang.Class FLOAT_TYPE
Type flag for float variables. Float objects should be passed into the configurator, Number objects expected out. Range should be specified as a two-element float array, with min and max values ass the first two elements. Missing or Float.NaN values mean no limit


STRING_TYPE

static final java.lang.Class STRING_TYPE
Type flag for String variables. String objects should be passed into, and expected out of, the configurator. Range should be specified as a string array containing acceptable values


VECTOR_TYPE

static final java.lang.Class VECTOR_TYPE
Type flag for Vector variables. Vector3f objects should be passed into, and expected out of, the configurator. Range can be specified by a 6-element float array in { minx, miny, minz, maxx, maxy, maxz } order. A null limit can be specified by using Float.NaN. or omitting that element


COLOUR_TYPE

static final java.lang.Class COLOUR_TYPE
Type flag for colour variables. Color objects should be passed into, and expected out of, the configurator. No range can be specified


FILE_TYPE

static final java.lang.Class FILE_TYPE
Type flag for file variables. File objects should be passed into, and expected out of, the configurator. Range can be specified with a String array containing acceptable file suffixes


ACTION_TYPE

static final java.lang.Class ACTION_TYPE
Type flag for actions. No objects should be expected out of the configurator, objects passed in will be ignored. Range is not appropriate


STRING_LIST_TYPE

static final java.lang.Class STRING_LIST_TYPE
Type flag for string lists. String[] objects should be passed into, and expected out of, the configurator. Range can be specified as a String array containing acceptable values

Method Detail

getName

java.lang.String getName()
Gets the name of this configurator. This name must not contain any "/", "#" or ":" characters

Returns:
the name of this configurator

getNames

java.lang.Object[] getNames()
Gets the names of all configurable variables. The array of objects returned can consist of two types:

Returns:
A list of Objects defining the variables and sub-configurators

getType

java.lang.Class getType(java.lang.String name)
Gets the type of a given variable

Parameters:
name - The name of the variable
Returns:
The type of the variable, or null if no type has been set

getDescription

java.lang.String getDescription(java.lang.String name)
Gets a descriptive string for a variable, such as could be put in a tooltip

Parameters:
name - The variable to describe
Returns:
A descriptive string for the variable

getDescription

java.lang.String getDescription()
Gets a descriptive string for this Configurator

Returns:
A descriptive String for the configurator

getRange

java.lang.Object getRange(java.lang.String name)
Gets an object that describes the range for a variable. This will be different for different types of variables. A numerical variable could have a 2-element array describing the min and max values, a String variable could have a list of possible values, a file type could have a list of acceptable file suffixes.

Parameters:
name - The variable to get the range for
Returns:
An object describing the range

getValue

java.lang.Object getValue(java.lang.String name)
Gets the current value of a variable.

Parameters:
name - The name of the variable to inspect
Returns:
The current value of the variable

setValue

void setValue(java.lang.String name,
              java.lang.Object value)
Sets the value of a variable

Parameters:
name - The name of the variable to set
value - The new value of that variable

addValueListener

void addValueListener(ValueListener listener)
Registers a ValueListener to this configuration. All listeners should be notified whenever a variable is changed.

Parameters:
listener - The listener to add

removeValueListener

void removeValueListener(ValueListener listener)
Removes a ValueListener. The specified listener will no longer receive notification about variable changes.

Parameters:
listener - The listener to remove

addConfiguratorListener

void addConfiguratorListener(ConfiguratorListener listener)
Registers a ConfiguratorListener to this configuration. All listeners should be notified whenever the Configurator is altered

Parameters:
listener - The listener to add

removeConfiguratorListener

void removeConfiguratorListener(ConfiguratorListener listener)
Removes a ConfiguratorListener. The specified listener will no longer receive notification about Configurator changes

Parameters:
listener - The listener to remove

setGUIEnabled

void setGUIEnabled(java.lang.String variable,
                   boolean enabled,
                   java.lang.Object key)
Enables or disables any widgets associated with a particular variable. When a variable is disabled with a particular key object, it cannot be enabled again without using the same key object.

Parameters:
variable - The name of the variable to alter
enabled - true to enable, false to disable
key - The locking object

isGUIEnabled

boolean isGUIEnabled(java.lang.String variable)
Gets the status of a variable's widgets, vis-a-vis enablement

Parameters:
variable - The variable to query
Returns:
true if enabled, false otherwise

getPath

java.lang.String getPath()
Gets a "/" separated sequence of configurator names that lead to this configurator

Returns:
the path to this configurator

getParent

Configurator getParent()
Gets a reference to the Configurator that contains this configurator.

Returns:
The parent configurator, or null if this is a root configurator