@Override
  public void onGraphEvent(final GraphEvent graphevent) {
    // This function receives only multi-selection events.

    if (graphevent.getType() == GraphEvent.PRE_EVENT) {
      // Count the started event sequences
      sequenceCounter++;
    } else if (graphevent.getType() == GraphEvent.POST_EVENT) {
      // Finish the counting of an event sequence

      sequenceCounter--;

      // If all event sequences finished, we can fire the event.
      if (sequenceCounter == 0) {
        updateSelectionState((Graph2D) graphevent.getGraph());

        // This flag makes sure to fire the event for single
        // selection events in onGraph2DSelectionEvent
        fireFlag = true;
      }
    }
  }
Adds a graph selection listener that is notified when the selection of the graph changes.

@param listener The listener to add.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/ZyGraphSelectionObserver.java