Package org.cytoscape.work
Class AbstractTunableHandler
- java.lang.Object
-
- org.cytoscape.work.AbstractTunableHandler
-
- All Implemented Interfaces:
TunableHandler
- Direct Known Subclasses:
AbstractGUITunableHandler
,AbstractStringTunableHandler
public abstract class AbstractTunableHandler extends Object implements TunableHandler
Provides the standard implementation for most of the methods declared by the TunableHandler interface.Module:
work-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
-
-
Constructor Summary
Constructors Constructor Description AbstractTunableHandler(Field field, Object instance, Tunable tunable)
Standard base class constructor forTunableHandler
s that deal withTunable
s that annotate a field.AbstractTunableHandler(Method getter, Method setter, Object instance, Tunable tunable)
Standard base class constructor forTunableHandler
s that deal withTunable
s that use getter and setter methods.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
controlsMutuallyExclusiveNestedChildren()
Returns true if the associatedTunable
allows switching of mutually exclusive nested children, else false.String
dependsOn()
Returns the dependsOn property of the associatedTunable
.String
getChildKey()
Returns the name of the key that determines the selection of which controlled nested child is currently presented, or the empty string if controlsMutuallyExclusiveNestedChildren() returns false.String
getContext()
This returns the context of the Tunable.String
getDescription()
Returns the associatedTunable
's description.String
getExampleStringValue()
Returns the exampleStringValue property of the associatedTunable
.String
getFormat()
Provides a format string suitable for passing to String.format.double
getGravity()
Returns the gravity value for the annotation.String[]
getGroups()
Returns the associatedTunable
's groups or nesting hierarchy.String
getLongDescription()
Returns the associatedTunable
's longDescriptionString
getName()
Returns a name representing a tunable property.Properties
getParams()
Returns the parsed result fromTunable.getParams()
.String
getQualifiedName()
Returns the name of the underlying class of the tunable followed by a dot and the name of the tunable field or getter/setter root name.boolean
getRequired()
Returns true if this Tunable must be set (i.e.String
getTooltip()
Returns the tooltip annotation for this Tunable if there is one.Class<?>
getType()
Returns the class type of the field or method annotated byTunable
.Object
getValue()
Returns an object describing a field / get method annotated withTunable
or null if no field / get method has been associated with this handler.String[]
listenForChange()
Returns the listenForChange property of the associatedTunable
.void
setOffset(double offset)
void
setValue(Object newValue)
Attempts to set the value of the associated field or set method that has been annotated withTunable
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cytoscape.work.TunableHandler
handle
-
-
-
-
Field Detail
-
TOOLTIP
public static final String TOOLTIP
- See Also:
- Constant Field Values
-
GRAVITY
public static final String GRAVITY
- See Also:
- Constant Field Values
-
CONTEXT
public static final String CONTEXT
- See Also:
- Constant Field Values
-
FORMAT
public static final String FORMAT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractTunableHandler
public AbstractTunableHandler(Field field, Object instance, Tunable tunable)
Standard base class constructor forTunableHandler
s that deal withTunable
s that annotate a field.- Parameters:
field
- An instance ofField
that represents a field annotated with@Tunable
instance
- An object instance that contains a field corresponding to the field parametertunable
- TheTunable
that annotates field
-
AbstractTunableHandler
public AbstractTunableHandler(Method getter, Method setter, Object instance, Tunable tunable)
Standard base class constructor forTunableHandler
s that deal withTunable
s that use getter and setter methods.- Parameters:
getter
- The getter method of the tunable object represented by the instance parameter.setter
- The setter method complimentary to the getter.instance
- An instance of an object with a getter method that has been determined to be annotated with@Tunable
.tunable
- TheTunable
that annotates the getter.
-
-
Method Detail
-
getType
public final Class<?> getType()
Description copied from interface:TunableHandler
Returns the class type of the field or method annotated byTunable
.- Specified by:
getType
in interfaceTunableHandler
- Returns:
- the class type of the field or method annotated by
Tunable
.
-
getValue
public final Object getValue() throws IllegalAccessException, InvocationTargetException
Description copied from interface:TunableHandler
Returns an object describing a field / get method annotated withTunable
or null if no field / get method has been associated with this handler.- Specified by:
getValue
in interfaceTunableHandler
- Returns:
- an object describing a field / get method annotated with @Tunable or null if no field has been associated with this handler
- Throws:
IllegalAccessException
InvocationTargetException
-
setValue
public void setValue(Object newValue) throws IllegalAccessException, InvocationTargetException
Description copied from interface:TunableHandler
Attempts to set the value of the associated field or set method that has been annotated withTunable
.- Specified by:
setValue
in interfaceTunableHandler
- Parameters:
newValue
- the value to be written into field or set method annotated withTunable
- Throws:
IllegalAccessException
InvocationTargetException
-
getDescription
public final String getDescription()
Description copied from interface:TunableHandler
Returns the associatedTunable
's description.- Specified by:
getDescription
in interfaceTunableHandler
- Returns:
- the associated
Tunable
's description
-
getLongDescription
public final String getLongDescription()
Description copied from interface:TunableHandler
Returns the associatedTunable
's longDescription- Specified by:
getLongDescription
in interfaceTunableHandler
- Returns:
- the associated
Tunable
's longDescription
-
getExampleStringValue
public final String getExampleStringValue()
Description copied from interface:TunableHandler
Returns the exampleStringValue property of the associatedTunable
.- Specified by:
getExampleStringValue
in interfaceTunableHandler
- Returns:
- the exampleStringValue property of the associated
Tunable
.
-
getGroups
public final String[] getGroups()
Description copied from interface:TunableHandler
Returns the associatedTunable
's groups or nesting hierarchy.- Specified by:
getGroups
in interfaceTunableHandler
- Returns:
- the associated
Tunable
's groups or nesting hierarchy
-
controlsMutuallyExclusiveNestedChildren
public final boolean controlsMutuallyExclusiveNestedChildren()
Description copied from interface:TunableHandler
Returns true if the associatedTunable
allows switching of mutually exclusive nested children, else false.- Specified by:
controlsMutuallyExclusiveNestedChildren
in interfaceTunableHandler
- Returns:
- true if the associated
Tunable
allows switching of mutually exclusive nested children, else false
-
getChildKey
public final String getChildKey()
Description copied from interface:TunableHandler
Returns the name of the key that determines the selection of which controlled nested child is currently presented, or the empty string if controlsMutuallyExclusiveNestedChildren() returns false.- Specified by:
getChildKey
in interfaceTunableHandler
- Returns:
- the name of the key that determines the selection of which controlled nested child is currently presented, or the empty string if controlsMutuallyExclusiveNestedChildren() returns false.
-
dependsOn
public final String dependsOn()
Description copied from interface:TunableHandler
Returns the dependsOn property of the associatedTunable
.- Specified by:
dependsOn
in interfaceTunableHandler
- Returns:
- the dependsOn property of the tunable
-
listenForChange
public final String[] listenForChange()
Description copied from interface:TunableHandler
Returns the listenForChange property of the associatedTunable
.- Specified by:
listenForChange
in interfaceTunableHandler
- Returns:
- the listenForChange property of the tunable
-
getName
public final String getName()
Description copied from interface:TunableHandler
Returns a name representing a tunable property.- Specified by:
getName
in interfaceTunableHandler
- Returns:
- a name representing a tunable property
-
getQualifiedName
public final String getQualifiedName()
Description copied from interface:TunableHandler
Returns the name of the underlying class of the tunable followed by a dot and the name of the tunable field or getter/setter root name. Please note that the returned String will always contain a single embedded dot.- Specified by:
getQualifiedName
in interfaceTunableHandler
- Returns:
- the name of the underlying class of the tunable followed by a dot and the name of the tunable field or getter/setter root name.
-
getParams
public final Properties getParams() throws IllegalArgumentException
Description copied from interface:TunableHandler
Returns the parsed result fromTunable.getParams()
.- Specified by:
getParams
in interfaceTunableHandler
- Returns:
- the parsed result from
Tunable.getParams()
- Throws:
IllegalArgumentException
-
getContext
public final String getContext()
This returns the context of the Tunable. The context must be one of:- gui: used only when a graphical user interface is available
- nogui: used only when a graphical user interface is not available
- both: always used
- Returns:
- the context
-
getTooltip
public final String getTooltip()
Returns the tooltip annotation for this Tunable if there is one.- Returns:
- tooltip string, if any
-
getGravity
public final double getGravity()
Returns the gravity value for the annotation.- Returns:
- Tunable gravity as a double
-
getRequired
public final boolean getRequired()
Returns true if this Tunable must be set (i.e. is required), otherwise returns false.- Returns:
- true if it is required.
-
getFormat
public final String getFormat()
Provides a format string suitable for passing to String.format. This allows default values to be rationally presented to users. Note that this is only for presentation purposes and does not effect the underlying values. Also, not all Tunables will respect format -- for example formatting boolean, checkboxes, or List selections don't make sense.- Returns:
- the string to use for the format
-
setOffset
public void setOffset(double offset)
-
-