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());
}
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));
}
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));
}
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());
}
}
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());
}
Aggregations