Search in sources :

Example 11 with CyNetworkView

use of org.cytoscape.view.model.CyNetworkView in project cytoscape-api by cytoscape.

the class SetCurrentNetworkViewEventTest method testGoodGetNetworkView.

@Test
public void testGoodGetNetworkView() {
    CyApplicationManager source = mock(CyApplicationManager.class);
    CyNetworkView n = mock(CyNetworkView.class);
    SetCurrentNetworkViewEvent e = new SetCurrentNetworkViewEvent(source, n);
    assertNotNull(e.getNetworkView());
    assertEquals(n, e.getNetworkView());
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) SetCurrentNetworkViewEvent(org.cytoscape.application.events.SetCurrentNetworkViewEvent) CyNetworkView(org.cytoscape.view.model.CyNetworkView) Test(org.junit.Test)

Example 12 with CyNetworkView

use of org.cytoscape.view.model.CyNetworkView in project cytoscape-api by cytoscape.

the class ActionEnableSupport method enableForNetworkAndView.

/**
	 * Enable the action if the current network and view exist and are not null.
	 */
private void enableForNetworkAndView() {
    final CyNetworkView v = applicationManager.getCurrentNetworkView();
    setEnabled(v != null);
}
Also used : CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 13 with CyNetworkView

use of org.cytoscape.view.model.CyNetworkView in project cytoscape-api by cytoscape.

the class CySessionTest method testSetNetworkViews.

@Test
public void testSetNetworkViews() {
    CyNetworkView nv1 = mock(CyNetworkView.class);
    CyNetworkView nv2 = mock(CyNetworkView.class);
    Set<CyNetworkView> vs = new HashSet<CyNetworkView>();
    vs.add(nv1);
    vs.add(nv2);
    session = new CySession.Builder().networkViews(vs).build();
    assertNotNull(session);
    assertNotNull(session.getNetworkViews());
    assertEquals(2, session.getNetworkViews().size());
    assertTrue(session.getNetworkViews().contains(nv1));
    assertTrue(session.getNetworkViews().contains(nv2));
}
Also used : CyNetworkView(org.cytoscape.view.model.CyNetworkView) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 14 with CyNetworkView

use of org.cytoscape.view.model.CyNetworkView in project cytoscape-api by cytoscape.

the class PartitionUtilTest method testPartition2.

@Test
public void testPartition2() {
    CyNetworkView networkView = mock(CyNetworkView.class);
    CyNetwork network = mock(CyNetwork.class);
    when(networkView.getModel()).thenReturn(network);
    EdgeWeighter edgeWeighter = new EdgeWeighter();
    List<LayoutPartition> result = PartitionUtil.partition(networkView, false, edgeWeighter);
    assertNotNull(result);
    assertEquals(0, result.size());
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) CyNetworkView(org.cytoscape.view.model.CyNetworkView) Test(org.junit.Test)

Example 15 with CyNetworkView

use of org.cytoscape.view.model.CyNetworkView in project cytoscape-api by cytoscape.

the class PartitionUtilTest method testPartition1.

@Test
public void testPartition1() {
    CyNetworkView networkView = mock(CyNetworkView.class);
    CyNetwork network = mock(CyNetwork.class);
    when(networkView.getModel()).thenReturn(network);
    Collection<CyNode> nodes = new ArrayList<CyNode>();
    EdgeWeighter edgeWeighter = new EdgeWeighter();
    List<LayoutPartition> result = PartitionUtil.partition(networkView, nodes, edgeWeighter);
    assertNotNull(result);
    assertEquals(0, result.size());
}
Also used : ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode) CyNetworkView(org.cytoscape.view.model.CyNetworkView) Test(org.junit.Test)

Aggregations

CyNetworkView (org.cytoscape.view.model.CyNetworkView)41 Test (org.junit.Test)16 CyNetwork (org.cytoscape.model.CyNetwork)13 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)10 VisualStyle (org.cytoscape.view.vizmap.VisualStyle)8 CyNode (org.cytoscape.model.CyNode)7 HashMap (java.util.HashMap)5 JPanel (javax.swing.JPanel)5 CyEdge (org.cytoscape.model.CyEdge)5 TaskIterator (org.cytoscape.work.TaskIterator)5 Timer (javax.swing.Timer)4 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)4 EMSignatureDataSet (org.baderlab.csplugins.enrichmentmap.model.EMSignatureDataSet)4 CyTable (org.cytoscape.model.CyTable)4 CyCustomGraphics2 (org.cytoscape.view.presentation.customgraphics.CyCustomGraphics2)4 Inject (com.google.inject.Inject)3 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 HashSet (java.util.HashSet)3 List (java.util.List)3