Package org.gephi.filters.spi
Class FilterProperty
- java.lang.Object
-
- org.gephi.filters.spi.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 usingsetValue(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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilterProperty
createProperty(Filter filter, Class valueType, String fieldName)
Creates a property.static FilterProperty
createProperty(Filter filter, Class valueType, String propertyName, String getMethod, String setMethod)
Creates a property.Filter
getFilter()
Returns the filter instance this property is associated to.String
getName()
Returns property's namePropertyEditor
getPropertyEditor()
Returns thePropertyEditor
associated to the property value.Object
getValue()
Returns property's value, can benull
Class
getValueType()
Returns the property's value type.void
setPropertyEditorClass(Class<? extends PropertyEditor> clazz)
Sets the property editor class.void
setValue(Object value)
Set property's value.
-
-
-
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 instancevalueType
- The type of the property value, ex:Double.class
propertyName
- The display name of the propertygetMethod
- 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 instancevalueType
- 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 benull
- Returns:
- property's value
-
setValue
public void setValue(Object value)
Set property's value. The type ofvalue
must match with this property value type.- Parameters:
value
- the value that is to be set
-
getPropertyEditor
public PropertyEditor getPropertyEditor()
Returns thePropertyEditor
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 implementPropertyEditor
.- 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
-
-