Package org.cytoscape.view.layout
Class AbstractLayoutTask
- java.lang.Object
-
- org.cytoscape.work.AbstractTask
-
- org.cytoscape.view.layout.AbstractLayoutTask
-
- All Implemented Interfaces:
Task
- Direct Known Subclasses:
AbstractPartitionLayoutTask
public abstract class AbstractLayoutTask extends AbstractTask
This is a basic implementation of a LayoutAlgorithm Task that does some bookkeeping, but primarily delegates to the doLayout() method. Extensions of this class are meant to operate on the CyNetworkView provided to the constructor (and is available as a protected member variable).Module:
layout-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>layout-api</artifactId> </dependency>
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
Fields Modifier and Type Field Description protected static String
LAYOUT_ALGORITHM
The table column name that provides the layout algorithm name.protected String
layoutAttribute
The attribute to be used for this layout.protected CyNetworkView
networkView
The network view that the layout will be applied to.protected Set<View<CyNode>>
nodesToLayOut
The node views that will be laid out by the algorithm.protected boolean
recenter
Determines whether the resulting set of nodes should be moved back to their original centroid after being laid out.protected UndoSupport
undo
Undo support for the task.-
Fields inherited from class org.cytoscape.work.AbstractTask
cancelled
-
-
Constructor Summary
Constructors Constructor Description AbstractLayoutTask(String displayName, CyNetworkView networkView, Set<View<CyNode>> nodesToLayOut, String layoutAttribute, UndoSupport undo)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
doLayout(TaskMonitor taskMonitor)
This method is designed to actually encapsulate the layout algorithm.void
run(TaskMonitor taskMonitor)
This method is called when theTask
begins execution.-
Methods inherited from class org.cytoscape.work.AbstractTask
cancel, getTaskIterator, insertTasksAfterCurrentTask, insertTasksAfterCurrentTask, setTaskIterator
-
-
-
-
Field Detail
-
LAYOUT_ALGORITHM
protected static final String LAYOUT_ALGORITHM
The table column name that provides the layout algorithm name.- See Also:
- Constant Field Values
-
networkView
protected final CyNetworkView networkView
The network view that the layout will be applied to.
-
nodesToLayOut
protected final Set<View<CyNode>> nodesToLayOut
The node views that will be laid out by the algorithm.
-
layoutAttribute
protected final String layoutAttribute
The attribute to be used for this layout. May be null and/or ignored.
-
undo
protected final UndoSupport undo
Undo support for the task.
-
recenter
protected boolean recenter
Determines whether the resulting set of nodes should be moved back to their original centroid after being laid out.
-
-
Constructor Detail
-
AbstractLayoutTask
public AbstractLayoutTask(String displayName, CyNetworkView networkView, Set<View<CyNode>> nodesToLayOut, String layoutAttribute, UndoSupport undo)
Constructor.- Parameters:
displayName
- The name of the layout algorithm.networkView
- The network view that the layout algorithm will be applied to.nodesToLayOut
- The set of nodes to be laid out.layoutAttribute
- The name of the attribute to use for the layout. May be null or empty.
-
-
Method Detail
-
run
public final void run(TaskMonitor taskMonitor)
This method is called when theTask
begins execution. This method should not be called by the programmer, as it will be called by theTaskManager
.- Specified by:
run
in interfaceTask
- Specified by:
run
in classAbstractTask
- Parameters:
taskMonitor
- TheTaskMonitor
provided byTaskManager
. to allow theTask
to modify its user interface.
-
doLayout
protected abstract void doLayout(TaskMonitor taskMonitor)
This method is designed to actually encapsulate the layout algorithm. It will be called from within the run() method of the task.- Parameters:
taskMonitor
- Provided to allow updates to the task status.
-
-