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-apiTo 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 forTunableHandlers that deal withTunables that annotate a field.AbstractTunableHandler(Method getter, Method setter, Object instance, Tunable tunable)Standard base class constructor forTunableHandlers that deal withTunables that use getter and setter methods.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontrolsMutuallyExclusiveNestedChildren()Returns true if the associatedTunableallows switching of mutually exclusive nested children, else false.StringdependsOn()Returns the dependsOn property of the associatedTunable.StringgetChildKey()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.StringgetContext()This returns the context of the Tunable.StringgetDescription()Returns the associatedTunable's description.StringgetExampleStringValue()Returns the exampleStringValue property of the associatedTunable.StringgetFormat()Provides a format string suitable for passing to String.format.doublegetGravity()Returns the gravity value for the annotation.String[]getGroups()Returns the associatedTunable's groups or nesting hierarchy.StringgetLongDescription()Returns the associatedTunable's longDescriptionStringgetName()Returns a name representing a tunable property.PropertiesgetParams()Returns the parsed result fromTunable.getParams().StringgetQualifiedName()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.booleangetRequired()Returns true if this Tunable must be set (i.e.StringgetTooltip()Returns the tooltip annotation for this Tunable if there is one.Class<?>getType()Returns the class type of the field or method annotated byTunable.ObjectgetValue()Returns an object describing a field / get method annotated withTunableor null if no field / get method has been associated with this handler.String[]listenForChange()Returns the listenForChange property of the associatedTunable.voidsetOffset(double offset)voidsetValue(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 forTunableHandlers that deal withTunables that annotate a field.- Parameters:
field- An instance ofFieldthat represents a field annotated with@Tunableinstance- An object instance that contains a field corresponding to the field parametertunable- TheTunablethat annotates field
-
AbstractTunableHandler
public AbstractTunableHandler(Method getter, Method setter, Object instance, Tunable tunable)
Standard base class constructor forTunableHandlers that deal withTunables 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- TheTunablethat annotates the getter.
-
-
Method Detail
-
getType
public final Class<?> getType()
Description copied from interface:TunableHandlerReturns the class type of the field or method annotated byTunable.- Specified by:
getTypein 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:TunableHandlerReturns an object describing a field / get method annotated withTunableor null if no field / get method has been associated with this handler.- Specified by:
getValuein interfaceTunableHandler- Returns:
- an object describing a field / get method annotated with @Tunable or null if no field has been associated with this handler
- Throws:
IllegalAccessExceptionInvocationTargetException
-
setValue
public void setValue(Object newValue) throws IllegalAccessException, InvocationTargetException
Description copied from interface:TunableHandlerAttempts to set the value of the associated field or set method that has been annotated withTunable.- Specified by:
setValuein interfaceTunableHandler- Parameters:
newValue- the value to be written into field or set method annotated withTunable- Throws:
IllegalAccessExceptionInvocationTargetException
-
getDescription
public final String getDescription()
Description copied from interface:TunableHandlerReturns the associatedTunable's description.- Specified by:
getDescriptionin interfaceTunableHandler- Returns:
- the associated
Tunable's description
-
getLongDescription
public final String getLongDescription()
Description copied from interface:TunableHandlerReturns the associatedTunable's longDescription- Specified by:
getLongDescriptionin interfaceTunableHandler- Returns:
- the associated
Tunable's longDescription
-
getExampleStringValue
public final String getExampleStringValue()
Description copied from interface:TunableHandlerReturns the exampleStringValue property of the associatedTunable.- Specified by:
getExampleStringValuein interfaceTunableHandler- Returns:
- the exampleStringValue property of the associated
Tunable.
-
getGroups
public final String[] getGroups()
Description copied from interface:TunableHandlerReturns the associatedTunable's groups or nesting hierarchy.- Specified by:
getGroupsin interfaceTunableHandler- Returns:
- the associated
Tunable's groups or nesting hierarchy
-
controlsMutuallyExclusiveNestedChildren
public final boolean controlsMutuallyExclusiveNestedChildren()
Description copied from interface:TunableHandlerReturns true if the associatedTunableallows switching of mutually exclusive nested children, else false.- Specified by:
controlsMutuallyExclusiveNestedChildrenin interfaceTunableHandler- Returns:
- true if the associated
Tunableallows switching of mutually exclusive nested children, else false
-
getChildKey
public final String getChildKey()
Description copied from interface:TunableHandlerReturns 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:
getChildKeyin 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:TunableHandlerReturns the dependsOn property of the associatedTunable.- Specified by:
dependsOnin interfaceTunableHandler- Returns:
- the dependsOn property of the tunable
-
listenForChange
public final String[] listenForChange()
Description copied from interface:TunableHandlerReturns the listenForChange property of the associatedTunable.- Specified by:
listenForChangein interfaceTunableHandler- Returns:
- the listenForChange property of the tunable
-
getName
public final String getName()
Description copied from interface:TunableHandlerReturns a name representing a tunable property.- Specified by:
getNamein interfaceTunableHandler- Returns:
- a name representing a tunable property
-
getQualifiedName
public final String getQualifiedName()
Description copied from interface:TunableHandlerReturns 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:
getQualifiedNamein 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:TunableHandlerReturns the parsed result fromTunable.getParams().- Specified by:
getParamsin 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)
-
-