Class FilterProperty


  • public final class FilterProperty
    extends Object
    Properties for filters. All editable properties of a filter must be used through this class, especially setting value should be done by using setValue(java.lang.Object).

    The role of this class is to define filter's properties in order value changes can be tracked by the system, UI can be generated and values correctly saved in projects file.

    Author:
    Mathieu Bastian
    • Method Detail

      • createProperty

        public static FilterProperty createProperty​(Filter filter,
                                                    Class valueType,
                                                    String propertyName,
                                                    String getMethod,
                                                    String setMethod)
                                             throws NoSuchMethodException
        Creates a property.
        Parameters:
        filter - The filter instance
        valueType - The type of the property value, ex: Double.class
        propertyName - The display name of the property
        getMethod - The name of the get method for this property, must exist to make Java reflexion working.
        setMethod - The name of the set method for this property, must exist to make Java reflexion working.
        Returns:
        the created property
        Throws:
        NoSuchMethodException - if the getter or setter methods cannot be found
      • createProperty

        public static FilterProperty createProperty​(Filter filter,
                                                    Class valueType,
                                                    String fieldName)
                                             throws NoSuchMethodException
        Creates a property.
        Parameters:
        filter - filter instance
        valueType - type of the property value, ex: Double.class
        fieldName - java field name of the property
        Returns:
        the created property
        Throws:
        NoSuchMethodException - if the getter or setter methods cannot be found
      • getName

        public String getName()
        Returns property's name
        Returns:
        property's name
      • getValue

        public Object getValue()
        Returns property's value, can be null
        Returns:
        property's value
      • setValue

        public void setValue​(Object value)
        Set property's value. The type of value must match with this property value type.
        Parameters:
        value - the value that is to be set
      • getPropertyEditor

        public PropertyEditor getPropertyEditor()
        Returns the PropertyEditor associated to the property value.
        Returns:
        the property editor
      • setPropertyEditorClass

        public void setPropertyEditorClass​(Class<? extends PropertyEditor> clazz)
        Sets the property editor class. The class must implement PropertyEditor.
        Parameters:
        clazz - the property editor class
      • getValueType

        public Class getValueType()
        Returns the property's value type.
        Returns:
        the value type
      • getFilter

        public Filter getFilter()
        Returns the filter instance this property is associated to.
        Returns:
        the filter this property belongs to