Interface AnnotationManager
public interface AnnotationManager
The annotation manager is responsible for managing all of the
annotations currently assigned to a particular
Note: When using
Note: Changing the canvas of a GroupAnnotation will not automatically set its members to the same canvas. Each annotation must have its setCanvas() method called individually.
org.cytoscape.view.model.NetworkView
. Annotations must
be added to the annotation manager to be displayed.
Note: When using
GroupAnnotation
cycles are not allowed. The structure created by using GroupAnnotations
must be a tree. If adding a GroupAnnotation would cause a cycle then IllegalArgumentException will be thrown.
Note: Changing the canvas of a GroupAnnotation will not automatically set its members to the same canvas. Each annotation must have its setCanvas() method called individually.
Module: presentation-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotation(Annotation annotation)
Add an annotation to the specified network view.void
addAnnotations(Collection<? extends Annotation> annotations)
Adds annotations to the specified network view.getAnnotations(CyNetworkView networkView)
Retrieve the list of annotations for a specific network view.getSelectedAnnotations(CyNetworkView networkView)
Retrieve the list of selected annotations for a specific network view.void
removeAnnotation(Annotation annotation)
Remove an annotation from its network view.void
removeAnnotations(Collection<? extends Annotation> annotations)
Removes annotations from its network view .
-
Method Details
-
addAnnotation
Add an annotation to the specified network view. If the annotation is a GroupAnnotation then its members will be added as well.- Parameters:
annotation
- the annotation to addnetworkView
- the network view to add this annotation to- Throws:
IllegalArgumentException
- if the annotation is a GroupAnnotation and it causes a cycle
-
addAnnotations
Adds annotations to the specified network view. GroupAnnotations will have its members added as well.- Parameters:
annotations
- the annotations to addnetworkView
- the network view to add this annotation to- Throws:
IllegalArgumentException
- if any of the annotations are a GroupAnnotation and causes a cycle
-
removeAnnotation
Remove an annotation from its network view. If there are no other references to this annotation, it will be garbage collected.- Parameters:
annotation
- the annotation to remove
-
removeAnnotations
Removes annotations from its network view .- Parameters:
annotations
- the annotations to remove
-
getAnnotations
Retrieve the list of annotations for a specific network view.- Parameters:
networkView
- the network view to get the list from- Returns:
- the list of annotations
-
getSelectedAnnotations
Retrieve the list of selected annotations for a specific network view.- Parameters:
networkView
- the network view to get the list from- Returns:
- the list of selected annotations or an empty list if there is none.
-