public abstract class AbstractGUITunableHandler extends AbstractTunableHandler implements GUITunableHandler
TunableHandler
.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>
Modifier and Type | Class and Description |
---|---|
class |
AbstractGUITunableHandler.TunableFieldPanel
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.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
horizontal
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 Font |
LABEL_FONT
The default label font.
|
protected JPanel |
panel
JPanel that will contain the GUI representation of the TunableHandler . |
CONTEXT, FORMAT, GRAVITY, TOOLTIP
Modifier | Constructor and Description |
---|---|
protected |
AbstractGUITunableHandler(Field field,
Object instance,
Tunable tunable)
Standard base class constructor for
TunableHandler s that deal with
Tunable s that annotate a control. |
protected |
AbstractGUITunableHandler(Method getter,
Method setter,
Object instance,
Tunable tunable)
Standard base class constructor for
TunableHandler s that deal with
Tunable s that use getter and setter methods. |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(GUITunableHandler gh)
Adds the argument as a new dependency to this
GUITunableHandler . |
void |
addDependent(GUITunableHandler gh)
Adds the argument as a new dependency to this
GUITunableHandler . |
void |
changeOccurred(String name,
String state)
This is called when a
GUITunableHandler that this tunable handler listens to makes
a change. |
void |
checkDependency(String depName,
String depState)
To check the dependencies of this
GUITunableHandler with the others. |
String[] |
getChangeSources()
Returns the name of different
GUITunableHandler s that this tunable handler listens to. |
String |
getDependency()
Returns the name of a different
GUITunableHandler that this tunable handler depends on. |
JPanel |
getJPanel()
Returns the panel associated with this
GUITunableHandler . |
String |
getState()
Returns a string representation of the value of the
Tunable associated with
this GUITunableHandler . |
abstract void |
handle()
Updates an annotated object with the current value as retrieved from the
the user interface generated by this handler.
|
boolean |
isHorizontal() |
void |
notifyChangeListeners()
Notifies all dependents that this object has changed.
|
void |
notifyDependents()
Notifies all dependents that this object has changed.
|
void |
setValue(Object newValue)
Attempts to set the value of the associated field or set method that has been
annotated with
Tunable . |
void |
update()
The default implementation is a no-op.
|
controlsMutuallyExclusiveNestedChildren, dependsOn, getChildKey, getContext, getDescription, getExampleStringValue, getFormat, getGravity, getGroups, getLongDescription, getName, getParams, getQualifiedName, getRequired, getTooltip, getType, getValue, listenForChange, setOffset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
controlsMutuallyExclusiveNestedChildren, dependsOn, getChildKey, getDescription, getExampleStringValue, getGroups, getLongDescription, getName, getParams, getQualifiedName, getType, getValue, listenForChange
protected static final Font LABEL_FONT
protected boolean horizontal
protected JPanel panel
JPanel
that will contain the GUI representation of the TunableHandler
.protected AbstractGUITunableHandler(Field field, Object instance, Tunable tunable)
TunableHandler
s that deal with
Tunable
s that annotate a control.control
- An instance of Field
that represents a control annotated with @Tunable
instance
- An object instance that contains a control corresponding to the control parametertunable
- The Tunable
that annotates controlprotected AbstractGUITunableHandler(Method getter, Method setter, Object instance, Tunable tunable)
TunableHandler
s that deal with
Tunable
s that use getter and setter methods.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
- The Tunable
that annotates the getter.public void setValue(Object newValue) throws IllegalAccessException, InvocationTargetException
TunableHandler
Tunable
.setValue
in interface TunableHandler
setValue
in class AbstractTunableHandler
newValue
- the value to be written into field or set method annotated with Tunable
IllegalAccessException
InvocationTargetException
public void notifyDependents()
notifyDependents
in interface GUITunableHandler
public void notifyChangeListeners()
notifyChangeListeners
in interface GUITunableHandler
public void addChangeListener(GUITunableHandler gh)
GUITunableHandler
.addChangeListener
in interface GUITunableHandler
gh
- Handler
on which this one will depend onpublic void addDependent(GUITunableHandler gh)
GUITunableHandler
.addDependent
in interface GUITunableHandler
gh
- Handler
on which this one will depend onpublic String getDependency()
GUITunableHandler
GUITunableHandler
that this tunable handler depends on.getDependency
in interface GUITunableHandler
GUITunableHandler
that this tunable handler depends on.public String[] getChangeSources()
GUITunableHandler
GUITunableHandler
s that this tunable handler listens to.getChangeSources
in interface GUITunableHandler
GUITunableHandler
s that this tunable handler listens to.public final void changeOccurred(String name, String state)
GUITunableHandler
GUITunableHandler
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.changeOccurred
in interface GUITunableHandler
name
- The name of the GUITunableHandler
that has changed.state
- The state the GUITunableHandler
has changed to.public final void checkDependency(String depName, String depState)
GUITunableHandler
GUITunableHandler
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
checkDependency
in interface GUITunableHandler
depName
- if this handler has a dependency, it must match this in order
for the associated JPanel
to be enableddepState
- if this handler has a dependency, this must match the condition
in order for the associated JPanel
to be enabledpublic JPanel getJPanel()
GUITunableHandler
.getJPanel
in interface GUITunableHandler
JPanel
container of this GUITunableHandler
public abstract void handle()
TunableHandler
handle
in interface TunableHandler
public void update()
update
in interface GUITunableHandler
public String getState()
Tunable
associated with
this GUITunableHandler
.getState
in interface GUITunableHandler
Tunable
represented as a stringpublic boolean isHorizontal()
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.