public interface DisplaySettingsChangedEvent extends MMEvent
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)
.
Modifier and Type | Method and Description |
---|---|
DataViewer |
getDataViewer()
Get the data viewer.
|
DataViewer |
getDisplay()
Deprecated.
use
getDataViewer instead |
DisplaySettings |
getDisplaySettings()
Get the new display settings.
|
DisplaySettings |
getPreviousDisplaySettings()
Get the display settings before the change being handled.
|
DisplaySettings getDisplaySettings()
DisplaySettings getPreviousDisplaySettings()
Comparing this with the return value of getDisplaySettings
can
reveal what exactly is to be changed.
DataViewer getDataViewer()
@Deprecated DataViewer getDisplay()
getDataViewer
insteadgetDataViewer
.