Package org.cytoscape.view.model
Interface CyNetworkView
-
- All Superinterfaces:
CyDisposable
,CyIdentifiable
,View<CyNetwork>
- All Known Subinterfaces:
CyNetworkViewSnapshot
,NullCyNetworkView
public interface CyNetworkView extends View<CyNetwork>, CyDisposable
Additional methods for CyNetworkView. Network view should implement BOTH View and CyNetworkView.Warning: if you just added a node or edge in
CyNetwork
,getNodeView(org.cytoscape.model.CyNode)
orgetEdgeView(org.cytoscape.model.CyEdge)
will probably return null for the newly created node or edge. You may have to callCyEventHelper.flushPayloadEvents()
prior to callinggetNodeView(org.cytoscape.model.CyNode)
orgetEdgeView(org.cytoscape.model.CyEdge)
, so that theCyNetworkView
gets a chance to create the views. If you are creating a bunch of nodes and edges at once, callflushPayloadEvents
after all the nodes and edges are created.Module:
viewmodel-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>viewmodel-api</artifactId> </dependency>
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.
-
-
Field Summary
-
Fields inherited from interface org.cytoscape.model.CyIdentifiable
SUID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
addNetworkViewListener(CyNetworkViewListener listener)
Adds a CyNetworkViewListener (optional operation).default CyNetworkViewSnapshot
createSnapshot()
Returns an immutable snapshot of this network view (optional operation).default boolean
dirty(boolean clear)
If this network view supports creating snapshots using thecreateSnapshot()
method, then this method will return true if the state of the network has changed since last clearing the dirty flag.void
fitContent()
Utility method to fit content to the presentation container (usually a Swing Window).void
fitSelected()
Utility method to fit selected graph objects to the presentation container.Collection<View<? extends CyIdentifiable>>
getAllViews()
Returns a list of all View including those for Nodes, Edges, and Network.View<CyEdge>
getEdgeView(CyEdge edge)
Returns a View for a specified Edge.Collection<View<CyEdge>>
getEdgeViews()
Returns a list of Views for all CyEdges in the network.default Iterable<View<CyEdge>>
getEdgeViewsIterable()
Returns an Iterable for all edge views in the network.View<CyNode>
getNodeView(CyNode node)
Returns a View for a specified Node.Collection<View<CyNode>>
getNodeViews()
Returns a list of Views for all CyNodes in the network.default Iterable<View<CyNode>>
getNodeViewsIterable()
Returns an Iterable for all node views in the network.String
getRendererId()
Returns the ID of the renderer that must be used to render this view.default void
removeNetworkViewListener(CyNetworkViewListener listener)
Removes a CyNetworkViewListener.<T,V extends T>
voidsetViewDefault(VisualProperty<? extends T> vp, V defaultValue)
Sets the default value to be used for the specified visual property.default boolean
supportsSnapshots()
Returns true if this network view supports creating snapshots, the createSnapshot() method will not throw an exception.void
updateView()
Cascading event for the presentation layer for updating presentation.-
Methods inherited from interface org.cytoscape.model.CyDisposable
dispose
-
Methods inherited from interface org.cytoscape.model.CyIdentifiable
getSUID
-
Methods inherited from interface org.cytoscape.view.model.View
batch, batch, clearValueLock, clearVisualProperties, getModel, getVisualProperty, isDirectlyLocked, isSet, isValueLocked, setLockedValue, setVisualProperty
-
-
-
-
Method Detail
-
getNodeView
View<CyNode> getNodeView(CyNode node)
Returns a View for a specified Node.- Parameters:
node
- Node object- Returns:
- View for the given node object.
-
getNodeViews
Collection<View<CyNode>> getNodeViews()
Returns a list of Views for all CyNodes in the network.- Returns:
- Collection of all node views in this network.
-
getNodeViewsIterable
default Iterable<View<CyNode>> getNodeViewsIterable()
Returns an Iterable for all node views in the network. This operation may have better performance thangetNodeViews()
but that is not guaranteed.
-
getEdgeView
View<CyEdge> getEdgeView(CyEdge edge)
Returns a View for a specified Edge.- Parameters:
edge
- the edge to return the view for.- Returns:
- View model for the edge data.
-
getEdgeViews
Collection<View<CyEdge>> getEdgeViews()
Returns a list of Views for all CyEdges in the network.- Returns:
- All edge views in this network.
-
getEdgeViewsIterable
default Iterable<View<CyEdge>> getEdgeViewsIterable()
Returns an Iterable for all edge views in the network. This operation may have better performance thangetEdgeViews()
but that is not guaranteed.
-
getAllViews
Collection<View<? extends CyIdentifiable>> getAllViews()
Returns a list of all View including those for Nodes, Edges, and Network.- Returns:
- All view objects in this network including network view itself.
-
fitContent
void fitContent()
Utility method to fit content to the presentation container (usually a Swing Window). This fires event to the presentation layer for updating presentation.
-
fitSelected
void fitSelected()
Utility method to fit selected graph objects to the presentation container. This fires event to the presentation layer for updating presentation.
-
updateView
void updateView()
Cascading event for the presentation layer for updating presentation.
-
getRendererId
String getRendererId()
Returns the ID of the renderer that must be used to render this view.- See Also:
NetworkViewRenderer.getId()
,org.cytoscape.application.CyApplicationManager#getNetworkViewRenderer(rendererId)
-
setViewDefault
<T,V extends T> void setViewDefault(VisualProperty<? extends T> vp, V defaultValue)
Sets the default value to be used for the specified visual property.- Type Parameters:
T
- The type of the visual property value.V
- The default value for the visual property, which must extend T.- Parameters:
vp
- The visual property whose default value we're specifying.defaultValue
- The default value to be used for this visual property for this view.
-
supportsSnapshots
default boolean supportsSnapshots()
Returns true if this network view supports creating snapshots, the createSnapshot() method will not throw an exception.- Since:
- 3.8
-
createSnapshot
default CyNetworkViewSnapshot createSnapshot()
Returns an immutable snapshot of this network view (optional operation).- Throws:
UnsupportedOperationException
- if creating a snapshot is not supported by this network view- Since:
- 3.8
-
dirty
default boolean dirty(boolean clear)
If this network view supports creating snapshots using thecreateSnapshot()
method, then this method will return true if the state of the network has changed since last clearing the dirty flag. If this network view does not support creating snapshots then this method will always return false.- Parameters:
clear
- If true then the dirty flag will be set to false.- Since:
- 3.8
-
addNetworkViewListener
default void addNetworkViewListener(CyNetworkViewListener listener)
Adds a CyNetworkViewListener (optional operation).- Throws:
UnsupportedOperationException
- if this method is not supported by this network view- Since:
- 3.8
-
removeNetworkViewListener
default void removeNetworkViewListener(CyNetworkViewListener listener)
Removes a CyNetworkViewListener.- Throws:
UnsupportedOperationException
- if this method is not supported by this network view- Since:
- 3.8
-
-