|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ryanm.config.imp.AbstractConfigurator
public abstract class AbstractConfigurator
Eases implementation of a configurator. Handles all requirements of a configurator, subclasses need only concern themselves with defining variables, and getting/setting values.
| Field Summary |
|---|
| Fields inherited from interface com.ryanm.config.Configurator |
|---|
ACTION_TYPE, BOOLEAN_TYPE, COLOUR_TYPE, FILE_TYPE, FLOAT_TYPE, INT_TYPE, STRING_LIST_TYPE, STRING_TYPE, VECTOR_TYPE |
| Constructor Summary | |
|---|---|
|
AbstractConfigurator(java.lang.String name)
Constructs a new AbstractConfigurator |
protected |
AbstractConfigurator(java.lang.String name,
java.lang.String description)
Constructs a new AbstractConfigurator |
| Method Summary | |
|---|---|
void |
addConfiguratorListener(ConfiguratorListener listener)
Registers a ConfiguratorListener to this configuration. |
void |
addValueListener(ValueListener listener)
Registers a ValueListener to this configuration. |
void |
addVariable(Configurator conf)
Adds a sub-configurator |
void |
addVariable(java.lang.String variable)
Adds a variable to this configurator |
protected abstract void |
applyValue(java.lang.String name,
java.lang.Object value)
This should be overridden to actually apply the new value |
void |
buildPaths()
This should be called on the root configurator to build configurator path information |
static void |
copyValues(Configurator source,
Configurator sink)
Sets the values of the sink Configurator's variables to
be the same as the source Configurator. |
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 |
boolean |
pathsBuilt()
Determines whether or not the paths have been built for this configurator |
void |
removeConfiguratorListener(ConfiguratorListener listener)
Removes a ConfiguratorListener. |
void |
removeValueListener(ValueListener listener)
Removes a ValueListener. |
void |
removeVariable(java.lang.Object variable)
Removes a variable or subconfigurator from this configurator |
abstract java.lang.Object |
retrieveValue(java.lang.String name)
Get the current value of the named variable |
void |
setDescription(java.lang.String name,
java.lang.String desc)
Sets the description for a variable |
void |
setGUIEnabled(java.lang.String variable,
boolean b,
java.lang.Object key)
Enables or disables any widgets associated with a particular variable. |
void |
setRange(java.lang.String name,
java.lang.Object bounds)
Sets the bounds for a variable. |
void |
setType(java.lang.String name,
java.lang.Class type)
Sets the type of a variable |
void |
setValue(java.lang.String name,
java.lang.Object value)
Sets the value of a variable |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractConfigurator(java.lang.String name)
name - The name for this configurator
protected AbstractConfigurator(java.lang.String name,
java.lang.String description)
name - The name for this configuratordescription - A decsriptive string for this configurator| Method Detail |
|---|
public final java.lang.String getName()
Configurator
getName in interface Configuratorpublic java.lang.Object[] getNames()
Configurator
getNames in interface Configuratorpublic void addVariable(java.lang.String variable)
variable - The name of the variable, or the Configurator object
itself, to addpublic void addVariable(Configurator conf)
conf - The configurator to addpublic void removeVariable(java.lang.Object variable)
variable - The name of the variable, or the configurator object,
to removepublic java.lang.Class getType(java.lang.String name)
Configurator
getType in interface Configuratorname - The name of the variable
public void setType(java.lang.String name,
java.lang.Class type)
name - The name of the variable to settype - The type identifier of the variablepublic java.lang.String getDescription(java.lang.String name)
Configurator
getDescription in interface Configuratorname - The variable to describe
public java.lang.String getDescription()
Configurator
getDescription in interface Configurator
public void setDescription(java.lang.String name,
java.lang.String desc)
name - The name of the variable to describedesc - The description for the variablepublic java.lang.Object getRange(java.lang.String name)
Configurator
getRange in interface Configuratorname - The variable to get the range for
public void setRange(java.lang.String name,
java.lang.Object bounds)
Configurator for examples of the default types
name - The variable to constrainbounds - The bounds object
public final void setValue(java.lang.String name,
java.lang.Object value)
Configurator
setValue in interface Configuratorname - The name of the variable to setvalue - The new value of that variable
protected abstract void applyValue(java.lang.String name,
java.lang.Object value)
name - The name of the variable to changevalue - The new value of that variablepublic java.lang.Object getValue(java.lang.String name)
Configurator
getValue in interface Configuratorname - The name of the variable to inspect
public abstract java.lang.Object retrieveValue(java.lang.String name)
name - The name of the variable
public java.lang.String getPath()
Configurator
getPath in interface Configuratorpublic void addValueListener(ValueListener listener)
Configurator
addValueListener in interface Configuratorlistener - The listener to addpublic void removeValueListener(ValueListener listener)
Configurator
removeValueListener in interface Configuratorlistener - The listener to removepublic void addConfiguratorListener(ConfiguratorListener listener)
Configurator
addConfiguratorListener in interface Configuratorlistener - The listener to addpublic void removeConfiguratorListener(ConfiguratorListener listener)
Configurator
removeConfiguratorListener in interface Configuratorlistener - The listener to remove
public void setGUIEnabled(java.lang.String variable,
boolean b,
java.lang.Object key)
Configurator
setGUIEnabled in interface Configuratorvariable - The name of the variable to alterb - true to enable, false to disablekey - The locking objectpublic boolean isGUIEnabled(java.lang.String variable)
Configurator
isGUIEnabled in interface Configuratorvariable - The variable to query
public Configurator getParent()
Configurator
getParent in interface Configuratorpublic void buildPaths()
public boolean pathsBuilt()
public java.lang.String toString()
toString in class java.lang.Object
public static void copyValues(Configurator source,
Configurator sink)
Configurator's variables to
be the same as the source Configurator. Variables with
the same name will have their values copied accross. This
process will recurse into sub-configurators
source - The source of the configurationsink - The configurator to change
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||