Class ParamProperties


  • public class ParamProperties
    extends Object
    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:
    Parameter, ParamEditor, ParamValidator
    • Constructor Detail

      • ParamProperties

        public ParamProperties()
      • ParamProperties

        public ParamProperties​(Class valueType)
      • ParamProperties

        public ParamProperties​(Class valueType,
                               Object defaultValue)
      • ParamProperties

        public ParamProperties​(Class valueType,
                               Object defaultValue,
                               String[] valueSet)
      • ParamProperties

        public ParamProperties​(Class valueType,
                               Object defaultValue,
                               String[] valueSet,
                               boolean valueSetBound)
      • ParamProperties

        public ParamProperties​(Class valueType,
                               Number defaultValue,
                               Number minValue,
                               Number maxValue)
    • Method Detail

      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener listener)
      • setValueType

        public void setValueType​(Class valueType)
      • getValueType

        public Class getValueType()
      • setValidatorClass

        public void setValidatorClass​(Class validatorClass)
      • getValidatorClass

        public Class getValidatorClass()
      • setEditorClass

        public void setEditorClass​(Class editorClass)
      • getEditorClass

        public Class getEditorClass()
      • setDefaultValue

        public void setDefaultValue​(Object defaultValue)
      • getDefaultValue

        public Object getDefaultValue()
      • setNumCols

        public void setNumCols​(int numCols)
      • getNumCols

        public int getNumCols()
      • setNumRows

        public void setNumRows​(int numRows)
      • getNumRows

        public int getNumRows()
      • setMinValue

        public void setMinValue​(Number minValue)
      • getMinValue

        public Number getMinValue()
      • setMaxValue

        public void setMaxValue​(Number maxValue)
      • getMaxValue

        public Number getMaxValue()
      • setIncrement

        public void setIncrement​(Number increment)
      • getIncrement

        public Number getIncrement()
      • setValueSet

        public void setValueSet​(String[] valueSet)
      • getValueSet

        public String[] 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

        public void setLabel​(String label)
      • getLabel

        public String getLabel()
      • setDescription

        public void setDescription​(String description)
      • getDescription

        public String getDescription()
      • setPhysicalUnit

        public void setPhysicalUnit​(String unit)
      • getPhysicalUnit

        public String getPhysicalUnit()
      • setFileSelectionMode

        public void setFileSelectionMode​(int fsm)
      • getFileSelectionMode

        public int getFileSelectionMode()
      • setCurrentFileFilter

        public void setCurrentFileFilter​(FileFilter filter)
        Sets the current FileFilter used in the FileChooser displayed when the button from FileEditor was klicked.
        Parameters:
        filter - a javax.swing.filechooser.FileFilter
      • getCurrentFileFilter

        public FileFilter getCurrentFileFilter()
        Gets the current FileFilter which was set in the FileChooser displayed when the button from FileEditor was klicked.
      • setChoosableFileFilters

        public void setChoosableFileFilters​(FileFilter[] filters)
        Sets an array of 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
        Parameters:
        filters - a javax.swing.filechooser.FileFilter[]
      • getChoosableFileFilters

        public FileFilter[] getChoosableFileFilters()
        Gets an array of choosable FileFilter which was set in the FileChooser displayed when the button from FileEditor was klicked.
      • setPropertyValue

        public void setPropertyValue​(String key,
                                     boolean value)
      • setPropertyValue

        public void setPropertyValue​(String key,
                                     int value)
      • setPropertyValue

        public void setPropertyValue​(String key,
                                     long value)
      • setPropertyValue

        public void setPropertyValue​(String key,
                                     float value)
      • setPropertyValue

        public void setPropertyValue​(String key,
                                     double value)
      • setPropertyValue

        public void setPropertyValue​(String key,
                                     Object value)
      • setPropertyValues

        public void setPropertyValues​(String paramName,
                                      PropertyMap propertyMap)
        Sets the properties to the values found in the given 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.

        Parameters:
        paramName - the parameter name
      • getProperties

        public 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.
        Parameters:
        namePrefix - the name prefix
        Returns:
        the map subset
      • getPropertyValue

        public 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 returns null.
        Parameters:
        key - the attribute key, must not be null
        Returns:
        the attribute value
      • containsProperty

        public boolean containsProperty​(String key)
        Returns true if an attribute with given name was found.
        Parameters:
        key - the attribute key, must not be null
      • getPropertyValue

        public boolean getPropertyValue​(String key,
                                        boolean defaultValue)
        Returns the boolean value 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
      • getPropertyValue

        public int getPropertyValue​(String key,
                                    int defaultValue)
        Returns the int value 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
      • getPropertyValue

        public double getPropertyValue​(String key,
                                       double defaultValue)
        Returns the double value 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
      • getPropertyValue

        public Class getPropertyValue​(String key,
                                      Class defaultValue)
        Returns the Class value 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
      • getPropertyValue

        public String getPropertyValue​(String key,
                                       String defaultValue)
        Returns the String value 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
      • getPropertyValue

        public Object getPropertyValue​(String key,
                                       Object defaultValue)
        Returns the Object value 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
      • createValidator

        public ParamValidator createValidator()
        Creates an appropriate validator for this parameter info.
        Returns:
        a validator, never null
      • createCopy

        public ParamProperties createCopy()
        Creates and returns a copy of this object.
      • createPropertyMap

        protected Map<String,​Object> createPropertyMap​(Map<String,​Object> map)
        Creates a 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.
        Parameters:
        map - the map whose mappings are to be initially placed in the new map, can be null.
      • loadClass

        protected 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