Interface DisplaySettingsChangedEvent

All Superinterfaces:
MMEvent

public interface DisplaySettingsChangedEvent extends MMEvent
Event used internally by a data viewer to respond to requests to update the display settings.

All compliant DataViewer implementations post an instance of this event when told to change the display settings (this is usually handled by AbstractDataViewer). Implementations then subscribe to this event, and in their handler(s) arrange to apply the new settings.

DataViewer.setDisplaySettings and other methods that can result in new display settings can be called on any thread. This event is posted from any such calling thread. Thus, handlers for this event must be prepared to be called on any thread, including the Swing/AWT event dispatch thread (EDT).

It is guaranteed that only a single instance of this event will ever be posted concurrently for a given data viewer, and that such posting will happen in the correct order.

Although applying display settings almost always requires interaction with UI components, handlers for this event must not perform any action synchronously on the EDT (such as by calling SwingUtilities.invokeAndWait). Instead, actions on the EDT should be deferred until a later time (such as by calling SwingUtilities.invokeLater).

This event may be posted at a relatively high frequency (up to 60 times per second under normal conditions, though there is no guaranteed upper limit), so well-designed handlers should defer time-consuming operations to a later time.

It is okay for objects not directly related to the data viewer to subscribe to this event, but they must obey the same rules regarding threading and performance.

The default implementation of this event posts on the DataViewer event bus. Register using DataViewer.registerForEvents(Object).

  • Method Details

    • getDisplaySettings

      DisplaySettings getDisplaySettings()
      Get the new display settings.
      Returns:
      the new display settings
    • getPreviousDisplaySettings

      DisplaySettings getPreviousDisplaySettings()
      Get the display settings before the change being handled.

      Comparing this with the return value of getDisplaySettings can reveal what exactly is to be changed.

      Returns:
      the previous display settings
    • getDataViewer

      DataViewer getDataViewer()
      Get the data viewer.
      Returns:
      the data viewer for which the new display settings is to be applied
    • getDisplay

      @Deprecated DataViewer getDisplay()
      Deprecated.
      use getDataViewer instead
      Old name for getDataViewer.
      Returns:
      the data viewer for which the new display settings is to be applied