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
Nested ClassesModifier and TypeClassDescriptionfinal classThe 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
FieldsModifier and TypeFieldDescriptionprotected booleanIf 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 FontThe default label font.protected JPanelJPanelthat will contain the GUI representation of theTunableHandler.Fields inherited from class org.cytoscape.work.AbstractTunableHandler
CONTEXT, FORMAT, GRAVITY, TOOLTIP -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGUITunableHandler(Field field, Object instance, Tunable tunable) Standard base class constructor forTunableHandlers that deal withTunables that annotate a control.protectedAbstractGUITunableHandler(Method getter, Method setter, Object instance, Tunable tunable) Standard base class constructor forTunableHandlers that deal withTunables that use getter and setter methods. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the argument as a new dependency to thisGUITunableHandler.voidAdds the argument as a new dependency to thisGUITunableHandler.final voidchangeOccurred(String name, String state) This is called when aGUITunableHandlerthat this tunable handler listens to makes a change.final voidcheckDependency(String depName, String depState) To check the dependencies of thisGUITunableHandlerwith the others.String[]Returns the name of differentGUITunableHandlers that this tunable handler listens to.Returns the name of a differentGUITunableHandlerthat this tunable handler depends on.Returns the panel associated with thisGUITunableHandler.getState()Returns a string representation of the value of theTunableassociated with thisGUITunableHandler.abstract voidhandle()Updates an annotated object with the current value as retrieved from the the user interface generated by this handler.booleanvoidNotifies all dependents that this object has changed.voidNotifies all dependents that this object has changed.voidAttempts to set the value of the associated field or set method that has been annotated withTunable.voidupdate()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, setOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
JPanelthat will contain the GUI representation of theTunableHandler.
-
-
Constructor Details
-
AbstractGUITunableHandler
Standard base class constructor forTunableHandlers that deal withTunables that annotate a control.- Parameters:
control- An instance ofFieldthat represents a control annotated with@Tunableinstance- An object instance that contains a control corresponding to the control parametertunable- TheTunablethat annotates control
-
AbstractGUITunableHandler
Standard base class constructor forTunableHandlers that deal withTunables 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- TheTunablethat annotates the getter.
-
-
Method Details
-
setValue
Description copied from interface:TunableHandlerAttempts to set the value of the associated field or set method that has been annotated withTunable.- Specified by:
setValuein interfaceTunableHandler- Overrides:
setValuein classAbstractTunableHandler- Parameters:
newValue- the value to be written into field or set method annotated withTunable- Throws:
IllegalAccessExceptionInvocationTargetException
-
notifyDependents
public void notifyDependents()Notifies all dependents that this object has changed.- Specified by:
notifyDependentsin interfaceGUITunableHandler
-
notifyChangeListeners
public void notifyChangeListeners()Notifies all dependents that this object has changed.- Specified by:
notifyChangeListenersin interfaceGUITunableHandler
-
addChangeListener
Adds the argument as a new dependency to thisGUITunableHandler.- Specified by:
addChangeListenerin interfaceGUITunableHandler- Parameters:
gh-Handleron which this one will depend on
-
addDependent
Adds the argument as a new dependency to thisGUITunableHandler.- Specified by:
addDependentin interfaceGUITunableHandler- Parameters:
gh-Handleron which this one will depend on
-
getDependency
Description copied from interface:GUITunableHandlerReturns the name of a differentGUITunableHandlerthat this tunable handler depends on.- Specified by:
getDependencyin interfaceGUITunableHandler- Returns:
- the name of a different
GUITunableHandlerthat this tunable handler depends on.
-
getChangeSources
Description copied from interface:GUITunableHandlerReturns the name of differentGUITunableHandlers that this tunable handler listens to.- Specified by:
getChangeSourcesin interfaceGUITunableHandler- Returns:
- the name of different
GUITunableHandlers that this tunable handler listens to.
-
changeOccurred
Description copied from interface:GUITunableHandlerThis is called when aGUITunableHandlerthat 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:
changeOccurredin interfaceGUITunableHandler- Parameters:
name- The name of theGUITunableHandlerthat has changed.state- The state theGUITunableHandlerhas changed to.
-
checkDependency
Description copied from interface:GUITunableHandlerTo check the dependencies of thisGUITunableHandlerwith 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:
checkDependencyin interfaceGUITunableHandler- Parameters:
depName- if this handler has a dependency, it must match this in order for the associatedJPanelto be enableddepState- if this handler has a dependency, this must match the condition in order for the associatedJPanelto be enabled
-
getJPanel
Returns the panel associated with thisGUITunableHandler.- Specified by:
getJPanelin interfaceGUITunableHandler- Returns:
- the
JPanelcontainer of thisGUITunableHandler
-
handle
public abstract void handle()Description copied from interface:TunableHandlerUpdates an annotated object with the current value as retrieved from the the user interface generated by this handler.- Specified by:
handlein 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:
updatein interfaceGUITunableHandler
-
getState
Returns a string representation of the value of theTunableassociated with thisGUITunableHandler.- Specified by:
getStatein interfaceGUITunableHandler- Returns:
- the current value of the associated
Tunablerepresented as a string
-
isHorizontal
public boolean isHorizontal()
-