public interface DataViewer extends EventPublisher
AbstractDataViewer
 rather than directly implementing this interface. That will allow your
 implementation to continue to work when methods are added to this interface
 in the future.
 Warning: Support for custom data viewers is experimental. Future updates may require you to update such code for compatibility.
| Modifier and Type | Method and Description | 
|---|---|
void | 
addListener(DataViewerListener listener,
           int priority)
Listeners will be notified of important events of the DataViewer 
 | 
boolean | 
compareAndSetDisplayPosition(Coords originalPosition,
                            Coords newPosition)
Set the display position only if the current position is the expected one. 
 | 
boolean | 
compareAndSetDisplayPosition(Coords originalPosition,
                            Coords newPosition,
                            boolean forceRedisplay)
Set the display position only if the current position is the expected one. 
 | 
boolean | 
compareAndSetDisplaySettings(DisplaySettings originalSettings,
                            DisplaySettings newSettings)
Set the display settings only if the current settings match the expected
 one. 
 | 
DataProvider | 
getDataProvider()
Retrieve the data provider backing this viewer. 
 | 
Datastore | 
getDatastore()
Deprecated. 
 
use  
getDataProvider() instead | 
java.util.List<Image> | 
getDisplayedImages()
Retrieve the Images currently being displayed. 
 | 
Coords | 
getDisplayPosition()
Get the coordinates for the currently displayed images. 
 | 
DisplaySettings | 
getDisplaySettings()
Get the current display settings. 
 | 
java.lang.String | 
getName()
Return the name of this viewer. 
 | 
boolean | 
isClosed()
Return true if this viewer has been closed. 
 | 
boolean | 
isVisible()
Return true if this viewer is visible. 
 | 
void | 
registerForEvents(java.lang.Object recipient)
Register an object to receive events on the viewer event bus. 
 | 
void | 
removeListener(DataViewerListener listener)
No longer notify this listener 
 | 
void | 
setDisplayedImageTo(Coords position)
Deprecated. 
 
use  
setDisplayPosition(Coords) instead | 
void | 
setDisplayPosition(Coords position)
Display the images at the specified coordinates in the data provider. 
 | 
void | 
setDisplayPosition(Coords position,
                  boolean forceRedisplay)
Display the images at the specified coordinates in the data provider. 
 | 
void | 
setDisplaySettings(DisplaySettings settings)
Set the display settings. 
 | 
void | 
unregisterForEvents(java.lang.Object recipient)
Unregister an object from the viewer event bus. 
 | 
void registerForEvents(java.lang.Object recipient)
 Objects registered by this method will receive viewer events through
 their methods bearing a com.google.common.eventbus.Subscribe
 annotation. See Guava Event Bus documentation for how this works.
 
Events that can be subscribed to include:
DisplaySettingsChangedEvent (on an arbitrary thread)
 DisplayPositionChangedEvent (on an arbitrary thread)
 registerForEvents in interface EventPublisherrecipient - the object to registerunregisterForEvents(Object)void unregisterForEvents(java.lang.Object recipient)
EventPublisherunregisterForEvents in interface EventPublisherrecipient - the object to unregisterEventPublisher.registerForEvents(java.lang.Object)void setDisplaySettings(DisplaySettings settings)
 This method is a good way to set all of the display settings at once, for
 example to restore a saved set of settings. For changing just part of the
 settings (for example, in response to the user setting a UI control), see
 compareAndSetDisplaySettings(DisplaySettings, DisplaySettings).
 
 This method can be called from any thread. There may be a delay before
 the new settings are actually reflected in the viewer user interface.
 However, getDisplaySettings() will always reflect the most recent
 settings, even if they have not yet been applied to the UI.
settings - the new display settingsDisplaySettings getDisplaySettings()
 This method can be called from any thread. The return value will be
 consistent with the most recent call to setDisplaySettings(DisplaySettings) or
 compareAndSetDisplaySettings.
boolean compareAndSetDisplaySettings(DisplaySettings originalSettings, DisplaySettings newSettings)
This method will allow you to make changes to the display settings in a way that is safe if multiple threads are trying to make changes. For example, the following code will set the zoom. If another thread has makes a change to another part of the display settings at the same time (using the same method), all changes will be correctly reflected.
 DataViewer viewer = ...;
 do {
    DisplaySettings oldSettings = viewer.getDisplaySettings();
    DisplaySettings newSettings = oldSettings.copy().
          zoom(2.0).build();
 } while (!viewer.compareAndSetDisplaySettings(oldSettings, newSettings));
 originalSettings - apply the new settings only if the current
 settings match thisnewSettings - the new settingsDataProvider getDataProvider()
private
 final field in your implementation.@Deprecated Datastore getDatastore()
getDataProvider() insteadnull if this viewer
 is backed by a data provider that is not a datastorevoid setDisplayPosition(Coords position, boolean forceRedisplay)
The exact interpretation of the position may depend on the viewer implementation: for example, a 3D viewer might ignore the Z slice coordinate passed to this method and instead display a whole volume. If the passed position does not uniquely specify a set of images to display, then the viewer might choose an arbitrary subset of the passed coordinates.
 This method can be called from any thread. There may be a delay before
 the new position is actually reflected in the viewer user interface.
 However, getDisplayPosition() will always reflect the most recent
 position, even if it has not been applied to the UI.
position - the coordinates of the images to displayforceRedisplay - if true, assume the image(s) at the position may
 have changed even if the position does not differ from the current onecompareAndSetDisplaySettings(DisplaySettings, DisplaySettings)void setDisplayPosition(Coords position)
 See setDisplayPosition(Coords, boolean) for details. This method
 does not force a redisplay if position is the same as the current
 display position.
position - the coordinates of the images to displayCoords getDisplayPosition()
 This method can be called from any thread. The return value will be
 consistent with the most recent call to setDisplayPosition(Coords) or
 compareAndSetDisplayPosition.
boolean compareAndSetDisplayPosition(Coords originalPosition, Coords newPosition, boolean forceRedisplay)
This method will allow you to set the display position based on the current position in a way that is safe if multiple threads are trying to make changes. For example, the following code will scroll to the next channel. If the display position is being changed by another thread (perhaps the time points are being animated, or new time points are being added), all changes will be correctly reflected.
 DataViewer viewer = ...;
 do {
    Coords oldPos = viewer.getDisplayPosition();
    Coords newPos = oldPos.copy().
          channel((oldPos.getChannel() + 1) % nChannels).build();
 } while (!viewer.compareAndSetDisplayPosition(oldPos, newPos));
 originalPosition - apply the new position only if the current
 position matches this onenewPosition - the new display positionforceRedisplay - if true, assume the image(s) at the position may
 have changed even if the position does not differ from the current oneboolean compareAndSetDisplayPosition(Coords originalPosition, Coords newPosition)
 See compareAndSetDisplayPosition(Coords, Coords, boolean) for
 details.
 
 This method will not force a redisplay if newPosition is the same
 as the current display position.
originalPosition - newPosition - @Deprecated void setDisplayedImageTo(Coords position)
setDisplayPosition(Coords) insteadsetDisplayPosition(Coords).position - the coordinates of the images to displayjava.util.List<Image> getDisplayedImages() throws java.io.IOException
This method can be called from any thread.
java.io.IOExceptionboolean isVisible()
boolean isClosed()
java.lang.String getName()
void addListener(DataViewerListener listener, int priority)
listener - - that will be notifiedpriority - - determines the order in which listeners will be called.
 the lower the number, the earlier the listener will be called.  If the 
 priority matches a previously added listener, the previously added listener
 will be called firstvoid removeListener(DataViewerListener listener)
listener - - that will no longer be notified