Package org.esa.snap.core.param
Class ParamProperties
- java.lang.Object
- 
- org.esa.snap.core.param.ParamProperties
 
- 
 public class ParamProperties extends Object TheParamPropertiesclass 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:
- Parameter,- ParamEditor,- ParamValidator
 
- 
- 
Field Summary
 - 
Constructor SummaryConstructors Constructor 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)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener listener)booleancontainsProperty(String key)Returnstrueif an attribute with given name was found.ParamPropertiescreateCopy()Creates and returns a copy of this object.protected Map<String,Object>createPropertyMap(Map<String,Object> map)Creates aMapto be used to store the attributes.ParamValidatorcreateValidator()Creates an appropriate validator for this parameter info.FileFilter[]getChoosableFileFilters()Gets an array ofchoosable FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked.FileFiltergetCurrentFileFilter()Gets thecurrent FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked.ObjectgetDefaultValue()StringgetDescription()ClassgetEditorClass()intgetFileSelectionMode()NumbergetIncrement()StringgetLabel()NumbergetMaxValue()NumbergetMinValue()intgetNumCols()intgetNumRows()StringgetPhysicalUnit()Map<String,Object>getProperties(String namePrefix)Creates a subset of the properties in this map, containing only properties whose name start with the givennamePrefix.ObjectgetPropertyValue(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.ClassgetPropertyValue(String key, Class defaultValue)Returns theClassvalue of the attribute with the given name.ObjectgetPropertyValue(String key, Object defaultValue)Returns theObjectvalue of the attribute with the given name.StringgetPropertyValue(String key, String defaultValue)Returns theStringvalue of the attribute with the given name.ClassgetValidatorClass()String[]getValueSet()chargetValueSetDelim()ClassgetValueType()booleanisCaseSensitive()booleanisEmptyValuesNotAllowed()booleanisHidden()booleanisIdentifiersOnly()booleanisNullValueAllowed()booleanisReadOnly()booleanisValueSetBound()protected ClassloadClass(String className)Loads the class with the specified name.voidremovePropertyChangeListener(PropertyChangeListener listener)voidsetCaseSensitive(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)voidsetLabel(String label)voidsetMaxValue(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 Detail- 
VALUETYPE_KEYpublic static final String VALUETYPE_KEY - See Also:
- Constant Field Values
 
 - 
DEFAULTVALUE_KEYpublic static final String DEFAULTVALUE_KEY - See Also:
- Constant Field Values
 
 - 
NUMCOLS_KEYpublic static final String NUMCOLS_KEY - See Also:
- Constant Field Values
 
 - 
NUMROWS_KEYpublic static final String NUMROWS_KEY - See Also:
- Constant Field Values
 
 - 
WORD_WRAP_KEYpublic static final String WORD_WRAP_KEY - See Also:
- Constant Field Values
 
 - 
MINVALUE_KEYpublic static final String MINVALUE_KEY - See Also:
- Constant Field Values
 
 - 
MAXVALUE_KEYpublic static final String MAXVALUE_KEY - See Also:
- Constant Field Values
 
 - 
INCREMENT_KEYpublic static final String INCREMENT_KEY - See Also:
- Constant Field Values
 
 - 
VALUESET_KEYpublic static final String VALUESET_KEY - See Also:
- Constant Field Values
 
 - 
VALUESETBOUND_KEYpublic static final String VALUESETBOUND_KEY - See Also:
- Constant Field Values
 
 - 
VALUESETDELIM_KEYpublic static final String VALUESETDELIM_KEY - See Also:
- Constant Field Values
 
 - 
NULLVALUEALLOWED_KEYpublic static final String NULLVALUEALLOWED_KEY - See Also:
- Constant Field Values
 
 - 
EMPTYVALUESNOTALLOWED_KEYpublic static final String EMPTYVALUESNOTALLOWED_KEY - See Also:
- Constant Field Values
 
 - 
IDENTIFIERSONLY_KEYpublic static final String IDENTIFIERSONLY_KEY - See Also:
- Constant Field Values
 
 - 
CASESENSITIVE_KEYpublic static final String CASESENSITIVE_KEY - See Also:
- Constant Field Values
 
 - 
READONLY_KEYpublic static final String READONLY_KEY - See Also:
- Constant Field Values
 
 - 
HIDDEN_KEYpublic static final String HIDDEN_KEY - See Also:
- Constant Field Values
 
 - 
LABEL_KEYpublic static final String LABEL_KEY - See Also:
- Constant Field Values
 
 - 
DESCRIPTION_KEYpublic static final String DESCRIPTION_KEY - See Also:
- Constant Field Values
 
 - 
PHYSICALUNIT_KEYpublic static final String PHYSICALUNIT_KEY - See Also:
- Constant Field Values
 
 - 
VALIDATORCLASS_KEYpublic static final String VALIDATORCLASS_KEY - See Also:
- Constant Field Values
 
 - 
EDITORCLASS_KEYpublic static final String EDITORCLASS_KEY - See Also:
- Constant Field Values
 
 - 
LISTMODEL_KEYpublic static final String LISTMODEL_KEY - See Also:
- Constant Field Values
 
 - 
FILE_SELECTION_MODE_KEYpublic static final String FILE_SELECTION_MODE_KEY - See Also:
- Constant Field Values
 
 - 
LAST_DIR_KEYpublic static final String LAST_DIR_KEY - See Also:
- Constant Field Values
 
 - 
CHOOSABLE_FILE_FILTERS_KEYpublic static final String CHOOSABLE_FILE_FILTERS_KEY - See Also:
- Constant Field Values
 
 - 
CURRENT_FILE_FILTER_KEYpublic static final String CURRENT_FILE_FILTER_KEY - See Also:
- Constant Field Values
 
 - 
COMP_PRODUCTS_FOR_BAND_ARITHMETHIK_KEYpublic static final String COMP_PRODUCTS_FOR_BAND_ARITHMETHIK_KEY - See Also:
- Constant Field Values
 
 - 
SEL_PRODUCT_FOR_BAND_ARITHMETHIK_KEYpublic static final String SEL_PRODUCT_FOR_BAND_ARITHMETHIK_KEY - See Also:
- Constant Field Values
 
 - 
SELECT_ALL_ON_FOCUS_KEYpublic static final String SELECT_ALL_ON_FOCUS_KEY - See Also:
- Constant Field Values
 
 - 
FSM_FILES_ONLYpublic static final int FSM_FILES_ONLY File selection mode JFileChooser.FILES_ONLY- See Also:
- Constant Field Values
 
 - 
FSM_DIRECTORIES_ONLYpublic static final int FSM_DIRECTORIES_ONLY File selection mode JFileChooser.DIRECTORIES_ONLY- See Also:
- Constant Field Values
 
 - 
FSM_FILES_AND_DIRECTORIESpublic static final int FSM_FILES_AND_DIRECTORIES File selection mode JFileChooser.FILES_AND_DIRECTORIES- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
ParamPropertiespublic ParamProperties() 
 - 
ParamPropertiespublic ParamProperties(Class valueType) 
 - 
ParamPropertiespublic ParamProperties(Class valueType, Object defaultValue, String[] valueSet, boolean valueSetBound) 
 - 
ParamPropertiespublic ParamProperties(Class valueType, Number defaultValue, Number minValue, Number maxValue) 
 
- 
 - 
Method Detail- 
addPropertyChangeListenerpublic void addPropertyChangeListener(PropertyChangeListener listener) 
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(PropertyChangeListener listener) 
 - 
setValueTypepublic void setValueType(Class valueType) 
 - 
getValueTypepublic Class getValueType() 
 - 
setValidatorClasspublic void setValidatorClass(Class validatorClass) 
 - 
getValidatorClasspublic Class getValidatorClass() 
 - 
setEditorClasspublic void setEditorClass(Class editorClass) 
 - 
getEditorClasspublic Class getEditorClass() 
 - 
setDefaultValuepublic void setDefaultValue(Object defaultValue) 
 - 
getDefaultValuepublic Object getDefaultValue() 
 - 
setNumColspublic void setNumCols(int numCols) 
 - 
getNumColspublic int getNumCols() 
 - 
setNumRowspublic void setNumRows(int numRows) 
 - 
getNumRowspublic int getNumRows() 
 - 
setMinValuepublic void setMinValue(Number minValue) 
 - 
getMinValuepublic Number getMinValue() 
 - 
setMaxValuepublic void setMaxValue(Number maxValue) 
 - 
getMaxValuepublic Number getMaxValue() 
 - 
setIncrementpublic void setIncrement(Number increment) 
 - 
getIncrementpublic Number getIncrement() 
 - 
setValueSetpublic void setValueSet(String[] valueSet) 
 - 
getValueSetpublic String[] getValueSet() 
 - 
setValueSetDelimpublic void setValueSetDelim(char delim) 
 - 
getValueSetDelimpublic char getValueSetDelim() 
 - 
setValueSetBoundpublic void setValueSetBound(boolean valueSetBound) 
 - 
isValueSetBoundpublic boolean isValueSetBound() 
 - 
setNullValueAllowedpublic void setNullValueAllowed(boolean nullAllowed) 
 - 
isNullValueAllowedpublic boolean isNullValueAllowed() 
 - 
setEmptyValuesNotAllowedpublic void setEmptyValuesNotAllowed(boolean emptyAllowed) 
 - 
isEmptyValuesNotAllowedpublic boolean isEmptyValuesNotAllowed() 
 - 
setIdentifiersOnlypublic void setIdentifiersOnly(boolean identifiersOnly) 
 - 
isIdentifiersOnlypublic boolean isIdentifiersOnly() 
 - 
setCaseSensitivepublic void setCaseSensitive(boolean caseSensitive) 
 - 
isCaseSensitivepublic boolean isCaseSensitive() 
 - 
setReadOnlypublic void setReadOnly(boolean readOnly) 
 - 
isReadOnlypublic boolean isReadOnly() 
 - 
setHiddenpublic void setHidden(boolean hidden) 
 - 
isHiddenpublic boolean isHidden() 
 - 
setLabelpublic void setLabel(String label) 
 - 
getLabelpublic String getLabel() 
 - 
setDescriptionpublic void setDescription(String description) 
 - 
getDescriptionpublic String getDescription() 
 - 
setPhysicalUnitpublic void setPhysicalUnit(String unit) 
 - 
getPhysicalUnitpublic String getPhysicalUnit() 
 - 
setFileSelectionModepublic void setFileSelectionMode(int fsm) 
 - 
getFileSelectionModepublic int getFileSelectionMode() 
 - 
setCurrentFileFilterpublic void setCurrentFileFilter(FileFilter filter) Sets thecurrent FileFilterused in theFileChooserdisplayed when the button fromFileEditorwas klicked.- Parameters:
- filter- a javax.swing.filechooser.FileFilter
 
 - 
getCurrentFileFilterpublic FileFilter getCurrentFileFilter() Gets thecurrent FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked.
 - 
setChoosableFileFilterspublic void setChoosableFileFilters(FileFilter[] filters) 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[]
 
 - 
getChoosableFileFilterspublic FileFilter[] getChoosableFileFilters() Gets an array ofchoosable FileFilterwhich was set in theFileChooserdisplayed when the button fromFileEditorwas klicked.
 - 
setPropertyValuepublic void setPropertyValue(String key, boolean value) 
 - 
setPropertyValuepublic void setPropertyValue(String key, int value) 
 - 
setPropertyValuepublic void setPropertyValue(String key, long value) 
 - 
setPropertyValuepublic void setPropertyValue(String key, float value) 
 - 
setPropertyValuepublic void setPropertyValue(String key, double value) 
 - 
setPropertyValuespublic void setPropertyValues(String paramName, PropertyMap propertyMap) 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
 
 - 
getPropertiespublic Map<String,Object> getProperties(String namePrefix) 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
 
 - 
getPropertyValuepublic Object getPropertyValue(String key) 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 be- null
- Returns:
- the attribute value
 
 - 
containsPropertypublic boolean containsProperty(String key) Returnstrueif an attribute with given name was found.- Parameters:
- key- the attribute key, must not be- null
 
 - 
getPropertyValuepublic boolean getPropertyValue(String key, boolean defaultValue) Returns thebooleanvalue of the attribute with the given name.- Parameters:
- key- the attribute key, must not be- null
- defaultValue- the default value which is returned if an attribute with the given name was not found
- Returns:
- the attribute value
 
 - 
getPropertyValuepublic int getPropertyValue(String key, int defaultValue) Returns theintvalue of the attribute with the given name.- Parameters:
- key- the attribute key, must not be- null
- defaultValue- the default value which is returned if an attribute with the given name was not found
- Returns:
- the attribute value
 
 - 
getPropertyValuepublic double getPropertyValue(String key, double defaultValue) Returns thedoublevalue of the attribute with the given name.- Parameters:
- key- the attribute key, must not be- null
- defaultValue- the default value which is returned if an attribute with the given name was not found
- Returns:
- the attribute value
 
 - 
getPropertyValuepublic Class getPropertyValue(String key, Class defaultValue) Returns theClassvalue of the attribute with the given name.- Parameters:
- key- the attribute key, must not be- null
- defaultValue- the default value which is returned if an attribute with the given name was not found
- Returns:
- the attribute value
 
 - 
getPropertyValuepublic String getPropertyValue(String key, String defaultValue) Returns theStringvalue of the attribute with the given name.- Parameters:
- key- the attribute key, must not be- null
- defaultValue- the default value which is returned if an attribute with the given name was not found
- Returns:
- the attribute value
 
 - 
getPropertyValuepublic Object getPropertyValue(String key, Object defaultValue) Returns theObjectvalue of the attribute with the given name.- Parameters:
- key- the attribute key, must not be- null
- defaultValue- the default value which is returned if an attribute with the given name was not found
- Returns:
- the attribute value
 
 - 
createValidatorpublic ParamValidator createValidator() Creates an appropriate validator for this parameter info.- Returns:
- a validator, never null
 
 - 
createCopypublic ParamProperties createCopy() Creates and returns a copy of this object.
 - 
createPropertyMapprotected Map<String,Object> createPropertyMap(Map<String,Object> map) 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 be- null.
 
 - 
loadClassprotected Class loadClass(String className) throws ClassNotFoundException 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
 
 
- 
 
-