Package org.cytoscape.work.swing
Class AbstractGUITunableHandler
java.lang.Object
org.cytoscape.work.AbstractTunableHandler
org.cytoscape.work.swing.AbstractGUITunableHandler
- All Implemented Interfaces:
GUITunableHandler
,TunableHandler
public abstract class AbstractGUITunableHandler
extends AbstractTunableHandler
implements GUITunableHandler
Base class for the various Swing implementations of
TunableHandler
.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.
Module: work-swing-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-swing-api</artifactId> </dependency>
-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
The main goal of this panel is to store the handler's label and control, in order to make it possible to consistently align labels and controls created by different AbstractGUITunableHandler subclasses when creating the Tunable form. -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
If true, the associated GUI element should be laid out next to others in the same group, if false, it should be vertically stacked relative to the others.protected static final Font
The default label font.protected JPanel
JPanel
that will contain the GUI representation of theTunableHandler
.Fields inherited from class org.cytoscape.work.AbstractTunableHandler
CONTEXT, FORMAT, GRAVITY, TOOLTIP
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractGUITunableHandler
(Field field, Object instance, Tunable tunable) Standard base class constructor forTunableHandler
s that deal withTunable
s that annotate a control.protected
AbstractGUITunableHandler
(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
Modifier and TypeMethodDescriptionvoid
Adds the argument as a new dependency to thisGUITunableHandler
.void
Adds the argument as a new dependency to thisGUITunableHandler
.final void
changeOccurred
(String name, String state) This is called when aGUITunableHandler
that this tunable handler listens to makes a change.final void
checkDependency
(String depName, String depState) To check the dependencies of thisGUITunableHandler
with the others.String[]
Returns the name of differentGUITunableHandler
s that this tunable handler listens to.Returns the name of a differentGUITunableHandler
that this tunable handler depends on.Returns the panel associated with thisGUITunableHandler
.getState()
Returns a string representation of the value of theTunable
associated with thisGUITunableHandler
.abstract void
handle()
Updates an annotated object with the current value as retrieved from the the user interface generated by this handler.boolean
void
Notifies all dependents that this object has changed.void
Notifies all dependents that this object has changed.void
Attempts to set the value of the associated field or set method that has been annotated withTunable
.void
update()
The default implementation is a no-op.Methods inherited from class org.cytoscape.work.AbstractTunableHandler
controlsMutuallyExclusiveNestedChildren, dependsOn, getChildKey, getContext, getDescription, getExampleStringValue, getFormat, getGravity, getGroups, getLongDescription, getName, getParams, getQualifiedName, getRequired, getTooltip, getType, getValue, listenForChange, setOffset
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
controlsMutuallyExclusiveNestedChildren, dependsOn, getChildKey, getDescription, getExampleStringValue, getGroups, getLongDescription, getName, getParams, getQualifiedName, getType, getValue, listenForChange
-
Field Details
-
LABEL_FONT
The default label font. We have it here for consistency. -
horizontal
protected boolean horizontalIf true, the associated GUI element should be laid out next to others in the same group, if false, it should be vertically stacked relative to the others. -
panel
JPanel
that will contain the GUI representation of theTunableHandler
.
-
-
Constructor Details
-
AbstractGUITunableHandler
Standard base class constructor forTunableHandler
s that deal withTunable
s that annotate a control.- Parameters:
control
- An instance ofField
that represents a control annotated with@Tunable
instance
- An object instance that contains a control corresponding to the control parametertunable
- TheTunable
that annotates control
-
AbstractGUITunableHandler
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 Details
-
setValue
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
- Overrides:
setValue
in classAbstractTunableHandler
- Parameters:
newValue
- the value to be written into field or set method annotated withTunable
- Throws:
IllegalAccessException
InvocationTargetException
-
notifyDependents
public void notifyDependents()Notifies all dependents that this object has changed.- Specified by:
notifyDependents
in interfaceGUITunableHandler
-
notifyChangeListeners
public void notifyChangeListeners()Notifies all dependents that this object has changed.- Specified by:
notifyChangeListeners
in interfaceGUITunableHandler
-
addChangeListener
Adds the argument as a new dependency to thisGUITunableHandler
.- Specified by:
addChangeListener
in interfaceGUITunableHandler
- Parameters:
gh
-Handler
on which this one will depend on
-
addDependent
Adds the argument as a new dependency to thisGUITunableHandler
.- Specified by:
addDependent
in interfaceGUITunableHandler
- Parameters:
gh
-Handler
on which this one will depend on
-
getDependency
Description copied from interface:GUITunableHandler
Returns the name of a differentGUITunableHandler
that this tunable handler depends on.- Specified by:
getDependency
in interfaceGUITunableHandler
- Returns:
- the name of a different
GUITunableHandler
that this tunable handler depends on.
-
getChangeSources
Description copied from interface:GUITunableHandler
Returns the name of differentGUITunableHandler
s that this tunable handler listens to.- Specified by:
getChangeSources
in interfaceGUITunableHandler
- Returns:
- the name of different
GUITunableHandler
s that this tunable handler listens to.
-
changeOccurred
Description copied from interface:GUITunableHandler
This is called when aGUITunableHandler
that this tunable handler listens to makes a change. This method will call the abstract update() method if the change described by the name and state parameters has not already been recorded by this tunable handler.- Specified by:
changeOccurred
in interfaceGUITunableHandler
- Parameters:
name
- The name of theGUITunableHandler
that has changed.state
- The state theGUITunableHandler
has changed to.
-
checkDependency
Description copied from interface:GUITunableHandler
To check the dependencies of thisGUITunableHandler
with the others.Check the dependencies : - if there isn't any dependency, this handler's JPanel container is enabled - if there is, enable or not the JPanel, depending on the name (
depName
) and the state(depState
) of the dependencies of thisGUITunableHandler
- Specified by:
checkDependency
in interfaceGUITunableHandler
- Parameters:
depName
- if this handler has a dependency, it must match this in order for the associatedJPanel
to be enableddepState
- if this handler has a dependency, this must match the condition in order for the associatedJPanel
to be enabled
-
getJPanel
Returns the panel associated with thisGUITunableHandler
.- Specified by:
getJPanel
in interfaceGUITunableHandler
- Returns:
- the
JPanel
container of thisGUITunableHandler
-
handle
public abstract void handle()Description copied from interface:TunableHandler
Updates an annotated object with the current value as retrieved from the the user interface generated by this handler.- Specified by:
handle
in interfaceTunableHandler
-
update
public void update()The default implementation is a no-op. You should override this method if you want your tunable to update.- Specified by:
update
in interfaceGUITunableHandler
-
getState
Returns a string representation of the value of theTunable
associated with thisGUITunableHandler
.- Specified by:
getState
in interfaceGUITunableHandler
- Returns:
- the current value of the associated
Tunable
represented as a string
-
isHorizontal
public boolean isHorizontal()
-