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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intFile selection mode JFileChooser.DIRECTORIES_ONLYstatic final intFile selection mode JFileChooser.FILES_AND_DIRECTORIESstatic final intFile selection mode JFileChooser.FILES_ONLYstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic 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 TypeMethodDescriptionvoidbooleancontainsProperty(String key) Returnstrueif an attribute with given name was found.Creates and returns a copy of this object.createPropertyMap(Map<String, Object> map) Creates aMapto be used to store the attributes.Creates an appropriate validator for this parameter info.Gets an array ofchoosable FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked.Gets thecurrent FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked.intgetLabel()intintgetProperties(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.booleangetPropertyValue(String key, boolean defaultValue) Returns thebooleanvalue of the attribute with the given name.doublegetPropertyValue(String key, double defaultValue) Returns thedoublevalue of the attribute with the given name.intgetPropertyValue(String key, int defaultValue) Returns theintvalue of the attribute with the given name.getPropertyValue(String key, Class defaultValue) Returns theClassvalue of the attribute with the given name.getPropertyValue(String key, Object defaultValue) Returns theObjectvalue of the attribute with the given name.getPropertyValue(String key, String defaultValue) Returns theStringvalue of the attribute with the given name.String[]charbooleanbooleanbooleanisHidden()booleanbooleanbooleanbooleanprotected ClassLoads the class with the specified name.voidvoidsetCaseSensitive(boolean caseSensitive) voidsetChoosableFileFilters(FileFilter[] filters) Sets an array ofchoosable FileFilterused in theFileChooserdisplayed when the button fromFileEditorwas klicked.voidsetCurrentFileFilter(FileFilter filter) Sets thecurrent FileFilterused in theFileChooserdisplayed when the button fromFileEditorwas klicked.voidsetDefaultValue(Object defaultValue) voidsetDescription(String description) voidsetEditorClass(Class editorClass) voidsetEmptyValuesNotAllowed(boolean emptyAllowed) voidsetFileSelectionMode(int fsm) voidsetHidden(boolean hidden) voidsetIdentifiersOnly(boolean identifiersOnly) voidsetIncrement(Number increment) voidvoidsetMaxValue(Number maxValue) voidsetMinValue(Number minValue) voidsetNullValueAllowed(boolean nullAllowed) voidsetNumCols(int numCols) voidsetNumRows(int numRows) voidsetPhysicalUnit(String unit) voidsetPropertyValue(String key, boolean value) voidsetPropertyValue(String key, double value) voidsetPropertyValue(String key, float value) voidsetPropertyValue(String key, int value) voidsetPropertyValue(String key, long value) voidsetPropertyValue(String key, Object value) voidsetPropertyValues(String paramName, PropertyMap propertyMap) Sets the properties to the values found in the givenPropertiesinstance.voidsetReadOnly(boolean readOnly) voidsetValidatorClass(Class validatorClass) voidsetValueSet(String[] valueSet) voidsetValueSetBound(boolean valueSetBound) voidsetValueSetDelim(char delim) voidsetValueType(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 FileFilterused in theFileChooserdisplayed when the button fromFileEditorwas klicked.- Parameters:
filter- a javax.swing.filechooser.FileFilter
-
getCurrentFileFilter
Gets thecurrent FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked. -
setChoosableFileFilters
Sets an array ofchoosable FileFilterused in theFileChooserdisplayed when the button fromFileEditorwas klicked. If noFileFilterCurrentwas set, the firstFileFilterin this array is thecurrent FileFilter- Parameters:
filters- a javax.swing.filechooser.FileFilter[]
-
getChoosableFileFilters
Gets an array ofchoosable FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked. -
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValue
-
setPropertyValues
Sets the properties to the values found in the givenPropertiesinstance.This utility method searches for all keys in the given
Propertiesinstance whose keys start withparamName + ".". The rest of the key is expected to be a validParamPropertiesattribute 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
Returnstrueif an attribute with given name was found.- Parameters:
key- the attribute key, must not benull
-
getPropertyValue
Returns thebooleanvalue of the attribute with the given name.- Parameters:
key- the attribute key, must not benulldefaultValue- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theintvalue of the attribute with the given name.- Parameters:
key- the attribute key, must not benulldefaultValue- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns thedoublevalue of the attribute with the given name.- Parameters:
key- the attribute key, must not benulldefaultValue- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theClassvalue of the attribute with the given name.- Parameters:
key- the attribute key, must not benulldefaultValue- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theStringvalue of the attribute with the given name.- Parameters:
key- the attribute key, must not benulldefaultValue- the default value which is returned if an attribute with the given name was not found- Returns:
- the attribute value
-
getPropertyValue
Returns theObjectvalue of the attribute with the given name.- Parameters:
key- the attribute key, must not benulldefaultValue- 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 aMapto 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
-