This class doesn't seem particularly specific to the UI. It might be a good idea to expose this to the rest of Spark as a general utility that could be used potentially by other higher level applications that hook into the Listener interface (e.g. not just Spark's own UI). Like basically build a listener class that can either get data from a live context or read it from a file, if the file is present. Then you could have a class that extends that and adds the more UI specific stuff, like dispatching to all these internal listeners.

The doc here also implies that the GatewayUISparkListener is responsible for replaying events, but as far as I can tell that happens in another location.