Interface AnnotationManager


public interface AnnotationManager
The annotation manager is responsible for managing all of the annotations currently assigned to a particular 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 Details

    • addAnnotation

      void addAnnotation(Annotation annotation)
      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 add
      networkView - the network view to add this annotation to
      Throws:
      IllegalArgumentException - if the annotation is a GroupAnnotation and it causes a cycle
    • addAnnotations

      void addAnnotations(Collection<? extends Annotation> annotations)
      Adds annotations to the specified network view. GroupAnnotations will have its members added as well.
      Parameters:
      annotations - the annotations to add
      networkView - the network view to add this annotation to
      Throws:
      IllegalArgumentException - if any of the annotations are a GroupAnnotation and causes a cycle
    • removeAnnotation

      void removeAnnotation(Annotation annotation)
      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

      void removeAnnotations(Collection<? extends Annotation> annotations)
      Removes annotations from its network view .
      Parameters:
      annotations - the annotations to remove
    • getAnnotations

      List<Annotation> getAnnotations(CyNetworkView networkView)
      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

      List<Annotation> getSelectedAnnotations(CyNetworkView networkView)
      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.