Package org.esa.snap.core.param
Class ParamProperties
java.lang.Object
org.esa.snap.core.param.ParamProperties
The
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.
- Version:
- $Revision$ $Date$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
File selection mode JFileChooser.DIRECTORIES_ONLYstatic final int
File selection mode JFileChooser.FILES_AND_DIRECTORIESstatic final int
File selection mode JFileChooser.FILES_ONLYstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionParamProperties
(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) -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
containsProperty
(String key) Returnstrue
if an attribute with given name was found.Creates and returns a copy of this object.createPropertyMap
(Map<String, Object> map) Creates aMap
to be used to store the attributes.Creates an appropriate validator for this parameter info.Gets an array ofchoosable FileFilter
which was set in theFileChooser
displayed when the button fromFileEditor
was klicked.Gets thecurrent FileFilter
which was set in theFileChooser
displayed when the button fromFileEditor
was klicked.int
getLabel()
int
int
getProperties
(String namePrefix) Creates a subset of the properties in this map, containing only properties whose name start with the givennamePrefix
.getPropertyValue
(String key) Returns the value of the attribute with the given name.boolean
getPropertyValue
(String key, boolean defaultValue) Returns theboolean
value of the attribute with the given name.double
getPropertyValue
(String key, double defaultValue) Returns thedouble
value of the attribute with the given name.int
getPropertyValue
(String key, int defaultValue) Returns theint
value of the attribute with the given name.getPropertyValue
(String key, Class defaultValue) Returns theClass
value of the attribute with the given name.getPropertyValue
(String key, Object defaultValue) Returns theObject
value of the attribute with the given name.getPropertyValue
(String key, String defaultValue) Returns theString
value of the attribute with the given name.String[]
char
boolean
boolean
boolean
isHidden()
boolean
boolean
boolean
boolean
protected Class
Loads the class with the specified name.void
void
setCaseSensitive
(boolean caseSensitive) void
setChoosableFileFilters
(FileFilter[] filters) Sets an array ofchoosable FileFilter
used in theFileChooser
displayed when the button fromFileEditor
was klicked.void
setCurrentFileFilter
(FileFilter filter) Sets thecurrent FileFilter
used in theFileChooser
displayed when the button fromFileEditor
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
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 givenProperties
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)
-
Field Details
-
VALUETYPE_KEY
- See Also:
-
DEFAULTVALUE_KEY
- See Also:
-
NUMCOLS_KEY
- See Also:
-
NUMROWS_KEY
- See Also:
-
WORD_WRAP_KEY
- See Also:
-
MINVALUE_KEY
- See Also:
-
MAXVALUE_KEY
- See Also:
-
INCREMENT_KEY
- See Also:
-
VALUESET_KEY
- See Also:
-
VALUESETBOUND_KEY
- See Also:
-
VALUESETDELIM_KEY
- See Also:
-
NULLVALUEALLOWED_KEY
- See Also:
-
EMPTYVALUESNOTALLOWED_KEY
- See Also:
-
IDENTIFIERSONLY_KEY
- See Also:
-
CASESENSITIVE_KEY
- See Also:
-
READONLY_KEY
- See Also:
-
HIDDEN_KEY
- See Also:
-
LABEL_KEY
- See Also:
-
DESCRIPTION_KEY
- See Also:
-
PHYSICALUNIT_KEY
- See Also:
-
VALIDATORCLASS_KEY
- See Also:
-
EDITORCLASS_KEY
- See Also:
-
LISTMODEL_KEY
- See Also:
-
FILE_SELECTION_MODE_KEY
- See Also:
-
LAST_DIR_KEY
- See Also:
-
CHOOSABLE_FILE_FILTERS_KEY
- See Also:
-
CURRENT_FILE_FILTER_KEY
- See Also:
-
COMP_PRODUCTS_FOR_BAND_ARITHMETHIK_KEY
- See Also:
-
SEL_PRODUCT_FOR_BAND_ARITHMETHIK_KEY
- See Also:
-
SELECT_ALL_ON_FOCUS_KEY
- See Also:
-
FSM_FILES_ONLY
public static final int FSM_FILES_ONLYFile selection mode JFileChooser.FILES_ONLY- See Also:
-
FSM_DIRECTORIES_ONLY
public static final int FSM_DIRECTORIES_ONLYFile selection mode JFileChooser.DIRECTORIES_ONLY- See Also:
-
FSM_FILES_AND_DIRECTORIES
public static final int FSM_FILES_AND_DIRECTORIESFile selection mode JFileChooser.FILES_AND_DIRECTORIES- See Also:
-
-
Constructor Details
-
ParamProperties
public ParamProperties() -
ParamProperties
-
ParamProperties
-
ParamProperties
-
ParamProperties
-
ParamProperties
-
ParamProperties
-
-
Method Details
-
addPropertyChangeListener
-
removePropertyChangeListener
-
setValueType
-
getValueType
-
setValidatorClass
-
getValidatorClass
-
setEditorClass
-
getEditorClass
-
setDefaultValue
-
getDefaultValue
-
setNumCols
public void setNumCols(int numCols) -
getNumCols
public int getNumCols() -
setNumRows
public void setNumRows(int numRows) -
getNumRows
public int getNumRows() -
setMinValue
-
getMinValue
-
setMaxValue
-
getMaxValue
-
setIncrement
-
getIncrement
-
setValueSet
-
getValueSet
-
setValueSetDelim
public void setValueSetDelim(char delim) -
getValueSetDelim
public char getValueSetDelim() -
setValueSetBound
public void setValueSetBound(boolean valueSetBound) -
isValueSetBound
public boolean isValueSetBound() -
setNullValueAllowed
public void setNullValueAllowed(boolean nullAllowed) -
isNullValueAllowed
public boolean isNullValueAllowed() -
setEmptyValuesNotAllowed
public void setEmptyValuesNotAllowed(boolean emptyAllowed) -
isEmptyValuesNotAllowed
public boolean isEmptyValuesNotAllowed() -
setIdentifiersOnly
public void setIdentifiersOnly(boolean identifiersOnly) -
isIdentifiersOnly
public boolean isIdentifiersOnly() -
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) -
isCaseSensitive
public boolean isCaseSensitive() -
setReadOnly
public void setReadOnly(boolean readOnly) -
isReadOnly
public boolean isReadOnly() -
setHidden
public void setHidden(boolean hidden) -
isHidden
public boolean isHidden() -
setLabel
-
getLabel
-
setDescription
-
getDescription
-
setPhysicalUnit
-
getPhysicalUnit
-
setFileSelectionMode
public void setFileSelectionMode(int fsm) -
getFileSelectionMode
public int getFileSelectionMode() -
setCurrentFileFilter
Sets thecurrent FileFilter
used in theFileChooser
displayed when the button fromFileEditor
was klicked.- Parameters:
filter
- a javax.swing.filechooser.FileFilter
-
getCurrentFileFilter
Gets thecurrent FileFilter
which was set in theFileChooser
displayed when the button fromFileEditor
was klicked. -
setChoosableFileFilters
Sets an array ofchoosable FileFilter
used in theFileChooser
displayed when the button fromFileEditor
was klicked. If noFileFilterCurrent
was set, the firstFileFilter
in this array is thecurrent FileFilter
- Parameters:
filters
- a javax.swing.filechooser.FileFilter[]
-
getChoosableFileFilters
Gets an array ofchoosable FileFilter
which was set in theFileChooser
displayed when the button fromFileEditor
was klicked. -
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValues
Sets the properties to the values found in the givenProperties
instance.This utility method searches for all keys in the given
Properties
instance whose keys start withparamName + "."
. The rest of the key is expected to be a validParamProperties
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.
- Parameters:
paramName
- the parameter name
-
getProperties
Creates a subset of the properties in this map, containing only properties whose name start with the givennamePrefix
.- Parameters:
namePrefix
- the name prefix- Returns:
- the map subset
-
getPropertyValue
Returns the value of the attribute with the given name. If an attribute with given name could not be found the method returnsnull
.- Parameters:
key
- the attribute key, must not benull
- Returns:
- the attribute value
-
containsProperty
Returnstrue
if an attribute with given name was found.- Parameters:
key
- the attribute key, must not benull
-
getPropertyValue
Returns theboolean
value of the attribute with the given name.- Parameters:
key
- the attribute key, must not benull
defaultValue
- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theint
value of the attribute with the given name.- Parameters:
key
- the attribute key, must not benull
defaultValue
- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns thedouble
value of the attribute with the given name.- Parameters:
key
- the attribute key, must not benull
defaultValue
- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theClass
value of the attribute with the given name.- Parameters:
key
- the attribute key, must not benull
defaultValue
- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theString
value of the attribute with the given name.- Parameters:
key
- the attribute key, must not benull
defaultValue
- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theObject
value of the attribute with the given name.- Parameters:
key
- the attribute key, must not benull
defaultValue
- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
createValidator
Creates an appropriate validator for this parameter info.- Returns:
- a validator, never
null
-
createCopy
Creates and returns a copy of this object. -
createPropertyMap
Creates aMap
to be used to store the attributes. This method can be overridden in order to return a specializedMap
. The default implementation returns a newHashMap()
instance.- Parameters:
map
- the map whose mappings are to be initially placed in the new map, can benull
.
-
loadClass
Loads the class with the specified name.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)
.- Parameters:
className
- the fully qualified name of the class- Returns:
- the resulting Class object
- Throws:
ClassNotFoundException
- if the class was not found
-