public class SelectedNodesAndEdgesEvent extends AbstractCyEvent<CyNetwork>
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.
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 and Description |
---|
SelectedNodesAndEdgesEvent(CyNetwork source,
boolean isCurrentNetwork,
boolean nodesChanged,
boolean edgesChanged) |
Modifier and Type | Method and Description |
---|---|
boolean |
edgesChanged()
Returns true if the selection stated of edges has changed.
|
CyNetwork |
getNetwork()
Returns the CyNetwork event source.
|
Collection<CyEdge> |
getSelectedEdges()
Returns all the edges in the network that are currently selected.
|
Collection<CyNode> |
getSelectedNodes()
Returns all the nodes in the network that are currently selected.
|
Collection<CyEdge> |
getUnselectedEdges()
Returns all the edges in the network that are currently unselected.
|
Collection<CyNode> |
getUnselectedNodes()
Returns all the nodes in the network that are currently unselected.
|
boolean |
isCurrentNetwork()
Returns true if the network event source is the current network.
|
boolean |
nodesChanged()
Returns true if the selection state of nodes has changed.
|
getListenerClass, getSource
public SelectedNodesAndEdgesEvent(CyNetwork source, boolean isCurrentNetwork, boolean nodesChanged, boolean edgesChanged)
public CyNetwork getNetwork()
public boolean isCurrentNetwork()
public boolean nodesChanged()
public boolean edgesChanged()
public Collection<CyNode> getSelectedNodes()
public Collection<CyNode> getUnselectedNodes()
public Collection<CyEdge> getSelectedEdges()
public Collection<CyEdge> getUnselectedEdges()
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.