Search in sources :

Example 1 with SetCurrentNetworkViewEvent

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());
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) SetCurrentNetworkViewEvent(org.cytoscape.application.events.SetCurrentNetworkViewEvent) CyNetworkView(org.cytoscape.view.model.CyNetworkView) Test(org.junit.Test)

Example 2 with SetCurrentNetworkViewEvent

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());
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) SetCurrentNetworkViewEvent(org.cytoscape.application.events.SetCurrentNetworkViewEvent) Test(org.junit.Test)

Example 3 with SetCurrentNetworkViewEvent

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));
    }
}
Also used : SetCurrentNetworkViewEvent(org.cytoscape.application.events.SetCurrentNetworkViewEvent) CyNetworkManager(org.cytoscape.model.CyNetworkManager)

Aggregations

SetCurrentNetworkViewEvent (org.cytoscape.application.events.SetCurrentNetworkViewEvent)3 CyApplicationManager (org.cytoscape.application.CyApplicationManager)2 Test (org.junit.Test)2 CyNetworkManager (org.cytoscape.model.CyNetworkManager)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1