Package org.scijava.ui.viewer
Interface DisplayViewer<T>
-
- All Superinterfaces:
Comparable<Prioritized>,Contextual,Disposable,HasPluginInfo,Identifiable,Locatable,Logged,Prioritized,RichPlugin,SciJavaPlugin,Versioned
- All Known Subinterfaces:
TextDisplayViewer
- All Known Implementing Classes:
AbstractDisplayViewer,AbstractTextDisplayViewer,HeadlessDisplayViewer
public interface DisplayViewer<T> extends RichPlugin, Disposable
A display viewer is a UI widget that shows a display to a user.Display viewers discoverable at runtime must implement this interface and be annotated with @
Pluginwith attributePlugin.type()=DisplayViewer.class. While it possible to create a display viewer merely by implementing this interface, it is encouraged to instead extendAbstractDisplayViewer, for convenience.- Author:
- Lee Kamentsky, Curtis Rueden
- See Also:
Plugin
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanView(Display<?> d)Returns true if an instance of this display viewer can view the given display.default voiddispose()Performs any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).Display<T>getDisplay()Gets the display being viewed.DisplayPanelgetPanel()Gets the display panel that hosts the gui elements.DisplayWindowgetWindow()Gets the window in which the view is displayed.booleanisCompatible(UserInterface ui)Returns true if this display viewer can be used with the given UI.default voidonDisplayActivatedEvent(DisplayActivatedEvent e)Handles a display activated event directed at this viewer's display.default voidonDisplayDeletedEvent(DisplayDeletedEvent e)Removes the user interface when the display is deleted.default voidonDisplayUpdatedEvent(DisplayUpdatedEvent e)Synchronizes the user interface appearance with the display model.voidsetPanel(DisplayPanel panel)Installs the display panel.default voidview(UserInterface ui, Display<?> d)Begins viewing the given display.voidview(DisplayWindow w, Display<?> d)Begins viewing the given display.-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
isCompatible
boolean isCompatible(UserInterface ui)
Returns true if this display viewer can be used with the given UI.
-
canView
boolean canView(Display<?> d)
Returns true if an instance of this display viewer can view the given display.
-
view
default void view(UserInterface ui, Display<?> d)
Begins viewing the given display.The default behavior of this method is to ask the given
UserInterfaceto create aDisplayWindowviaUserInterface.createDisplayWindow(Display)and then pass it toview(DisplayWindow, Display). Viewers needing to customize details of theDisplayWindowcreation can do so via this method.- Parameters:
ui- The user interface with which the viewer will be associated.d- the model for the display to show.
-
view
void view(DisplayWindow w, Display<?> d)
Begins viewing the given display.- Parameters:
w- The frame / window that will contain the GUI elementsd- the model for the display to show.
-
getWindow
DisplayWindow getWindow()
Gets the window in which the view is displayed.
-
setPanel
void setPanel(DisplayPanel panel)
Installs the display panel.- Parameters:
panel- the panel used to host the gui
-
getPanel
DisplayPanel getPanel()
Gets the display panel that hosts the gui elements.
-
onDisplayUpdatedEvent
default void onDisplayUpdatedEvent(DisplayUpdatedEvent e)
Synchronizes the user interface appearance with the display model.
-
onDisplayDeletedEvent
default void onDisplayDeletedEvent(DisplayDeletedEvent e)
Removes the user interface when the display is deleted.
-
onDisplayActivatedEvent
default void onDisplayActivatedEvent(DisplayActivatedEvent e)
Handles a display activated event directed at this viewer's display. Note that the event's display may not be the viewer's display, but the active display will always be the viewer's display.
-
dispose
default void dispose()
Description copied from interface:DisposablePerforms any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).- Specified by:
disposein interfaceDisposable
-
-