public class ParamProperties extends Object
ParamProperties
class is used to store parameter attributes such as parameter type and description
or validation information such as minimum and maximum values. An instance of this class which implements this
interface can contain any number of attributes. The interpretation of particular attributes is handed over to
specialized parameter editors and validators.
Important note: Attribute keys must NOT contain the period (.) character.
Parameter
,
ParamEditor
,
ParamValidator
Constructor and Description |
---|
ParamProperties() |
ParamProperties(Class valueType) |
ParamProperties(Class valueType,
Number defaultValue,
Number minValue,
Number maxValue) |
ParamProperties(Class valueType,
Number defaultValue,
Number minValue,
Number maxValue,
Number increment) |
ParamProperties(Class valueType,
Object defaultValue) |
ParamProperties(Class valueType,
Object defaultValue,
String[] valueSet) |
ParamProperties(Class valueType,
Object defaultValue,
String[] valueSet,
boolean valueSetBound) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
boolean |
containsProperty(String key)
Returns
true if an attribute with given name was found. |
ParamProperties |
createCopy()
Creates and returns a copy of this object.
|
protected Map<String,Object> |
createPropertyMap(Map<String,Object> map)
Creates a
Map to be used to store the attributes. |
ParamValidator |
createValidator()
Creates an appropriate validator for this parameter info.
|
FileFilter[] |
getChoosableFileFilters()
Gets an array of
choosable FileFilter which was set in the FileChooser displayed when
the button from FileEditor was klicked. |
FileFilter |
getCurrentFileFilter()
Gets the
current FileFilter which was set in the FileChooser displayed when the button
from FileEditor was klicked. |
Object |
getDefaultValue() |
String |
getDescription() |
Class |
getEditorClass() |
int |
getFileSelectionMode() |
Number |
getIncrement() |
String |
getLabel() |
Number |
getMaxValue() |
Number |
getMinValue() |
int |
getNumCols() |
int |
getNumRows() |
String |
getPhysicalUnit() |
Map<String,Object> |
getProperties(String namePrefix)
Creates a subset of the properties in this map, containing only properties whose name start with the
given
namePrefix . |
Object |
getPropertyValue(String key)
Returns the value of the attribute with the given name.
|
boolean |
getPropertyValue(String key,
boolean defaultValue)
Returns the
boolean value of the attribute with the given name. |
Class |
getPropertyValue(String key,
Class defaultValue)
Returns the
Class value of the attribute with the given name. |
double |
getPropertyValue(String key,
double defaultValue)
Returns the
double value of the attribute with the given name. |
int |
getPropertyValue(String key,
int defaultValue)
Returns the
int value of the attribute with the given name. |
Object |
getPropertyValue(String key,
Object defaultValue)
Returns the
Object value of the attribute with the given name. |
String |
getPropertyValue(String key,
String defaultValue)
Returns the
String value of the attribute with the given name. |
Class |
getValidatorClass() |
String[] |
getValueSet() |
char |
getValueSetDelim() |
Class |
getValueType() |
boolean |
isCaseSensitive() |
boolean |
isEmptyValuesNotAllowed() |
boolean |
isHidden() |
boolean |
isIdentifiersOnly() |
boolean |
isNullValueAllowed() |
boolean |
isReadOnly() |
boolean |
isValueSetBound() |
protected Class |
loadClass(String className)
Loads the class with the specified name.
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
setCaseSensitive(boolean caseSensitive) |
void |
setChoosableFileFilters(FileFilter[] filters)
Sets an array of
choosable FileFilter used in the FileChooser displayed when the button
from FileEditor was klicked. |
void |
setCurrentFileFilter(FileFilter filter)
Sets the
current FileFilter used in the FileChooser displayed when the button from
FileEditor was klicked. |
void |
setDefaultValue(Object defaultValue) |
void |
setDescription(String description) |
void |
setEditorClass(Class editorClass) |
void |
setEmptyValuesNotAllowed(boolean emptyAllowed) |
void |
setFileSelectionMode(int fsm) |
void |
setHidden(boolean hidden) |
void |
setIdentifiersOnly(boolean identifiersOnly) |
void |
setIncrement(Number increment) |
void |
setLabel(String label) |
void |
setMaxValue(Number maxValue) |
void |
setMinValue(Number minValue) |
void |
setNullValueAllowed(boolean nullAllowed) |
void |
setNumCols(int numCols) |
void |
setNumRows(int numRows) |
void |
setPhysicalUnit(String unit) |
void |
setPropertyValue(String key,
boolean value) |
void |
setPropertyValue(String key,
double value) |
void |
setPropertyValue(String key,
float value) |
void |
setPropertyValue(String key,
int value) |
void |
setPropertyValue(String key,
long value) |
void |
setPropertyValue(String key,
Object value) |
void |
setPropertyValues(String paramName,
PropertyMap propertyMap)
Sets the properties to the values found in the given
Properties instance. |
void |
setReadOnly(boolean readOnly) |
void |
setValidatorClass(Class validatorClass) |
void |
setValueSet(String[] valueSet) |
void |
setValueSetBound(boolean valueSetBound) |
void |
setValueSetDelim(char delim) |
void |
setValueType(Class valueType) |
public static final String VALUETYPE_KEY
public static final String DEFAULTVALUE_KEY
public static final String NUMCOLS_KEY
public static final String NUMROWS_KEY
public static final String WORD_WRAP_KEY
public static final String MINVALUE_KEY
public static final String MAXVALUE_KEY
public static final String INCREMENT_KEY
public static final String VALUESET_KEY
public static final String VALUESETBOUND_KEY
public static final String VALUESETDELIM_KEY
public static final String NULLVALUEALLOWED_KEY
public static final String EMPTYVALUESNOTALLOWED_KEY
public static final String IDENTIFIERSONLY_KEY
public static final String CASESENSITIVE_KEY
public static final String READONLY_KEY
public static final String HIDDEN_KEY
public static final String LABEL_KEY
public static final String DESCRIPTION_KEY
public static final String PHYSICALUNIT_KEY
public static final String VALIDATORCLASS_KEY
public static final String EDITORCLASS_KEY
public static final String LISTMODEL_KEY
public static final String FILE_SELECTION_MODE_KEY
public static final String LAST_DIR_KEY
public static final String CHOOSABLE_FILE_FILTERS_KEY
public static final String CURRENT_FILE_FILTER_KEY
public static final String COMP_PRODUCTS_FOR_BAND_ARITHMETHIK_KEY
public static final String SEL_PRODUCT_FOR_BAND_ARITHMETHIK_KEY
public static final String SELECT_ALL_ON_FOCUS_KEY
public static final int FSM_FILES_ONLY
public static final int FSM_DIRECTORIES_ONLY
public static final int FSM_FILES_AND_DIRECTORIES
public ParamProperties()
public ParamProperties(Class valueType)
public ParamProperties(Class valueType, Object defaultValue, String[] valueSet, boolean valueSetBound)
public ParamProperties(Class valueType, Number defaultValue, Number minValue, Number maxValue)
public void addPropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void setValueType(Class valueType)
public Class getValueType()
public void setValidatorClass(Class validatorClass)
public Class getValidatorClass()
public void setEditorClass(Class editorClass)
public Class getEditorClass()
public void setDefaultValue(Object defaultValue)
public Object getDefaultValue()
public void setNumCols(int numCols)
public int getNumCols()
public void setNumRows(int numRows)
public int getNumRows()
public void setMinValue(Number minValue)
public Number getMinValue()
public void setMaxValue(Number maxValue)
public Number getMaxValue()
public void setIncrement(Number increment)
public Number getIncrement()
public void setValueSet(String[] valueSet)
public String[] getValueSet()
public void setValueSetDelim(char delim)
public char getValueSetDelim()
public void setValueSetBound(boolean valueSetBound)
public boolean isValueSetBound()
public void setNullValueAllowed(boolean nullAllowed)
public boolean isNullValueAllowed()
public void setEmptyValuesNotAllowed(boolean emptyAllowed)
public boolean isEmptyValuesNotAllowed()
public void setIdentifiersOnly(boolean identifiersOnly)
public boolean isIdentifiersOnly()
public void setCaseSensitive(boolean caseSensitive)
public boolean isCaseSensitive()
public void setReadOnly(boolean readOnly)
public boolean isReadOnly()
public void setHidden(boolean hidden)
public boolean isHidden()
public void setLabel(String label)
public String getLabel()
public void setDescription(String description)
public String getDescription()
public void setPhysicalUnit(String unit)
public String getPhysicalUnit()
public void setFileSelectionMode(int fsm)
public int getFileSelectionMode()
public void setCurrentFileFilter(FileFilter filter)
current FileFilter
used in the FileChooser
displayed when the button from
FileEditor
was klicked.filter
- a javax.swing.filechooser.FileFilterpublic FileFilter getCurrentFileFilter()
current FileFilter
which was set in the FileChooser
displayed when the button
from FileEditor
was klicked.public void setChoosableFileFilters(FileFilter[] filters)
choosable FileFilter
used in the FileChooser
displayed when the button
from FileEditor
was klicked. If no FileFilterCurrent
was set, the first
FileFilter
in this array is the current FileFilter
filters
- a javax.swing.filechooser.FileFilter[]public FileFilter[] getChoosableFileFilters()
choosable FileFilter
which was set in the FileChooser
displayed when
the button from FileEditor
was klicked.public void setPropertyValue(String key, boolean value)
public void setPropertyValue(String key, int value)
public void setPropertyValue(String key, long value)
public void setPropertyValue(String key, float value)
public void setPropertyValue(String key, double value)
public void setPropertyValues(String paramName, PropertyMap propertyMap)
Properties
instance.
This utility method searches for all keys in the given Properties
instance whose keys start with
paramName + "."
. The rest of the key is expected to be a valid ParamProperties
attribute key and the property value a corresponding textual representation of the attribute's value.
The method can be used to automatically configure parameters from Java property files.
paramName
- the parameter namepublic Map<String,Object> getProperties(String namePrefix)
namePrefix
.namePrefix
- the name prefixpublic Object getPropertyValue(String key)
null
.key
- the attribute key, must not be null
public boolean containsProperty(String key)
true
if an attribute with given name was found.key
- the attribute key, must not be null
public boolean getPropertyValue(String key, boolean defaultValue)
boolean
value of the attribute with the given name.key
- the attribute key, must not be null
defaultValue
- the default value which is returned if an attribute with the given name was not foundpublic int getPropertyValue(String key, int defaultValue)
int
value of the attribute with the given name.key
- the attribute key, must not be null
defaultValue
- the default value which is returned if an attribute with the given name was not foundpublic double getPropertyValue(String key, double defaultValue)
double
value of the attribute with the given name.key
- the attribute key, must not be null
defaultValue
- the default value which is returned if an attribute with the given name was not foundpublic Class getPropertyValue(String key, Class defaultValue)
Class
value of the attribute with the given name.key
- the attribute key, must not be null
defaultValue
- the default value which is returned if an attribute with the given name was not foundpublic String getPropertyValue(String key, String defaultValue)
String
value of the attribute with the given name.key
- the attribute key, must not be null
defaultValue
- the default value which is returned if an attribute with the given name was not foundpublic Object getPropertyValue(String key, Object defaultValue)
Object
value of the attribute with the given name.key
- the attribute key, must not be null
defaultValue
- the default value which is returned if an attribute with the given name was not foundpublic ParamValidator createValidator()
null
public ParamProperties createCopy()
protected Map<String,Object> createPropertyMap(Map<String,Object> map)
Map
to be used to store the attributes. This method can be overridden in order to return a
specialized Map
. The default implementation returns a new HashMap()
instance.map
- the map whose mappings are to be initially placed in the new map, can be null
.protected Class loadClass(String className) throws ClassNotFoundException
This method can be overridden in order to implement a specialized mechanism to load parameter validator and
editor classes. The default implementation simply returns getClass().getClassLoader().loadClass(className)
.
className
- the fully qualified name of the classClassNotFoundException
- if the class was not foundCopyright © 2002–2014 Brockmann Consult GmbH. All rights reserved.