Interface CyNetworkViewFactoryProvider
A singleton factory that is used to create CyNetworkViewFactory
objects.
Apps that contribute renderers (via NetworkViewRenderer) may provide their own
implementation of CyNetworkViewFactory
, or they may acquire a reusable
instance of CyNetworkViewFactory
from this service. The CyNetworkViewFactory
provided by this service may be configured using a provided VisualLexicon
and optionally
via a CyNetworkViewFactoryConfig
object.
The CyNetworkViewFactoryFactory is available as an OSGi service.
Example of creating a CyNetworkViewFactory for a standard 2D renderer without additional configuration:
CyNetworkViewFactoryProvider provider = getService(bc, CyNetworkViewFactoryProvider.class); CyNetworkViewFactory netViewFactory = provider.createNetworkViewFactory(myLexicon, MyRenderer.ID);
Example of creating a CyNetworkViewFactory with additional configuration for 3D rendering:
CyNetworkViewFactoryProvider provider = getService(bc, CyNetworkViewFactoryProvider.class); CyNetworkViewFactoryConfig config = provider.createConfig(lexicon); config.addNonClearableVisualProperty(BasicVisualLexicon.NODE_Z_LOCATION); config.addTrackedVisualProperty(MyVisualLexicon.SELECTED_NODES, BasicVisualLexicon.NODE_SELECTED, Boolean.TRUE); CyNetworkViewFactory netViewFactory = provider.createNetworkViewFactory(lexicon, MyRenderer.ID, config);
- Since:
- 3.8
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 (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 Summary
Modifier and TypeMethodDescriptioncreateConfig
(VisualLexicon lexicon) Create a default configuration object for the given VisualLexicon.default CyNetworkViewFactory
createNetworkViewFactory
(VisualLexicon lexicon, String rendererID) Creates a CyNetworkViewFactory with a default CyNetworkViewConfig that supports standard 2D rendering.createNetworkViewFactory
(VisualLexicon lexicon, String rendererID, CyNetworkViewFactoryConfig config) Creates a CyNetworkViewFactory.
-
Method Details
-
createNetworkViewFactory
CyNetworkViewFactory createNetworkViewFactory(VisualLexicon lexicon, String rendererID, CyNetworkViewFactoryConfig config) Creates a CyNetworkViewFactory.- Parameters:
config
- may be null, an empty config will be used if null
-
createNetworkViewFactory
Creates a CyNetworkViewFactory with a default CyNetworkViewConfig that supports standard 2D rendering. -
createConfig
Create a default configuration object for the given VisualLexicon. If lexicon is null then an empty configuration object is returned.
If VisualLexicon is an instance of BasicVisualLexicon then the returned configuration object will be pre-configured to track node and edge selection. Selected nodes and edges can be retrieved via
CyNetworkViewSnapshot.getTrackedNodes(Object)
andCyNetworkViewSnapshot.getTrackedEdges(Object)
using theCyNetworkViewFactoryConfig#SELECTED_NODES
andCyNetworkViewFactoryConfig#SELECTED_EDGES
keys respectively.
-