Search in sources :

Example 36 with CyNetworkView

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

the class SetSelectedNteworkViewsEventTest method testGoodGetSelectedNetworkViewsEvent.

@Test
public void testGoodGetSelectedNetworkViewsEvent() {
    final List<CyNetworkView> views = new ArrayList<CyNetworkView>();
    final SetSelectedNetworkViewsEvent e = new SetSelectedNetworkViewsEvent(source, views);
    assertNotNull(e.getNetworkViews());
    assertEquals(views, e.getNetworkViews());
}
Also used : ArrayList(java.util.ArrayList) SetSelectedNetworkViewsEvent(org.cytoscape.application.events.SetSelectedNetworkViewsEvent) CyNetworkView(org.cytoscape.view.model.CyNetworkView) Test(org.junit.Test)

Example 37 with CyNetworkView

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

the class CySessionTest method testSetViewVisualStyleMap.

@Test
public void testSetViewVisualStyleMap() {
    CyNetworkView nv1 = mock(CyNetworkView.class);
    CyNetworkView nv2 = mock(CyNetworkView.class);
    Map<CyNetworkView, String> vsm = new HashMap<CyNetworkView, String>();
    vsm.put(nv1, "vs1");
    vsm.put(nv2, "vs2");
    session = new CySession.Builder().viewVisualStyleMap(vsm).build();
    assertNotNull(session);
    assertNotNull(session.getViewVisualStyleMap());
    assertEquals(2, session.getViewVisualStyleMap().size());
    assertTrue(session.getViewVisualStyleMap().containsKey(nv1));
    assertTrue(session.getViewVisualStyleMap().containsKey(nv2));
    assertEquals("vs1", session.getViewVisualStyleMap().get(nv1));
    assertEquals("vs2", session.getViewVisualStyleMap().get(nv2));
}
Also used : HashMap(java.util.HashMap) CyNetworkView(org.cytoscape.view.model.CyNetworkView) Test(org.junit.Test)

Example 38 with CyNetworkView

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

the class CySessionTest method testSetObjectMap.

@Test
public void testSetObjectMap() {
    Map<Object, CyNetwork> netMap = new HashMap<Object, CyNetwork>();
    CyNetwork net1 = mock(CyNetwork.class);
    netMap.put("A", net1);
    CyNetwork net2 = mock(CyNetwork.class);
    netMap.put("B", net2);
    Map<Object, CyNetworkView> viewMap = new HashMap<Object, CyNetworkView>();
    CyNetworkView view1 = mock(CyNetworkView.class);
    viewMap.put("A", view1);
    Map<Object, CyNode> nodeMap = new HashMap<Object, CyNode>();
    CyNode n1 = mock(CyNode.class);
    nodeMap.put(new Long(1), n1);
    CyNode n2 = mock(CyNode.class);
    nodeMap.put(new Long(2), n2);
    Map<Object, CyEdge> edgeMap = new HashMap<Object, CyEdge>();
    CyEdge e1 = mock(CyEdge.class);
    edgeMap.put(new Long(3), e1);
    Map<Class<? extends CyIdentifiable>, Map<Object, ? extends CyIdentifiable>> objMap = new HashMap<Class<? extends CyIdentifiable>, Map<Object, ? extends CyIdentifiable>>();
    objMap.put(CyNetwork.class, netMap);
    objMap.put(CyNetworkView.class, viewMap);
    objMap.put(CyNode.class, nodeMap);
    objMap.put(CyEdge.class, edgeMap);
    session = new CySession.Builder().objectMap(objMap).build();
    assertNotNull(session);
    assertSame(net1, session.getObject("A", CyNetwork.class));
    assertSame(net2, session.getObject("B", CyNetwork.class));
    assertSame(view1, session.getObject("A", CyNetworkView.class));
    assertSame(n1, session.getObject(new Long(1), CyNode.class));
    assertSame(n2, session.getObject(new Long(2), CyNode.class));
    assertSame(e1, session.getObject(new Long(3), CyEdge.class));
    assertNull(session.getObject("A", View.class));
    assertNull(session.getObject("B", CyNetworkView.class));
}
Also used : HashMap(java.util.HashMap) CyNetwork(org.cytoscape.model.CyNetwork) CyEdge(org.cytoscape.model.CyEdge) View(org.cytoscape.view.model.View) CyNetworkView(org.cytoscape.view.model.CyNetworkView) CyNode(org.cytoscape.model.CyNode) CyNetworkView(org.cytoscape.view.model.CyNetworkView) HashMap(java.util.HashMap) Map(java.util.Map) CyIdentifiable(org.cytoscape.model.CyIdentifiable) Test(org.junit.Test)

Example 39 with CyNetworkView

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

the class ActionEnableSupport method enableForNetworkWithoutView.

/**
	 * Enable the action if the selected network exists, is not null,
	 * and no view is available for the network.
	 */
private void enableForNetworkWithoutView() {
    final CyNetwork n = applicationManager.getCurrentNetwork();
    if (n == null) {
        setEnabled(false);
    } else {
        // Network exists.
        final Collection<CyNetworkView> views = networkViewManager.getNetworkViews(n);
        setEnabled(views.isEmpty());
    }
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 40 with CyNetworkView

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

the class UpdateNetworkPresentationEventTest method testEvents.

@Test
public void testEvents() {
    CyNetworkView networkView = mock(CyNetworkView.class);
    UpdateNetworkPresentationEvent ev3 = new UpdateNetworkPresentationEvent(networkView);
    assertEquals(networkView, ev3.getSource());
}
Also used : 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