Class SelectedNodesAndEdgesEvent
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 Summary
ConstructorDescriptionSelectedNodesAndEdgesEvent
(CyNetwork source, boolean isCurrentNetwork, boolean nodesChanged, boolean edgesChanged) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the selection stated of edges has changed.Returns the CyNetwork event source.Returns all the edges in the network that are currently selected.Returns all the nodes in the network that are currently selected.Returns all the edges in the network that are currently unselected.Returns all the nodes in the network that are currently unselected.boolean
Returns true if the network event source is the current network.boolean
Returns true if the selection state of nodes has changed.Methods inherited from class org.cytoscape.event.AbstractCyEvent
getListenerClass, getSource
-
Constructor Details
-
SelectedNodesAndEdgesEvent
public SelectedNodesAndEdgesEvent(CyNetwork source, boolean isCurrentNetwork, boolean nodesChanged, boolean edgesChanged)
-
-
Method Details
-
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
Returns all the nodes in the network that are currently selected. -
getUnselectedNodes
Returns all the nodes in the network that are currently unselected. -
getSelectedEdges
Returns all the edges in the network that are currently selected. -
getUnselectedEdges
Returns all the edges in the network that are currently unselected.
-