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>
  • Field Details

    • LABEL_FONT

      protected static final Font LABEL_FONT
      The default label font. We have it here for consistency.
    • 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 Details

    • AbstractGUITunableHandler

      protected AbstractGUITunableHandler(Field field, Object instance, Tunable tunable)
      Standard base class constructor for TunableHandlers that deal with Tunables that annotate a control.
      Parameters:
      control - An instance of Field that represents a control annotated with @Tunable
      instance - An object instance that contains a control corresponding to the control parameter
      tunable - The Tunable that annotates control
    • 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 Details

    • setValue

      public void setValue(Object newValue) throws IllegalAccessException, InvocationTargetException
      Description copied from interface: TunableHandler
      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()
      Description copied from interface: GUITunableHandler
      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()
      Description copied from interface: GUITunableHandler
      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)
      Description copied from interface: GUITunableHandler
      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)
      Description copied from interface: GUITunableHandler
      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()
      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 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
    • isHorizontal

      public boolean isHorizontal()