Class SelectedNodesAndEdgesEvent

java.lang.Object
org.cytoscape.event.AbstractCyEvent<CyNetwork>
org.cytoscape.model.events.SelectedNodesAndEdgesEvent
All Implemented Interfaces:
CyEvent<CyNetwork>

public class SelectedNodesAndEdgesEvent extends AbstractCyEvent<CyNetwork>
Event that signals when the selection state of nodes and/or edges has changed within a network.

This is a convenience API. The traditional way to detect node/edge selection is to use a RowsSetEvent. However that event fires for every change to a table, not just selection change, and requires the listener to map the rows that changed back to nodes and edges. This event provides a more convenient API for listeners that just want to be signaled about selection changes and provides direct access to the CyNode and CyEdge objects.

Note: Node selection is stored in the default node table, and edge selection is stored in the default edge table, meaning that node selection and edge selection have different event sources. This results in two of these events being fired when both node and edge selection changes. It is safe to handle both events. If the listener only cares about node events this is indicated by the nodesChanged method.

Note: The event source for this event is the CyNetwork, not the default node or edge table.


Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.

Module: model-api

To use this in your app, include the following dependency in your POM:

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>model-api</artifactId>
</dependency>
  • Constructor Details

    • SelectedNodesAndEdgesEvent

      public SelectedNodesAndEdgesEvent(CyNetwork source, boolean isCurrentNetwork, boolean nodesChanged, boolean edgesChanged)
  • Method Details

    • getNetwork

      public CyNetwork getNetwork()
      Returns the CyNetwork event source.
    • isCurrentNetwork

      public boolean isCurrentNetwork()
      Returns true if the network event source is the current network.
    • nodesChanged

      public boolean nodesChanged()
      Returns true if the selection state of nodes has changed.
    • edgesChanged

      public boolean edgesChanged()
      Returns true if the selection stated of edges has changed.
    • getSelectedNodes

      public Collection<CyNode> getSelectedNodes()
      Returns all the nodes in the network that are currently selected.
    • getUnselectedNodes

      public Collection<CyNode> getUnselectedNodes()
      Returns all the nodes in the network that are currently unselected.
    • getSelectedEdges

      public Collection<CyEdge> getSelectedEdges()
      Returns all the edges in the network that are currently selected.
    • getUnselectedEdges

      public Collection<CyEdge> getUnselectedEdges()
      Returns all the edges in the network that are currently unselected.