Search in sources :

Example 1 with CyEvent

use of org.cytoscape.event.CyEvent in project cytoscape-impl by cytoscape.

the class CyApplicationManagerImpl method handleEvent.

@Override
public void handleEvent(final NetworkAboutToBeDestroyedEvent event) {
    final CyNetwork toBeDestroyed = event.getNetwork();
    final List<CyEvent<?>> eventsToFire = new ArrayList<>();
    synchronized (lock) {
        logger.debug("NetworkAboutToBeDestroyedEvent: " + toBeDestroyed + ". Current: " + currentNetwork);
        if (toBeDestroyed.equals(currentNetwork)) {
            internalSetCurrentNetwork(null, eventsToFire);
        }
    }
    fireEvents(eventsToFire);
}
Also used : ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) CyEvent(org.cytoscape.event.CyEvent)

Example 2 with CyEvent

use of org.cytoscape.event.CyEvent in project cytoscape-impl by cytoscape.

the class CyApplicationManagerImpl method handleEvent.

@Override
public void handleEvent(final NetworkViewAboutToBeDestroyedEvent event) {
    final CyNetworkView toBeDestroyed = event.getNetworkView();
    final List<CyEvent<?>> eventsToFire = new ArrayList<>();
    synchronized (lock) {
        logger.debug("NetworkViewAboutToBeDestroyedEvent: " + toBeDestroyed + ". Current: " + currentNetworkView);
        if (toBeDestroyed.equals(currentNetworkView)) {
            internalSetCurrentNetworkView(null, eventsToFire);
        }
        // TODO: Do we need to fire an event?  Most listeners that care
        // would just listen for NetworkViewAboutToBeDestroyedEvent.
        selectedNetworkViews.removeAll(Collections.singletonList(toBeDestroyed));
    }
    fireEvents(eventsToFire);
}
Also used : ArrayList(java.util.ArrayList) CyEvent(org.cytoscape.event.CyEvent) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Aggregations

ArrayList (java.util.ArrayList)2 CyEvent (org.cytoscape.event.CyEvent)2 CyNetwork (org.cytoscape.model.CyNetwork)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1