use of org.cytoscape.application.events.SetCurrentNetworkViewEvent 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());
}
use of org.cytoscape.application.events.SetCurrentNetworkViewEvent in project cytoscape-api by cytoscape.
the class SetCurrentNetworkViewEventTest method testNullGetNetworkView.
@Test
public void testNullGetNetworkView() {
CyApplicationManager source = mock(CyApplicationManager.class);
SetCurrentNetworkViewEvent e = new SetCurrentNetworkViewEvent(source, null);
assertNull(e.getNetworkView());
}
use of org.cytoscape.application.events.SetCurrentNetworkViewEvent in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImpl method internalSetCurrentNetworkView.
private void internalSetCurrentNetworkView(final CyNetworkView view, List<CyEvent<?>> eventsToFire) {
final CyNetworkManager networkManager = serviceRegistrar.getService(CyNetworkManager.class);
if (view != null && !networkManager.networkExists(view.getModel().getSUID()))
throw new IllegalArgumentException("network is not recognized by this ApplicationManager");
boolean changed = (view == null && currentNetworkView != null) || (view != null && !view.equals(currentNetworkView));
if (changed) {
currentNetworkView = view;
eventsToFire.add(new SetCurrentNetworkViewEvent(this, currentNetworkView));
}
}
Aggregations