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
TunableHandlers that deal with
Tunables that annotate a control. |
protected |
AbstractGUITunableHandler(Method getter,
Method setter,
Object instance,
Tunable tunable)
Standard base class constructor for
TunableHandlers that deal with
Tunables 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
GUITunableHandlers 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, getFormat, getGravity, getGroups, getName, getParams, getQualifiedName, getRequired, getTooltip, getType, getValue, listenForChangeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontrolsMutuallyExclusiveNestedChildren, dependsOn, getChildKey, getDescription, getGroups, getName, getParams, getQualifiedName, getType, getValue, listenForChangeprotected 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)
TunableHandlers that deal with
Tunables that annotate a control.control - An instance of Field that represents a control annotated with @Tunableinstance - 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)
TunableHandlers that deal with
Tunables 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
AbstractTunableHandlerTunable.setValue in interface TunableHandlersetValue in class AbstractTunableHandlernewValue - the value to be written into field or set method annotated with TunableIllegalAccessExceptionInvocationTargetExceptionpublic void notifyDependents()
notifyDependents in interface GUITunableHandlerpublic void notifyChangeListeners()
notifyChangeListeners in interface GUITunableHandlerpublic void addChangeListener(GUITunableHandler gh)
GUITunableHandler.addChangeListener in interface GUITunableHandlergh - Handler on which this one will depend onpublic void addDependent(GUITunableHandler gh)
GUITunableHandler.addDependent in interface GUITunableHandlergh - Handler on which this one will depend onpublic String getDependency()
GUITunableHandlerGUITunableHandler that this tunable handler depends on.getDependency in interface GUITunableHandlerGUITunableHandler that this tunable handler depends on.public String[] getChangeSources()
GUITunableHandlerGUITunableHandlers that this tunable handler listens to.getChangeSources in interface GUITunableHandlerGUITunableHandlers that this tunable handler listens to.public final void changeOccurred(String name, String state)
GUITunableHandlerGUITunableHandler 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 GUITunableHandlername - The name of the GUITunableHandler that has changed.state - The state the GUITunableHandler has changed to.public final void checkDependency(String depName, String depState)
GUITunableHandlerGUITunableHandler 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 this GUITunableHandler
checkDependency in interface GUITunableHandlerdepName - 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 GUITunableHandlerJPanel container of this GUITunableHandlerpublic abstract void handle()
TunableHandlerhandle in interface TunableHandlerpublic void update()
update in interface GUITunableHandlerpublic String getState()
Tunable associated with
this GUITunableHandler.getState in interface GUITunableHandlerTunable represented as a stringpublic boolean isHorizontal()
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.