Cytoscape 3.0.1 API

org.cytoscape.work.swing
Class AbstractGUITunableHandler

java.lang.Object
  extended by org.cytoscape.work.AbstractTunableHandler
      extended by 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.

Field Summary
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  JPanel panel
          JPanel that will contain the GUI representation of the TunableHandler.
 
Constructor Summary
protected AbstractGUITunableHandler(Field field, Object instance, Tunable tunable)
          Standard base class constructor for TunableHandlers that deal with Tunables that annotate a field.
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.
 
Method Summary
 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.
 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.
 
Methods inherited from class org.cytoscape.work.AbstractTunableHandler
controlsMutuallyExclusiveNestedChildren, dependsOn, getChildKey, getDescription, getGroups, getName, getParams, getQualifiedName, getType, getValue, listenForChange
 
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, getGroups, getName, getParams, getQualifiedName, getType, getValue, listenForChange
 

Field Detail

horizontal

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.


panel

protected JPanel panel
JPanel that will contain the GUI representation of the TunableHandler.

Constructor Detail

AbstractGUITunableHandler

protected AbstractGUITunableHandler(Field field,
                                    Object instance,
                                    Tunable tunable)
Standard base class constructor for TunableHandlers that deal with Tunables that annotate a field.

Parameters:
field - An instance of Field that represents a field annotated with @Tunable
instance - An object instance that contains a field corresponding to the field parameter
tunable - The Tunable that annotates field

AbstractGUITunableHandler

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.

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 - The Tunable that annotates the getter.
Method Detail

setValue

public void setValue(Object newValue)
              throws IllegalAccessException,
                     InvocationTargetException
Description copied from class: AbstractTunableHandler
Attempts to set the value of the associated field or set method that has been annotated with Tunable.

Specified by:
setValue in interface TunableHandler
Overrides:
setValue in class AbstractTunableHandler
Parameters:
newValue - the value to be written into field or set method annotated with Tunable
Throws:
IllegalAccessException
InvocationTargetException

notifyDependents

public void notifyDependents()
Notifies all dependents that this object has changed.

Specified by:
notifyDependents in interface GUITunableHandler

notifyChangeListeners

public void notifyChangeListeners()
Notifies all dependents that this object has changed.

Specified by:
notifyChangeListeners in interface GUITunableHandler

addChangeListener

public void addChangeListener(GUITunableHandler gh)
Adds the argument as a new dependency to this GUITunableHandler.

Specified by:
addChangeListener in interface GUITunableHandler
Parameters:
gh - Handler on which this one will depend on

addDependent

public void addDependent(GUITunableHandler gh)
Adds the argument as a new dependency to this GUITunableHandler.

Specified by:
addDependent in interface GUITunableHandler
Parameters:
gh - Handler on which this one will depend on

getDependency

public String getDependency()
Returns the name of a different GUITunableHandler that this tunable handler depends on.

Specified by:
getDependency in interface GUITunableHandler
Returns:
the name of a different GUITunableHandler that this tunable handler depends on.

getChangeSources

public String[] getChangeSources()
Returns the name of different GUITunableHandlers that this tunable handler listens to.

Specified by:
getChangeSources in interface GUITunableHandler
Returns:
the name of different GUITunableHandlers that this tunable handler listens to.

changeOccurred

public final void changeOccurred(String name,
                                 String state)
This is called when a 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.

Specified by:
changeOccurred in interface GUITunableHandler
Parameters:
name - The name of the GUITunableHandler that has changed.
state - The state the GUITunableHandler has changed to.

checkDependency

public final void checkDependency(String depName,
                                  String depState)
To check the dependencies of this 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 this GUITunableHandler
  

Specified by:
checkDependency in interface GUITunableHandler
Parameters:
depName - if this handler has a dependency, it must match this in order for the associated JPanel to be enabled
depState - if this handler has a dependency, this must match the condition in order for the associated JPanel to be enabled

getJPanel

public JPanel getJPanel()
Returns the panel associated with this GUITunableHandler.

Specified by:
getJPanel in interface GUITunableHandler
Returns:
the JPanel container of this GUITunableHandler

handle

public abstract void handle()
Updates an annotated object with the current value as retrieved from the the user interface generated by this handler.

Specified by:
handle in interface TunableHandler

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 interface GUITunableHandler

getState

public String getState()
Returns a string representation of the value of the Tunable associated with this GUITunableHandler.

Specified by:
getState in interface GUITunableHandler
Returns:
the current value of the associated Tunable represented as a string

Cytoscape 3.0.1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.