public class ParamGroup extends Object
ParamGroup
class represents a ordered list of parameters.Constructor and Description |
---|
ParamGroup()
Constructs a new parameter group.
|
Modifier and Type | Method and Description |
---|---|
void |
addParamChangeListener(ParamChangeListener listener)
Adds a parameter change listener to all parameters in this group.
|
void |
addParameter(Parameter parameter)
Adds the given parameter to this group.
|
static ParamGroup |
create(PropertyMap propertyMap)
Adds and configures parameters supplied through the given properties.
|
Parameter |
createParameter(String name)
Creates a parameter for the given name.
|
int |
getNumParameters()
Returns the number of parameters in this group.
|
Parameter |
getParameter(String name)
Returns the parameter with the given name.
|
Parameter |
getParameterAt(int index)
Returns the parameter with the given index.
|
int |
getParameterIndex(String name)
Returns the index of the parameter with the given name.
|
PropertyMap |
getParameterValues()
Gets the parameter values in this group as a property map instance.
|
PropertyMap |
getParameterValues(PropertyMap propertyMap)
Gets the parameter values in this group as a property map instance.
|
void |
removeParamChangeListener(ParamChangeListener listener)
Removes the parameter change listener from all parameters in this group.
|
void |
removeParameter(Parameter parameter)
Removes the given parameter from this group.
|
void |
setParameterValues(PropertyMap propertyMap,
ParamExceptionHandler handler)
Sets parameter values supplied through the given property map.
|
public static ParamGroup create(PropertyMap propertyMap)
For each entry in the properties having the form any-string.name = param-name
the
method creates a new parameter with the name given by param-name if it does not already exists in this
list. Then, for each entry of the form param-name.attrib-name = attrib-value
contained in the given properties, the method sets/creates a new parameter attribute for the parameter's
getProperties()
field.
If a parameter found in the properties has the null
value, the method sets the value of this
parameter to the value given by param-name.defaultValue = default-value
, if it can be
found in the properties.
propertyMap
- the properties used to add and configure new parametersParameter.getProperties()
,
ParamProperties
public void setParameterValues(PropertyMap propertyMap, ParamExceptionHandler handler)
For each parameter contained in this list having the name param-name this method searches for entries
in the property ma having the form param-name = param-value
. If it can be found, the
parameter is set to the given textual value using the parameter's setValueAsText
method.
propertyMap
- the property map, must not be null
handler
- an optional error handler, can be null
Parameter.setValueAsText(java.lang.String)
public PropertyMap getParameterValues()
Simply returns getParameterValues(null)
.
null
getParameterValues(PropertyMap)
public PropertyMap getParameterValues(PropertyMap propertyMap)
For each parameter contained in this list a new entry in the property map instance is created. The key is
always the paramer's name and the value is created by using the parameter's getValueAsText
method.
propertyMap
- if not null
used as return value, otherwise a new Properties
instance will be created and returnednull
Parameter.getValueAsText()
public int getNumParameters()
public Parameter getParameterAt(int index)
index
- the parameter indexIndexOutOfBoundsException
- if the index is negative or greater or equal to getNumParameters()
.public Parameter getParameter(String name)
null
if the a parameter with the given name was not found in this grouppublic Parameter createParameter(String name)
null
public int getParameterIndex(String name)
-1
is returned.-1
if it was not foundpublic void addParameter(Parameter parameter)
null
or the parameter already exists in
this group, nothing happens.parameter
- the parameter to be addedpublic void removeParameter(Parameter parameter)
null
or the parameter does not
exists in this group, nothing happens.parameter
- the parameter to be removedpublic void addParamChangeListener(ParamChangeListener listener)
listener
- the listener to be added to all parameterspublic void removeParamChangeListener(ParamChangeListener listener)
listener
- the listener to be removed from all parametersCopyright © 2002–2014 Brockmann Consult GmbH. All rights reserved.