Search in sources :

Example 16 with CyNetworkManager

use of org.cytoscape.model.CyNetworkManager in project clusterMaker2 by RBVI.

the class ModelUtils method createChildNetwork.

public static CyNetwork createChildNetwork(ClusterManager manager, CyNetwork network, List<CyNode> nodeList, List<CyEdge> edgeList, String title) {
    String name = network.getRow(network).get(CyNetwork.NAME, String.class);
    // Create the network;
    CyNetwork newNetwork = ((CySubNetwork) network).getRootNetwork().addSubNetwork(nodeList, edgeList);
    // Register the network
    CyNetworkManager netManager = manager.getService(CyNetworkManager.class);
    netManager.addNetwork(newNetwork);
    // Set the title
    newNetwork.getRow(newNetwork).set(CyNetwork.NAME, name + title);
    return newNetwork;
}
Also used : CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetwork(org.cytoscape.model.CyNetwork)

Example 17 with CyNetworkManager

use of org.cytoscape.model.CyNetworkManager in project cytoscape-api by cytoscape.

the class AbstractNetworkEventTest method testGetNetwork.

@Test
public final void testGetNetwork() {
    final CyNetworkManager networkManager = mock(CyNetworkManager.class);
    final CyNetwork network = mock(CyNetwork.class);
    final AbstractNetworkEvent event = new AbstractNetworkEvent(networkManager, Object.class, network);
    assertEquals("Network returned by getNetwork() is *not* the one passed into the constructor!", network, event.getNetwork());
}
Also used : CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetwork(org.cytoscape.model.CyNetwork) Test(org.junit.Test)

Example 18 with CyNetworkManager

use of org.cytoscape.model.CyNetworkManager in project cytoscape-api by cytoscape.

the class NetworkAddedEventTest method testGetNetwork.

@Test
public final void testGetNetwork() {
    final CyNetworkManager networkManager = mock(CyNetworkManager.class);
    final CyNetwork network = mock(CyNetwork.class);
    final NetworkAddedEvent event = new NetworkAddedEvent(networkManager, network);
    assertEquals("Network returned by getNetwork() is *not* the one passed into the constructor!", network, event.getNetwork());
}
Also used : CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetwork(org.cytoscape.model.CyNetwork) Test(org.junit.Test)

Example 19 with CyNetworkManager

use of org.cytoscape.model.CyNetworkManager in project cytoscape-api by cytoscape.

the class NetworkAddedEventTest method testNullNetworkConstructorFailure.

@Test
public final void testNullNetworkConstructorFailure() {
    final CyNetworkManager networkManager = mock(CyNetworkManager.class);
    try {
        final NetworkAddedEvent event = new NetworkAddedEvent(networkManager, null);
    } catch (final NullPointerException e) {
        return;
    }
    fail("The expected NullPointerException was *not* triggered!");
}
Also used : CyNetworkManager(org.cytoscape.model.CyNetworkManager) Test(org.junit.Test)

Example 20 with CyNetworkManager

use of org.cytoscape.model.CyNetworkManager in project EnrichmentMapApp by BaderLab.

the class EnrichmentMap method getName.

public String getName() {
    final String undefined = "-- UNDEFINED --";
    if (serviceRegistrar == null)
        return undefined;
    CyNetworkManager networkManager = serviceRegistrar.getService(CyNetworkManager.class);
    if (networkManager == null)
        return undefined;
    CyNetwork net = networkManager.getNetwork(networkID);
    if (net == null)
        return undefined;
    return NetworkUtil.getName(net);
}
Also used : CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetwork(org.cytoscape.model.CyNetwork)

Aggregations

CyNetworkManager (org.cytoscape.model.CyNetworkManager)49 CyNetwork (org.cytoscape.model.CyNetwork)28 CyApplicationManager (org.cytoscape.application.CyApplicationManager)14 Test (org.junit.Test)14 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)12 CyNode (org.cytoscape.model.CyNode)9 ArrayList (java.util.ArrayList)8 CyGroupManager (org.cytoscape.group.CyGroupManager)8 CyNetworkFactory (org.cytoscape.model.CyNetworkFactory)8 CyRootNetworkManager (org.cytoscape.model.subnetwork.CyRootNetworkManager)7 CyNetworkViewFactory (org.cytoscape.view.model.CyNetworkViewFactory)7 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)7 CyTableManager (org.cytoscape.model.CyTableManager)6 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)6 CyNetworkView (org.cytoscape.view.model.CyNetworkView)6 RenderingEngineManager (org.cytoscape.view.presentation.RenderingEngineManager)6 TaskIterator (org.cytoscape.work.TaskIterator)6 CyEventHelper (org.cytoscape.event.CyEventHelper)5 CyLayoutAlgorithmManager (org.cytoscape.view.layout.CyLayoutAlgorithmManager)5 UndoSupport (org.cytoscape.work.undo.UndoSupport)5